Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2011-02-06 02:07:28 +0000
committerkmoore2011-02-06 02:07:28 +0000
commitc9c9e2b3e236ad701f642b72bca0cfabcac1d97b (patch)
tree346196323dc94395c2348339ac67e4f4cec6ebbf /jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt
parent8f2746f6b8c2ddc81d653d54d280043c41ed4734 (diff)
downloadwebtools.dali-c9c9e2b3e236ad701f642b72bca0cfabcac1d97b.tar.gz
webtools.dali-c9c9e2b3e236ad701f642b72bca0cfabcac1d97b.tar.xz
webtools.dali-c9c9e2b3e236ad701f642b72bca0cfabcac1d97b.zip
renamed org.eclipse.jpt.core to org.eclipse.jpt.jpa.core
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java1100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java270
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java549
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java774
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java292
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java195
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java183
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java839
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java402
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java223
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java1955
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java161
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java432
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java319
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java319
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java383
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java1816
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java225
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java476
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java348
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java780
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java292
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java816
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java722
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java231
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java347
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java584
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java276
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java315
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java216
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java272
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java300
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java385
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java1016
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java419
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java302
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java328
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java425
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java2285
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java224
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java508
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java332
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java813
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java287
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java418
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java541
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java482
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java325
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java314
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java386
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java323
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java223
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java241
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java263
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java209
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java272
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java430
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java585
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java384
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java2404
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java529
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java715
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java230
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java618
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java267
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java269
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java587
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java255
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java182
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java284
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java220
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java283
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java212
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java496
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java486
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java247
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java208
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java370
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java317
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java400
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java567
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java335
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java166
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java472
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java201
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java303
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java261
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java511
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java452
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java1195
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java366
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java418
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java440
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java378
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java302
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java251
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java432
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java1530
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java178
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java276
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java1592
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java282
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java337
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java272
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java222
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java244
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java157
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java280
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java288
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java257
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java255
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java242
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java225
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java657
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java694
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java232
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java472
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java265
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java245
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java182
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java334
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java426
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java222
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java186
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java409
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java408
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java930
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java351
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java201
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java357
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java283
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java470
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaFactory2_0.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MappingKeys2_0.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/AttributeMapping2_0.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cacheable2_0.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CacheableHolder2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cascade2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionTable2_0.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentityStrategy2_0.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedIdMapping2_0.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdDerivedIdentityStrategy2_0.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdMapping2_0.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/JpaRootContextNode2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/LockModeType2_0.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToManyMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneRelationship2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappedByRelationshipMapping2_0.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitDefaults2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitMetadata2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MapsIdDerivedIdentityStrategy2_0.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelField.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/NamedQuery2_0.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyRelationship2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneRelationship2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrderColumn2_0.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Orderable2_0.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovable2_0.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovalHolder2_0.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OverrideRelationship2_0.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentAttribute2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentType2_0.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyOverrideRelationship2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyPersistentAttribute2_0.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SequenceGenerator2_0.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SingleRelationshipMapping2_0.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/VirtualOverrideRelationship2_0.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheable2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCascade2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionTable2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaDerivedIdentity2_0.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaElementCollectionMapping2_0.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaEmbeddedMapping2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaIdDerivedIdentityStrategy2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToManyMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneMapping2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneRelationship2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapsIdDerivedIdentityStrategy2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaNamedQuery2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyRelationship2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneRelationship2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderColumn2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovable2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovalHolder2_0.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOverrideRelationship2_0.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentAttribute2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSequenceGenerator2_0.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaVirtualOverrideRelationship2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheable2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheableHolder2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCascade2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionTable2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmDerivedIdentity2_0.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmEmbeddedMapping2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmIdDerivedIdentityStrategy2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToManyMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneRelationship2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapsIdDerivedIdentityStrategy2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmNamedQuery2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyRelationship2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneRelationship2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderColumn2_0.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderable2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovable2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovalHolder2_0.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOverrideRelationship2_0.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitDefaults2_0.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitMetadata2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentAttribute2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmReadOnlyPersistentAttribute2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSequenceGenerator2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSingleRelationshipMapping2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmVirtualOverrideRelationship2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/connection/JpaConnection2_0.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/JpaOptions2_0.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/SharedCacheMode.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/ValidationMode.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/AssociationOverride2_0Annotation.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/CollectionTable2_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JPA2_0.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/LockModeType_2_0.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToMany2_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToOne2_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyColumn2_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyEnumerated2_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumn2_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyTemporal2_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NamedQuery2_0Annotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToMany2_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToOne2_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OrderColumn2_0Annotation.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OwningRelationshipMapping2_0Annotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/RelationshipMapping2_0Annotation.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/SequenceGenerator2_0Annotation.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/libprov/JpaLibraryProviderInstallOperationConfig.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java386
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderEvent.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderListener.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AccessType.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverrideAnnotation.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseColumnAnnotation.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CascadeType.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ColumnAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CompleteColumnAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorColumnAnnotation.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorType.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumType.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/FetchType.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GenerationType.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceType.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JPA.java303
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToManyAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToOneAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueryAnnotation.java89
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueryAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToManyAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToOneAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OwnableRelationshipMappingAnnotation.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SingleRelationshipMappingAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalType.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlAttributeMapping.java280
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlColumn.java500
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlEmbedded.java220
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java1100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlNamedColumn.java286
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlReferenceTable.java222
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java400
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlSingleRelationshipMapping.java614
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTable.java439
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTypeMapping.java547
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AccessType.java235
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Attributes.java792
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/CascadeType.java586
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnMapping.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnResult.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/DiscriminatorType.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListener.java928
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListeners.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityResult.java363
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EnumType.java235
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EventMethod.java285
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FetchType.java235
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FieldResult.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/GenerationType.java289
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Inheritance.java231
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/InheritanceType.java260
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/JPA.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Lob.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmFactory.java970
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java12554
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostLoad.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostPersist.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostRemove.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostUpdate.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PrePersist.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreRemove.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreUpdate.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/SqlResultSetMapping.java418
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/TemporalType.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAccessHolder.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverride.java521
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverrideContainer.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeMapping.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverride.java440
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverrideContainer.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlBasic.java687
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java246
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlCollectionTable.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlColumn.java375
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlConvertibleMapping.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlDiscriminatorColumn.java297
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java1660
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddable.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbedded.java256
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddedId.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntity.java2312
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java1118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEventMethodContainer.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratedValue.java303
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGenerator.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratorContainer.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlId.java805
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlIdClassContainer.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumn.java234
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumnContainer.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTable.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTableContainer.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToMany.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToOne.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedByMapping.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedSuperclass.java574
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedNativeQuery.java586
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedQuery.java542
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNullAttributeMapping.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToMany.java376
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToOne.java467
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderColumn.java404
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderable.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOverride.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitDefaults.java727
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitMetadata.java394
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumn.java230
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumnContainer.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQuery.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryContainer.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryHint.java366
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlReferenceTable.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSequenceGenerator.java702
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTable.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTableGenerator.java947
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTransient.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTypeMapping.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlUniqueConstraint.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlVersion.java523
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/JPA2_0.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/LockModeType_2_0.java397
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Factory.java166
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java3784
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAssociationOverride_2_0.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeMapping_2_0.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeOverride_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributes_2_0.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCacheable_2_0.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCascadeType_2_0.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCollectionTable_2_0.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlDerivedId_2_0.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java326
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEmbedded_2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntityListener_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntity_2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEventMethod_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlGenerator_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlManyToMany_2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyAttributeOverrideContainer_2_0.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyClass_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapsId_2_0.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java174
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlNamedQuery_2_0.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToMany_2_0.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToOne_2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderColumn_2_0.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderable_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrphanRemovable_2_0.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitDefaults_2_0.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitMetadata_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQueryHint_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQuery_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSequenceGenerator_2_0.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSingleRelationshipMapping_2_0.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSqlResultSetMapping_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlUniqueConstraint_2_0.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/JPA.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceFactory.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistencePackage.java1302
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java248
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java277
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnit.java1105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnitTransactionType.java236
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperties.java202
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperty.java322
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/JPA2_0.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Factory.java192
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Package.java452
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitCachingType_2_0.java312
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitValidationModeType_2_0.java258
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnit_2_0.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaEObject.java332
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaRootEObject.java335
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonFactory.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonPackage.java436
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/EmfTools.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaEObject.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaRootEObject.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java307
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/XML.java35
1545 files changed, 207564 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java
new file mode 100644
index 0000000000..0564829788
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.ForeignKey;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Provide a pluggable way to determine whether and how the entity generator
+ * prints the names of various database objects.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface EntityGeneratorDatabaseAnnotationNameBuilder {
+
+ /**
+ * Given the name of an entity and the table to which it is mapped,
+ * build and return a string to be used as the value for the entity's
+ * Table annotation's 'name' element. Return null if the entity
+ * maps to the table by default.
+ */
+ String buildTableAnnotationName(String entityName, Table table);
+
+ /**
+ * Given the name of an attribute (field or property) and the column
+ * to which it is mapped,
+ * build and return a string to be used as the value for the attribute's
+ * Column annotation's 'name' element. Return null if the attribute
+ * maps to the column by default.
+ */
+ String buildColumnAnnotationName(String attributeName, Column column);
+
+ /**
+ * Given the name of an attribute (field or property) and the
+ * many-to-one or many-to-many foreign key to which it is mapped,
+ * build and return a string to be used as the value for the attribute's
+ * JoinColumn annotation's 'name' element. Return null if the attribute
+ * maps to the join column by default.
+ * The specified foreign key consists of a single column pair whose
+ * referenced column is the single-column primary key of the foreign
+ * key's referenced table.
+ */
+ String buildJoinColumnAnnotationName(String attributeName, ForeignKey foreignKey);
+
+ /**
+ * Build and return a string to be used as the value for a JoinColumn
+ * annotation's 'name' or 'referencedColumnName' element.
+ * This is called for many-to-one and many-to-many mappings when
+ * the default join column name and/or referenced column name are/is
+ * not applicable.
+ * @see #buildJoinColumnAnnotationName(String, ForeignKey)
+ */
+ String buildJoinColumnAnnotationName(Column column);
+
+ /**
+ * Build and return a string to be used as the value for a JoinTable
+ * annotation's 'name' element.
+ * This is called for many-to-many mappings when the default
+ * join table name is not applicable.
+ */
+ String buildJoinTableAnnotationName(Table table);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java
new file mode 100644
index 0000000000..44d0ded6b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java
@@ -0,0 +1,1100 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import java.util.Vector;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceProxy;
+import org.eclipse.core.resources.IResourceProxyVisitor;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+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.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.utility.CallbackJobSynchronizer;
+import org.eclipse.jpt.common.core.internal.utility.JobCommand;
+import org.eclipse.jpt.common.core.internal.utility.JobSynchronizer;
+import org.eclipse.jpt.common.utility.Command;
+import org.eclipse.jpt.common.utility.internal.AsynchronousCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.SimpleCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.StatefulCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer;
+import org.eclipse.jpt.common.utility.synchronizers.Synchronizer;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.SimpleJpaProjectConfig;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+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;
+
+/**
+ * The JPA project manager maintains a list of all JPA projects in the workspace.
+ * It keeps the list (and the state of the JPA projects themselves)
+ * synchronized with the workspace by listening for various
+ * changes:<ul>
+ * <li>Resource
+ * <li>Java
+ * <li>Faceted Project
+ * </ul>
+ * We use an Eclipse {@link ILock lock} to synchronize access to the JPA
+ * projects when dealing with these events. In an effort to reduce deadlocks,
+ * the simple Resource and Java change events are dispatched to a background
+ * thread, allowing us to handle the events outside of the workspace lock held
+ * during resource and Java change notifications.
+ * <p>
+ * Events that trigger either the adding or removing of a JPA project (e.g.
+ * {@link IResourceChangeEvent#POST_CHANGE}) are handled "synchronously"
+ * by allowing the background thread to handle any outstanding events before
+ * updating the list of JPA projects and returning execution to the event
+ * source.
+ * <p>
+ * Various things that cause us to add or remove a JPA project:<ul>
+ * <li>The {@link JptJpaCorePlugin} will "lazily" instantiate and {@link #start() start}
+ * a JPA project manager as appropriate. This will trigger the manager
+ * to find and add all pre-existing JPA projects.
+ *
+ * <li>Project created and facet installed<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * <li>Project facet uninstalled<p>
+ * {@link IFacetedProjectEvent.Type#PRE_UNINSTALL}
+ *
+ * <li>Project opened<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * -> {@link IResource#FILE}
+ * -> {@link IResourceDelta#ADDED} facet settings file
+ * (<code>/.settings/org.eclipse.wst.common.project.facet.core.xml</code>)
+ * <li>Project closed<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * -> {@link IResource#FILE}
+ * -> {@link IResourceDelta#REMOVED} facet settings file
+ *
+ * <li>Pre-existing project imported from directory or archive (created and opened)<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * -> {@link IResource#FILE}
+ * -> {@link IResourceDelta#ADDED} facet settings file
+ * <li>Project renamed<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * -> {@link IResource#FILE}
+ * -> {@link IResourceDelta#REMOVED} facet settings file of old project
+ * -> {@link IResourceDelta#ADDED} facet settings file of new project
+ * <li>Project deleted<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * -> {@link IResource#FILE}
+ * -> {@link IResourceDelta#REMOVED} facet settings file
+ *
+ * <li>Project facet installed by editing the facets settings file directly<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * -> {@link IResource#FILE}
+ * -> {@link IResourceDelta#CHANGED} facet settings file
+ * <li>Project facet uninstalled by editing the facets settings file directly<p>
+ * {@link IResourceChangeEvent#POST_CHANGE}
+ * -> {@link IResource#FILE}
+ * -> {@link IResourceDelta#CHANGED} facet settings file
+ * </ul>
+ */
+// TODO remove faceted project listener and rely solely on resource change events
+// for the faceted project settings file
+class GenericJpaProjectManager
+ extends AbstractModel
+ implements JpaProjectManager
+{
+ /**
+ * All the JPA projects in the workspace.
+ */
+ private final Vector<JpaProject> jpaProjects = new Vector<JpaProject>();
+
+ /**
+ * Synchronize access to the JPA projects.
+ */
+ /* CU private */ final ILock lock = this.getJobManager().newLock();
+
+ /**
+ * Determine how Resource and Java change events are
+ * handled (i.e. synchronously or asynchronously).
+ */
+ private volatile StatefulCommandExecutor eventHandler = new AsynchronousCommandExecutor(JptCommonCoreMessages.DALI_EVENT_HANDLER_THREAD_NAME);
+
+ /**
+ * Listen for<ul>
+ * <li>changes to projects and files
+ * <li>clean builds
+ * </ul>
+ */
+ private final IResourceChangeListener resourceChangeListener = new ResourceChangeListener();
+
+ /**
+ * The types of resource change events that interest
+ * {@link #resourceChangeListener}.
+ */
+ private static final int RESOURCE_CHANGE_EVENT_TYPES =
+ IResourceChangeEvent.POST_CHANGE |
+ IResourceChangeEvent.POST_BUILD;
+
+ /**
+ * Listen for changes to this file to determine when the JPA facet is
+ * added to or removed from a "faceted" project.
+ */
+ private static final String FACETED_PROJECT_FRAMEWORK_SETTINGS_FILE_NAME = FacetedProjectFramework.PLUGIN_ID + ".xml"; //$NON-NLS-1$
+
+ /**
+ * Listen for the JPA facet being added to or removed from a "faceted" project.
+ */
+ private final IFacetedProjectListener facetedProjectListener = new FacetedProjectListener();
+
+ /**
+ * The types of faceted project events that interest
+ * {@link #facetedProjectListener}.
+ */
+ private static final IFacetedProjectEvent.Type[] FACETED_PROJECT_EVENT_TYPES = new IFacetedProjectEvent.Type[] {
+ IFacetedProjectEvent.Type.PRE_UNINSTALL
+ };
+
+ /**
+ * Listen for Java changes (unless the Dali UI is active).
+ * @see #javaElementChangeListenerIsActive()
+ */
+ private final JavaElementChangeListener javaElementChangeListener = new JavaElementChangeListener();
+
+ /**
+ * The types of resource change events that interest
+ * {@link #javaElementChangeListener}.
+ */
+ private static final int JAVA_CHANGE_EVENT_TYPES =
+ ElementChangedEvent.POST_CHANGE |
+ ElementChangedEvent.POST_RECONCILE;
+
+
+ // ********** constructor **********
+
+ /**
+ * Internal: called by {@link JptJpaCorePlugin Dali plug-in}.
+ */
+ GenericJpaProjectManager() {
+ super();
+ }
+
+
+ // ********** plug-in controlled life-cycle **********
+
+ /**
+ * Internal: called by {@link JptJpaCorePlugin Dali plug-in}.
+ */
+ void start() {
+ try {
+ this.lock.acquire();
+ this.start_();
+ } finally {
+ this.lock.release();
+ }
+ }
+
+ private void start_() {
+ debug("*** JPA project manager START ***"); //$NON-NLS-1$
+ try {
+ this.buildJpaProjects();
+ this.eventHandler.start();
+ this.getWorkspace().addResourceChangeListener(this.resourceChangeListener, RESOURCE_CHANGE_EVENT_TYPES);
+ FacetedProjectFramework.addListener(this.facetedProjectListener, FACETED_PROJECT_EVENT_TYPES);
+ JavaCore.addElementChangedListener(this.javaElementChangeListener, JAVA_CHANGE_EVENT_TYPES);
+ } catch (RuntimeException ex) {
+ JptJpaCorePlugin.log(ex);
+ this.stop_();
+ }
+ }
+
+ /**
+ * Side-effect: {@link #jpaProjects} populated.
+ */
+ private void buildJpaProjects() {
+ try {
+ this.buildJpaProjects_();
+ } catch (CoreException ex) {
+ // if we have a problem, leave the currently built JPA projects in
+ // place and keep executing (should be OK...)
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ private void buildJpaProjects_() throws CoreException {
+ this.getWorkspace().getRoot().accept(new ResourceProxyVisitor(), IResource.NONE);
+ }
+
+ /**
+ * Internal: called by {@link JptJpaCorePlugin Dali plug-in}.
+ */
+ void stop() throws Exception {
+ try {
+ this.lock.acquire();
+ this.stop_();
+ } finally {
+ this.lock.release();
+ }
+ }
+
+ private void stop_() {
+ debug("*** JPA project manager STOP ***"); //$NON-NLS-1$
+ JavaCore.removeElementChangedListener(this.javaElementChangeListener);
+ FacetedProjectFramework.removeListener(this.facetedProjectListener);
+ this.getWorkspace().removeResourceChangeListener(this.resourceChangeListener);
+ this.eventHandler.stop();
+ this.clearJpaProjects();
+ }
+
+ private void clearJpaProjects() {
+ // clone to prevent concurrent modification exceptions
+ for (JpaProject jpaProject : this.getJpaProjects_()) {
+ this.removeJpaProject(jpaProject);
+ }
+ }
+
+
+ // ********** JpaProjectManager implementation **********
+
+ public Iterable<JpaProject> getJpaProjects() {
+ try {
+ this.lock.acquire();
+ return this.getJpaProjects_();
+ } finally {
+ this.lock.release();
+ }
+ }
+
+ private Iterable<JpaProject> getJpaProjects_() {
+ return new LiveCloneIterable<JpaProject>(this.jpaProjects);
+ }
+
+ public int getJpaProjectsSize() {
+ return this.jpaProjects.size();
+ }
+
+ public JpaProject getJpaProject(IProject project) {
+ try {
+ this.lock.acquire();
+ return this.getJpaProject_(project);
+ } finally {
+ this.lock.release();
+ }
+ }
+
+ private JpaProject getJpaProject_(IProject project) {
+ for (JpaProject jpaProject : this.jpaProjects) {
+ if (jpaProject.getProject().equals(project)) {
+ return jpaProject;
+ }
+ }
+ return null;
+ }
+
+ public JpaFile getJpaFile(IFile file) {
+ JpaProject jpaProject = this.getJpaProject(file.getProject());
+ return (jpaProject == null) ? null : jpaProject.getJpaFile(file);
+ }
+
+ public void rebuildJpaProject(IProject project) {
+ try {
+ this.lock.acquire();
+ this.rebuildJpaProject_(project);
+ } finally {
+ this.lock.release();
+ }
+ }
+
+ /**
+ * assumption: the JPA project holder exists
+ */
+ private void rebuildJpaProject_(IProject project) {
+ this.removeJpaProject(this.getJpaProject_(project));
+ this.addJpaProject(project);
+ }
+
+ public boolean javaElementChangeListenerIsActive() {
+ return this.javaElementChangeListener.isActive();
+ }
+
+ public void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive) {
+ this.javaElementChangeListener.setActive(javaElementChangeListenerIsActive);
+ }
+
+ public IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ public IJobManager getJobManager() {
+ return Job.getJobManager();
+ }
+
+
+ // ********** adding/removing JPA projects **********
+
+ /* CU private */ void addJpaProject(IProject project) {
+ this.addJpaProject(this.buildJpaProject(project));
+ }
+
+ private void addJpaProject(JpaProject jpaProject) {
+ // figure out exactly when JPA projects are added
+ dumpStackTrace("add: ", jpaProject); //$NON-NLS-1$
+ // the JPA project will be null if we have any problems building it...
+ // (e.g. if we have problems getting the JPA platform)
+ if (jpaProject != null) {
+ this.addItemToCollection(jpaProject, this.jpaProjects, JPA_PROJECTS_COLLECTION);
+ }
+ }
+
+ /**
+ * return null if we have any problems...
+ */
+ private JpaProject buildJpaProject(IProject project) {
+ return this.buildJpaProject(this.buildJpaProjectConfig(project));
+ }
+
+ /**
+ * return null if we have any problems...
+ */
+ private JpaProject buildJpaProject(JpaProject.Config config) {
+ JpaPlatform jpaPlatform = config.getJpaPlatform();
+ if (jpaPlatform == null) {
+ return null;
+ }
+ JpaProject jpaProject = this.buildJpaProject(jpaPlatform, config);
+ if (jpaProject == null) {
+ return null;
+ }
+ jpaProject.setContextModelSynchronizer(this.buildJobContextModelSynchronizer(jpaProject));
+ jpaProject.setUpdateSynchronizer(this.buildJobUpdateSynchronizer(jpaProject));
+ return jpaProject;
+ }
+
+ /**
+ * return null if we have any problems...
+ */
+ private JpaProject buildJpaProject(JpaPlatform jpaPlatform, JpaProject.Config config) {
+ try {
+ return jpaPlatform.getJpaFactory().buildJpaProject(config);
+ } catch (RuntimeException ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ private JpaProject.Config buildJpaProjectConfig(IProject project) {
+ SimpleJpaProjectConfig config = new SimpleJpaProjectConfig();
+ config.setProject(project);
+ config.setJpaPlatform(JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(project));
+ config.setConnectionProfileName(JptJpaCorePlugin.getConnectionProfileName(project));
+ config.setUserOverrideDefaultCatalog(JptJpaCorePlugin.getUserOverrideDefaultCatalog(project));
+ config.setUserOverrideDefaultSchema(JptJpaCorePlugin.getUserOverrideDefaultSchema(project));
+ config.setDiscoverAnnotatedClasses(JptJpaCorePlugin.discoverAnnotatedClasses(project));
+ config.setMetamodelSourceFolderName(JptJpaCorePlugin.getMetamodelSourceFolderName(project));
+ return config;
+ }
+
+ private Synchronizer buildJobContextModelSynchronizer(JpaProject jpaProject) {
+ return new JobSynchronizer(
+ this.buildContextModelJobName(jpaProject),
+ this.buildContextModelJobCommand(jpaProject),
+ jpaProject.getProject()
+ );
+ }
+
+ private String buildContextModelJobName(JpaProject jpaProject) {
+ return NLS.bind(JptCoreMessages.CONTEXT_MODEL_SYNC_JOB_NAME, jpaProject.getName());
+ }
+
+ private JobCommand buildContextModelJobCommand(final JpaProject jpaProject) {
+ return new JobCommand() {
+ public IStatus execute(IProgressMonitor monitor) {
+ return jpaProject.synchronizeContextModel(monitor);
+ }
+ };
+ }
+
+ private CallbackSynchronizer buildJobUpdateSynchronizer(JpaProject jpaProject) {
+ return new CallbackJobSynchronizer(
+ this.buildUpdateJobName(jpaProject),
+ this.buildUpdateJobCommand(jpaProject),
+ jpaProject.getProject()
+ );
+ }
+
+ private String buildUpdateJobName(JpaProject jpaProject) {
+ return NLS.bind(JptCoreMessages.UPDATE_JOB_NAME, jpaProject.getName());
+ }
+
+ private JobCommand buildUpdateJobCommand(final JpaProject jpaProject) {
+ return new JobCommand() {
+ public IStatus execute(IProgressMonitor monitor) {
+ return jpaProject.update(monitor);
+ }
+ };
+ }
+
+ /* CU private */ void removeJpaProject(JpaProject jpaProject) {
+ // figure out exactly when JPA projects are removed
+ dumpStackTrace("remove: ", jpaProject); //$NON-NLS-1$
+ this.removeItemFromCollection(jpaProject, this.jpaProjects, JPA_PROJECTS_COLLECTION);
+ jpaProject.dispose();
+ }
+
+
+ // ********** Project POST_CHANGE **********
+
+ /* CU private */ void projectChanged(IResourceDelta delta) {
+ this.eventHandler.execute(this.buildProjectChangedCommand(delta));
+ }
+
+ private Command buildProjectChangedCommand(final IResourceDelta delta) {
+ return new EventHandlerCommand("Project POST_CHANGE Command") { //$NON-NLS-1$
+ @Override
+ void execute_() {
+ GenericJpaProjectManager.this.projectChanged_(delta);
+ }
+ };
+ }
+
+ /**
+ * Forward the specified resource delta to all our JPA projects;
+ * they will each determine whether the event is significant.
+ */
+ /* CU private */ void projectChanged_(IResourceDelta delta) {
+ for (JpaProject jpaProject : this.jpaProjects) {
+ jpaProject.projectChanged(delta);
+ }
+ }
+
+
+ // ********** Project POST_BUILD (CLEAN_BUILD) **********
+
+ /* CU private */ void projectPostCleanBuild(IProject project) {
+ this.executeAfterEventsHandled(this.buildProjectPostCleanBuildCommand(project));
+ }
+
+ private Command buildProjectPostCleanBuildCommand(final IProject project) {
+ return new EventHandlerCommand("Project POST_BUILD (CLEAN_BUILD) Command") { //$NON-NLS-1$
+ @Override
+ void execute_() {
+ GenericJpaProjectManager.this.projectPostCleanBuild_(project);
+ }
+ };
+ }
+
+ /* CU private */ void projectPostCleanBuild_(IProject project) {
+ JpaProject jpaProject = this.getJpaProject_(project);
+ if (jpaProject != null) {
+ this.removeJpaProject(jpaProject);
+ this.addJpaProject(project);
+ }
+ }
+
+
+ // ********** File POST_CHANGE **********
+
+ /**
+ * The Faceted Project settings file has changed in some fashion, check
+ * whether the JPA facet has been added to or removed from the specified
+ * project.
+ */
+ /* CU private */ void checkForJpaFacetTransition(IProject project) {
+ JpaProject jpaProject = this.getJpaProject_(project);
+
+ if (JpaFacet.isInstalled(project)) {
+ if (jpaProject == null) { // JPA facet added
+ this.executeAfterEventsHandled(this.buildAddJpaProjectCommand(project));
+ }
+ } else {
+ if (jpaProject != null) { // JPA facet removed
+ this.executeAfterEventsHandled(this.buildRemoveJpaProjectCommand(jpaProject));
+ }
+ }
+ }
+
+ private Command buildAddJpaProjectCommand(final IProject project) {
+ return new EventHandlerCommand("Add JPA Project Command") { //$NON-NLS-1$
+ @Override
+ void execute_() {
+ GenericJpaProjectManager.this.addJpaProject(project);
+ }
+ };
+ }
+
+ private Command buildRemoveJpaProjectCommand(final JpaProject jpaProject) {
+ return new EventHandlerCommand("Remove JPA Project Command") { //$NON-NLS-1$
+ @Override
+ void execute_() {
+ GenericJpaProjectManager.this.removeJpaProject(jpaProject);
+ }
+ };
+ }
+
+
+ // ********** FacetedProject PRE_UNINSTALL **********
+
+ /* CU private */ void jpaFacetedProjectPreUninstall(IProjectFacetActionEvent event) {
+ IProject project = event.getProject().getProject();
+ this.executeAfterEventsHandled(this.buildJpaFacetedProjectPreUninstallCommand(project));
+ }
+
+ private Command buildJpaFacetedProjectPreUninstallCommand(final IProject project) {
+ return new EventHandlerCommand("Faceted Project PRE_UNINSTALL Command") { //$NON-NLS-1$
+ @Override
+ void execute_() {
+ GenericJpaProjectManager.this.jpaFacetedProjectPreUninstall_(project);
+ }
+ };
+ }
+
+ /* CU private */ void jpaFacetedProjectPreUninstall_(IProject project) {
+ // assume(?) this is the first event to indicate we need to remove the JPA project from the JPA project manager
+ this.removeJpaProject(this.getJpaProject_(project));
+ }
+
+
+ // ********** Java element changed **********
+
+ /* CU private */ void javaElementChanged(ElementChangedEvent event) {
+ this.eventHandler.execute(this.buildJavaElementChangedCommand(event));
+ }
+
+ private Command buildJavaElementChangedCommand(final ElementChangedEvent event) {
+ return new EventHandlerCommand("Java element changed Command") { //$NON-NLS-1$
+ @Override
+ void execute_() {
+ GenericJpaProjectManager.this.javaElementChanged_(event);
+ }
+ };
+ }
+
+ /**
+ * Forward the Java element changed event to all the JPA projects
+ * because the event could affect multiple projects.
+ */
+ /* CU private */ void javaElementChanged_(ElementChangedEvent event) {
+ for (JpaProject jpaProject : this.jpaProjects) {
+ jpaProject.javaElementChanged(event);
+ }
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.jpaProjects);
+ }
+
+
+ // ********** event handler **********
+
+ /**
+ * If the event handler is executing asynchronously:<br>
+ * Allow all the commands currently on the command executor's queue to execute.
+ * Once they have executed, suspend the command executor and process the
+ * specified command (on <em>this</em> thread, <em>not</em> the command
+ * executor thread). Once the specified command is finished, allow the
+ * command executor to resume processing its command queue.
+ * <p>
+ * If the event handler is executing synchronously:<br>
+ * All the events have already been handled synchronously, so we simply
+ * execute the specified command [sorta] directly.
+ */
+ private void executeAfterEventsHandled(Command command) {
+ SynchronizedBoolean flag = new SynchronizedBoolean(false);
+ this.eventHandler.execute(new PauseCommand(flag));
+ try {
+ flag.waitUntilTrue();
+ } catch (InterruptedException ex) {
+ // ignore - not sure why this thread would be interrupted
+ }
+ try {
+ command.execute();
+ } finally {
+ flag.setFalse();
+ }
+ }
+
+ /**
+ * If this "pause" command is executing (asynchronously) on a different
+ * thread than the JPA project manager:<ol>
+ * <li>it will set the flag to <code>true</code>, allowing the JPA project
+ * manager to resume executing on its own thread
+ * <li>then it will suspend its command executor until the JPA project
+ * manager sets the flag back to <code>false</code>.
+ * </ol>
+ * If this "pause" command is executing (synchronously) on the same thread
+ * as the JPA project manager, it will simply set the flag to
+ * <code>true</code> and return.
+ */
+ private static class PauseCommand
+ implements Command
+ {
+ private final Thread producerThread;
+ private final SynchronizedBoolean flag;
+
+ PauseCommand(SynchronizedBoolean flag) {
+ this(Thread.currentThread(), flag);
+ }
+
+ PauseCommand(Thread producerThread, SynchronizedBoolean flag) {
+ super();
+ this.producerThread = producerThread;
+ this.flag = flag;
+ }
+
+ public void execute() {
+ this.flag.setTrue();
+ if (Thread.currentThread() != this.producerThread) {
+ try {
+ this.flag.waitUntilFalse();
+ } catch (InterruptedException ex) {
+ // ignore - the command executor will check for interruptions
+ }
+ }
+ }
+ }
+
+ /**
+ * This method is called (via reflection) when the test plug-in is loaded.
+ * See JptCoreTestsPlugin#start(BundleContext)
+ */
+ @SuppressWarnings("unused")
+ private void handleEventsSynchronously() {
+ try {
+ this.lock.acquire();
+ this.handleEventsSynchronously_();
+ } finally {
+ this.lock.release();
+ }
+ }
+
+ private void handleEventsSynchronously_() {
+ this.eventHandler.stop();
+ this.eventHandler = new SimpleCommandExecutor();
+ this.eventHandler.start();
+ }
+
+
+ // ********** resource proxy visitor **********
+
+ /**
+ * Visit the workspace resource tree, adding a JPA project to the
+ * JPA project manager for each open Eclipse project that has a JPA facet.
+ */
+ private class ResourceProxyVisitor
+ implements IResourceProxyVisitor
+ {
+ ResourceProxyVisitor() {
+ super();
+ }
+
+ public boolean visit(IResourceProxy resourceProxy) {
+ switch (resourceProxy.getType()) {
+ case IResource.ROOT :
+ return true; // all projects are in the "root"
+ case IResource.PROJECT :
+ this.processProject(resourceProxy);
+ return false; // no nested projects
+ case IResource.FOLDER :
+ return false; // ignore
+ case IResource.FILE :
+ return false; // ignore
+ default :
+ return false;
+ }
+ }
+
+ private void processProject(IResourceProxy resourceProxy) {
+ if (resourceProxy.isAccessible()) { // the project exists and is open
+ IProject project = (IProject) resourceProxy.requestResource();
+ if (JpaFacet.isInstalled(project)) {
+ GenericJpaProjectManager.this.addJpaProject(project);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+
+ // ********** event handler command **********
+
+ /**
+ * Command that holds the JPA project manager lock while
+ * executing.
+ */
+ private abstract class EventHandlerCommand
+ implements Command
+ {
+ private final String name;
+
+ EventHandlerCommand(String name) {
+ super();
+ this.name = name;
+ }
+
+ public final void execute() {
+ try {
+ GenericJpaProjectManager.this.lock.acquire();
+ this.execute_();
+ } catch (RuntimeException ex) {
+ JptJpaCorePlugin.log(ex);
+ } finally {
+ GenericJpaProjectManager.this.lock.release();
+ }
+ }
+
+ abstract void execute_();
+
+ @Override
+ public String toString() {
+ return this.name;
+ }
+ }
+
+
+ // ********** resource change listener **********
+
+ private class ResourceChangeListener
+ implements IResourceChangeListener
+ {
+ ResourceChangeListener() {
+ super();
+ }
+
+ /**
+ * PRE_UNINSTALL is the only facet event we use for
+ * removing JPA projects. These are the cases where we listen for resource events.
+ * <p>
+ * Check for:<ul>
+ * <li>facet settings file added/removed/changed
+ * (<code>/.settings/org.eclipse.wst.common.project.facet.core.xml</code>)
+ * <li>file add/remove - forwarded to the individual JPA projects
+ * <li>project clean
+ * </ul>
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ switch (event.getType()) {
+ case IResourceChangeEvent.POST_CHANGE :
+ this.processPostChangeEvent(event);
+ break;
+
+ // workspace or project events
+ case IResourceChangeEvent.PRE_REFRESH :
+ break; // ignore
+ case IResourceChangeEvent.PRE_BUILD :
+ break; // ignore
+ case IResourceChangeEvent.POST_BUILD :
+ this.processPostBuildEvent(event);
+ break;
+
+ // project-only events
+ case IResourceChangeEvent.PRE_CLOSE :
+ break; // ignore
+ case IResourceChangeEvent.PRE_DELETE :
+ break; // ignore
+ default :
+ break;
+ }
+ }
+
+ private void processPostChangeEvent(IResourceChangeEvent event) {
+ debug("Resource POST_CHANGE"); //$NON-NLS-1$
+ this.processPostChangeDelta(event.getDelta());
+ }
+
+ private void processPostChangeDelta(IResourceDelta delta) {
+ IResource resource = delta.getResource();
+ switch (resource.getType()) {
+ case IResource.ROOT :
+ this.processPostChangeRootDelta(delta);
+ break;
+ case IResource.PROJECT :
+ this.processPostChangeProjectDelta(delta);
+ break;
+ case IResource.FOLDER :
+ this.processPostChangeFolderDelta((IFolder) resource, delta);
+ break;
+ case IResource.FILE :
+ this.processPostChangeFileDelta((IFile) resource, delta);
+ break;
+ default :
+ break;
+ }
+ }
+
+ // ***** POST_CHANGE ROOT
+ private void processPostChangeRootDelta(IResourceDelta delta) {
+ this.processPostChangeDeltaChildren(delta);
+ }
+
+ // ***** POST_CHANGE PROJECT
+ /**
+ * Process the project first for the Opening project case.
+ * The JPA project will not be built until the children are processed
+ * and we see that the facet metadata file is added.
+ * Otherwise the JPA project would be built and then we would process
+ * the ADDED deltas for all the files in the project.
+ */
+ private void processPostChangeProjectDelta(IResourceDelta delta) {
+ GenericJpaProjectManager.this.projectChanged(delta);
+ this.processPostChangeDeltaChildren(delta);
+ }
+
+ // ***** POST_CHANGE FOLDER
+ private void processPostChangeFolderDelta(IFolder folder, IResourceDelta delta) {
+ if (folder.getName().equals(".settings")) { //$NON-NLS-1$
+ this.processPostChangeDeltaChildren(delta);
+ }
+ }
+
+ // ***** POST_CHANGE FILE
+ private void processPostChangeFileDelta(IFile file, IResourceDelta delta) {
+ if (file.getName().equals(FACETED_PROJECT_FRAMEWORK_SETTINGS_FILE_NAME)) {
+ this.checkForFacetFileChanges(file, delta);
+ }
+ }
+
+ private void checkForFacetFileChanges(IFile file, IResourceDelta delta) {
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED :
+ case IResourceDelta.REMOVED :
+ case IResourceDelta.CHANGED :
+ GenericJpaProjectManager.this.checkForJpaFacetTransition(file.getProject());
+ break;
+ case IResourceDelta.ADDED_PHANTOM :
+ break; // ignore
+ case IResourceDelta.REMOVED_PHANTOM :
+ break; // ignore
+ default :
+ break;
+ }
+ }
+
+ private void processPostChangeDeltaChildren(IResourceDelta delta) {
+ for (IResourceDelta child : delta.getAffectedChildren()) {
+ this.processPostChangeDelta(child); // recurse
+ }
+ }
+
+ /**
+ * A post build event has occurred.
+ * Check for whether the build was a "clean" build and trigger project update.
+ */
+ // ***** POST_BUILD
+ private void processPostBuildEvent(IResourceChangeEvent event) {
+ debug("Resource POST_BUILD: ", event.getResource()); //$NON-NLS-1$
+ if (event.getBuildKind() == IncrementalProjectBuilder.CLEAN_BUILD) {
+ this.processPostCleanBuildDelta(event.getDelta());
+ }
+ }
+
+ private void processPostCleanBuildDelta(IResourceDelta delta) {
+ IResource resource = delta.getResource();
+ switch (resource.getType()) {
+ case IResource.ROOT :
+ this.processPostCleanBuildDeltaChildren(delta);
+ break;
+ case IResource.PROJECT :
+ this.processProjectPostCleanBuild((IProject) resource);
+ break;
+ case IResource.FOLDER :
+ break; // ignore
+ case IResource.FILE :
+ break; // ignore
+ default :
+ break;
+ }
+ }
+
+ private void processPostCleanBuildDeltaChildren(IResourceDelta delta) {
+ for (IResourceDelta child : delta.getAffectedChildren()) {
+ this.processPostCleanBuildDelta(child); // recurse
+ }
+ }
+
+ private void processProjectPostCleanBuild(IProject project) {
+ debug("\tProject CLEAN: ", project.getName()); //$NON-NLS-1$
+ GenericJpaProjectManager.this.projectPostCleanBuild(project);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+
+ // ********** faceted project listener **********
+
+ /**
+ * Forward the Faceted project change event back to the JPA project manager.
+ */
+ private class FacetedProjectListener
+ implements IFacetedProjectListener
+ {
+ FacetedProjectListener() {
+ super();
+ }
+
+ /**
+ * Check for:<ul>
+ * <li>un-install of JPA facet
+ * </ul>
+ */
+ public void handleEvent(IFacetedProjectEvent event) {
+ switch (event.getType()) {
+ case PRE_UNINSTALL :
+ this.processPreUninstallEvent((IProjectFacetActionEvent) event);
+ break;
+ default :
+ break;
+ }
+ }
+
+ private void processPreUninstallEvent(IProjectFacetActionEvent event) {
+ debug("Facet PRE_UNINSTALL: ", event.getProjectFacet()); //$NON-NLS-1$
+ if (event.getProjectFacet().equals(JpaFacet.FACET)) {
+ GenericJpaProjectManager.this.jpaFacetedProjectPreUninstall(event);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+
+ // ********** Java element change listener **********
+
+ /**
+ * Forward the Java element change event back to the JPA project manager.
+ */
+ private class JavaElementChangeListener
+ implements IElementChangedListener
+ {
+ /**
+ * A flag to activate/deactivate the listener
+ * so we can ignore Java events whenever Dali is manipulating the Java
+ * source code via the Dali model. We do this because the 0.5 sec delay
+ * between the Java source being changed and the corresponding event
+ * being fired causes us no end of pain.
+ */
+ private volatile boolean active = true;
+
+ JavaElementChangeListener() {
+ super();
+ }
+
+ public void elementChanged(ElementChangedEvent event) {
+ if (this.active) {
+ GenericJpaProjectManager.this.javaElementChanged(event);
+ }
+ // TODO save unhandled events and process when listener is reactivated?
+ }
+
+ void setActive(boolean active) {
+ this.active = active;
+ }
+
+ boolean isActive() {
+ return this.active;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+
+ // ********** DEBUG **********
+
+ // @see JpaProjectManagerTests#testDEBUG()
+ private static final boolean DEBUG = false;
+
+ /**
+ * trigger #toString() call and string concatenation only if DEBUG is true
+ */
+ /* CU private */ static void debug(String message, Object object) {
+ if (DEBUG) {
+ debug_(message + object);
+ }
+ }
+
+ /* CU private */ static void debug(String message) {
+ if (DEBUG) {
+ debug_(message);
+ }
+ }
+
+ private static void debug_(String message) {
+ System.out.println(Thread.currentThread().getName() + ": " + message); //$NON-NLS-1$
+ }
+
+ /* CU private */ static void dumpStackTrace() {
+ dumpStackTrace(null);
+ }
+
+ /* CU private */ static void dumpStackTrace(String message, Object object) {
+ if (DEBUG) {
+ dumpStackTrace_(message + object);
+ }
+ }
+
+ /* CU private */ static void dumpStackTrace(String message) {
+ if (DEBUG) {
+ dumpStackTrace_(message);
+ }
+ }
+
+ private static void dumpStackTrace_(String message) {
+ // lock System.out so the stack elements are printed out contiguously
+ synchronized (System.out) {
+ if (message != null) {
+ debug_(message);
+ }
+ StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
+ // skip the first 3 elements - those are this method and 2 methods in Thread
+ for (int i = 3; i < stackTrace.length; i++) {
+ StackTraceElement element = stackTrace[i];
+ if (element.getMethodName().equals("invoke0")) { //$NON-NLS-1$
+ break; // skip all elements outside of the JUnit test
+ }
+ System.out.println("\t" + element); //$NON-NLS-1$
+ }
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java
new file mode 100644
index 0000000000..c49f656fec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+
+/**
+ * Provides annotation definitions for types and attributes.
+ * {@link JpaAnnotationProvider}
+ * then uses a collection of these to build annotations.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.2
+ */
+public interface JpaAnnotationDefinitionProvider
+{
+ /**
+ * Return all annotation definitions which can appear on a type
+ */
+ Iterable<AnnotationDefinition> getTypeAnnotationDefinitions();
+
+ /**
+ * Return all annotation definitions which can appear on a type and are used to determine
+ * whether and how the type is persisted (how it is "mapped").
+ * This should be a subset of {@link #getTypeAnnotationDefinitions()}.
+ */
+ Iterable<AnnotationDefinition> getTypeMappingAnnotationDefinitions();
+
+ /**
+ * Return all annotation definitions which can appear on an attribute
+ */
+ Iterable<AnnotationDefinition> getAttributeAnnotationDefinitions();
+
+ /**
+ * Return all annotation definitions which can appear on a package.
+ */
+ Iterable<AnnotationDefinition> getPackageAnnotationDefinitions();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java
new file mode 100644
index 0000000000..4802b5d1e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * This is used to provide type and attribute annotations.
+ * Also provides list of supported annotation names, check the appropriate list
+ * before trying to build an annotation with that name. An exception will
+ * be thrown on an attempt to build an annotation that does not exist.
+ *
+ * This interface is not intended to be implemented. Instead implement
+ * JpaAnnotationDefinitionProvider to extend the list of supported annotation definitions.
+ *
+ * @see JpaAnnotationDefinitionProvider
+ * @version 3.0
+ * @since 2.0?
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JpaAnnotationProvider
+{
+ // ********** type annotations **********
+
+ /**
+ * Return the names of the annotations that can appear on a type.
+ */
+ Iterator<String> typeAnnotationNames();
+
+ /**
+ * Return the names of the annotations that can appear on a type and are used to
+ * determine whether and how the type is persisted (how it is "mapped").
+ * This should be a subset of {@link #typeAnnotationNames()}.
+ */
+ Iterator<String> typeMappingAnnotationNames();
+
+ /**
+ * Build a type annotation with the specified name.
+ * Throw an IllegalArgumentException if the specified name is unsupported.
+ * @see #typeAnnotationNames()
+ */
+ Annotation buildTypeAnnotation(
+ JavaResourcePersistentType parent, Type type, String annotationName);
+
+ /**
+ * Build a type annotation for the specified JDT annotation.
+ * Throw an IllegalArgumentException if the specified annotation is unsupported.
+ * @see #typeAnnotationNames()
+ */
+ Annotation buildTypeAnnotation(
+ JavaResourcePersistentType parent, IAnnotation jdtAnnotation);
+
+ /**
+ * Build a null type annotation with the specified name.
+ * Throw an IllegalArgumentException if the specified annotation is unsupported.
+ * @see #typeAnnotationNames()
+ */
+ Annotation buildNullTypeAnnotation(
+ JavaResourcePersistentType parent, String annotationName);
+
+
+ // ********** attribute annotations **********
+
+ /**
+ * Return the names of the annotations that can appear on an attribute.
+ */
+ Iterator<String> attributeAnnotationNames();
+
+ /**
+ * Build an attribute annotation with the specified name.
+ * Throw an IllegalArgumentException if the specified name is unsupported.
+ * @see #attributeAnnotationNames()
+ */
+ Annotation buildAttributeAnnotation(
+ JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName);
+
+ /**
+ * Build an attribute annotation for the specified JDT annotation.
+ * Throw an IllegalArgumentException if the specified annotation is unsupported.
+ * @see #attributeAnnotationNames()
+ */
+ Annotation buildAttributeAnnotation(
+ JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation);
+
+ /**
+ * Build a null attribute annotation with the specified name.
+ * Throw an IllegalArgumentException if the specified annotation is unsupported.
+ * @see #attributeAnnotationNames()
+ */
+ Annotation buildNullAttributeAnnotation(
+ JavaResourcePersistentAttribute parent, String annotationName);
+
+
+ // ********** package annotations **********
+
+ /**
+ * Return the names of the annotations that can appear on a package.
+ */
+ Iterator<String> packageAnnotationNames();
+
+ /**
+ * Build an package annotation with the specified name.
+ * Throw an IllegalArgumentException if the specified name is unsupported.
+ * @see #packageAnnotationNames()
+ */
+ Annotation buildPackageAnnotation(
+ JavaResourcePackage parent, AnnotatedPackage pack, String annotationName);
+
+ /**
+ * Build a package annotation for the specified JDT annotation.
+ * Throw an IllegalArgumentException if the specified name is unsupported.
+ * @see #packageAnnotationNames()
+ */
+ Annotation buildPackageAnnotation(
+ JavaResourcePackage parent, IAnnotation jdtAnnotation);
+
+ /**
+ * Build a null package annotation with the specified name.
+ * Throw an IllegalArgumentException if the specified annotation is unsupported.
+ * @see #packageAnnotationNames()
+ */
+ Annotation buildNullPackageAnnotation(
+ JavaResourcePackage parent, String annotationName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java
new file mode 100644
index 0000000000..77a241b96f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.jpt.jpa.db.ConnectionProfile;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.DatabaseObject;
+
+/**
+ * Interface to the connection profile.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JpaDataSource
+ extends JpaNode {
+
+ /**
+ * Return the data source's connection profile name.
+ * The connection profile is looked up based on this setting.
+ */
+ String getConnectionProfileName();
+
+ /**
+ * 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.common.utility.model.Model#addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener)
+ */
+ String CONNECTION_PROFILE_NAME_PROPERTY = "connectionProfileName"; //$NON-NLS-1$
+
+ /**
+ * The connection profile is null if the connection profile name is invalid.
+ */
+ ConnectionProfile getConnectionProfile();
+
+ /**
+ * ID string used when connectionProfile property is changed
+ * @see org.eclipse.jpt.common.utility.model.Model#addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener)
+ */
+ String CONNECTION_PROFILE_PROPERTY = "connectionProfile"; //$NON-NLS-1$
+
+ /**
+ * Return whether the profile is either connected to a live database
+ * session or working off-line (i.e. it has access to meta-data).
+ */
+ boolean connectionProfileIsActive();
+
+ /**
+ * If the connection profile is active, return its database.
+ */
+ Database getDatabase();
+
+ /**
+ * Select and return the database object with the specified identifier.
+ */
+ <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(Iterable<T> databaseObjects, String identifier);
+
+ /**
+ * Dispose the data source.
+ */
+ void dispose();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java
new file mode 100644
index 0000000000..609cb4c1a5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public final class JpaFacet {
+
+ public static final String ID = "jpt.jpa"; //$NON-NLS-1$
+
+ public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID);
+
+ public static final IProjectFacetVersion VERSION_1_0 = FACET.getVersion("1.0"); //$NON-NLS-1$
+
+ public static final IProjectFacetVersion VERSION_2_0 = FACET.getVersion("2.0"); //$NON-NLS-1$
+
+
+ public static boolean isInstalled(final IProject project) {
+ try {
+ return FacetedProjectFramework.hasProjectFacet(project, ID);
+ }
+ catch (CoreException e) {
+ JptJpaCorePlugin.log(e);
+ return false;
+ }
+ }
+
+
+ /**
+ * Not for instantiation
+ */
+ private JpaFacet() {}
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
new file mode 100644
index 0000000000..b4238bb037
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * Use a JPA factory to build any core (e.g. {@link JpaProject})
+ * model object or any Java (e.g. {@link JavaEntity}), ORM (e.g.
+ * {@link EntityMappings}), or persistence (e.g. {@link PersistenceUnit})
+ * context model objects.
+ * <p>
+ * Assumes a base JPA project context structure
+ * corresponding to the JPA spec:
+ * <pre>
+ * RootContext
+ * |- 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)
+ * </pre>
+ * ... and associated objects.
+ *<p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFactory
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JpaFactory
+{
+ // ********** Core Model **********
+
+ /**
+ * Construct a JpaProject 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).
+ */
+ JpaProject buildJpaProject(JpaProject.Config config);
+
+ JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName);
+
+ /**
+ * Construct a JPA file for the specified JPA project, file, content type,
+ * and resource model.
+ */
+ JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel);
+
+
+ // ********** Context Nodes **********
+
+ /**
+ * Build a (/an updated) root context node to be associated with the given
+ * JPA project.
+ * The root context node will be built once, but updated many times.
+ * @see JpaProject#update(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ JpaRootContextNode buildRootContextNode(JpaProject jpaProject);
+
+
+ // ********** XML Context Model **********
+
+ PersistenceXml buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource);
+
+ MappingFile buildMappingFile(MappingFileRef parent, JpaXmlResource resource);
+
+
+ // ********** Java Context Model **********
+
+ JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt);
+
+ JavaEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation);
+
+ JavaMappedSuperclass buildJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappedSuperclassAnnotation);
+
+ JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation);
+
+ JavaTypeMapping buildJavaNullTypeMapping(JavaPersistentType parent);
+
+ JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa);
+
+ JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent);
+
+ JavaEmbeddedIdMapping buildJavaEmbeddedIdMapping(JavaPersistentAttribute parent);
+
+ JavaEmbeddedMapping buildJavaEmbeddedMapping(JavaPersistentAttribute parent);
+
+ JavaIdMapping buildJavaIdMapping(JavaPersistentAttribute parent);
+
+ JavaManyToManyMapping buildJavaManyToManyMapping(JavaPersistentAttribute parent);
+
+ JavaManyToOneMapping buildJavaManyToOneMapping(JavaPersistentAttribute parent);
+
+ JavaOneToManyMapping buildJavaOneToManyMapping(JavaPersistentAttribute parent);
+
+ JavaOneToOneMapping buildJavaOneToOneMapping(JavaPersistentAttribute parent);
+
+ JavaTransientMapping buildJavaTransientMapping(JavaPersistentAttribute parent);
+
+ JavaVersionMapping buildJavaVersionMapping(JavaPersistentAttribute parent);
+
+ JavaAttributeMapping buildJavaNullAttributeMapping(JavaPersistentAttribute parent);
+
+ JavaGeneratorContainer buildJavaGeneratorContainer(JavaJpaContextNode parent, JavaGeneratorContainer.Owner owner);
+
+ JavaTable buildJavaTable(JavaEntity parent, Table.Owner owner);
+
+ JavaJoinTable buildJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Table.Owner owner);
+
+ JavaVirtualJoinTable buildJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable);
+
+ JavaColumn buildJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner);
+
+ JavaVirtualColumn buildJavaVirtualColumn(JavaJpaContextNode parent, JavaVirtualColumn.Owner owner);
+
+ JavaDiscriminatorColumn buildJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner);
+
+ JavaJoinColumn buildJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner, JoinColumnAnnotation joinColumnAnnotation);
+
+ JavaVirtualJoinColumn buildJavaVirtualJoinColumn(JavaJpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn);
+
+ JavaSecondaryTable buildJavaSecondaryTable(JavaEntity parent, Table.Owner owner, SecondaryTableAnnotation tableAnnotation);
+
+ JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation sequenceGeneratorAnnotation);
+
+ JavaTableGenerator buildJavaTableGenerator(JavaJpaContextNode parent, TableGeneratorAnnotation tableGeneratorAnnotation);
+
+ JavaGeneratedValue buildJavaGeneratedValue(JavaIdMapping parent, GeneratedValueAnnotation generatedValueAnnotation);
+
+ JavaPrimaryKeyJoinColumn buildJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation);
+
+ JavaAttributeOverrideContainer buildJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner);
+
+ JavaAttributeOverride buildJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverrideAnnotation annotation);
+
+ JavaVirtualAttributeOverride buildJavaVirtualAttributeOverride(JavaAttributeOverrideContainer parent, String name);
+
+ JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaJpaContextNode parent, JavaAssociationOverrideContainer.Owner owner);
+
+ JavaAssociationOverride buildJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverrideAnnotation annotation);
+
+ JavaVirtualAssociationOverride buildJavaVirtualAssociationOverride(JavaAssociationOverrideContainer parent, String name);
+
+ JavaOverrideRelationship buildJavaOverrideRelationship(JavaAssociationOverride parent);
+
+ JavaVirtualOverrideRelationship buildJavaVirtualOverrideRelationship(JavaVirtualAssociationOverride parent);
+
+ JavaQueryContainer buildJavaQueryContainer(JavaJpaContextNode parent, JavaQueryContainer.Owner owner);
+
+ JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation namedQueryAnnotation);
+
+ JavaNamedNativeQuery buildJavaNamedNativeQuery(JavaJpaContextNode parent, NamedNativeQueryAnnotation namedNativeQueryAnnotation);
+
+ JavaQueryHint buildJavaQueryHint(JavaQuery parent, QueryHintAnnotation queryHintAnnotation);
+
+ JavaUniqueConstraint buildJavaUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint.Owner owner, UniqueConstraintAnnotation constraintAnnotation);
+
+ JavaVirtualUniqueConstraint buildJavaVirtualUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint uniqueConstraint);
+
+ JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation);
+
+ JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation);
+
+ JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation);
+
+ JavaOrderable buildJavaOrderable(JavaAttributeMapping parent);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java
new file mode 100644
index 0000000000..848cde5b3a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import java.util.Iterator;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceModel;
+
+/**
+ * A JPA Project contains JPA files for all files in the project that
+ * are relevant to the JPA spec.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JpaFile
+ extends JpaNode
+{
+ /**
+ * Return the JPA file's Eclipse file.
+ */
+ IFile getFile();
+
+ /**
+ * Return the JPA file's content type.
+ */
+ IContentType getContentType();
+
+ /**
+ * Return the resource model corresponding to the JPA file; typically a JPA
+ * compilation unit, a JPA XML resource, or a JPA package fragment root (JAR).
+ */
+ JptResourceModel getResourceModel();
+
+ /**
+ * Convenience method. Return the resource model corresponding to the JPA
+ * file if the file's content is a "kind-of" the specified content type;
+ * otherwise, return null. This is useful when a client has looked up the
+ * JPA file via a file name [and assumed content type].
+ * @see #getResourceModel()
+ */
+ JptResourceModel getResourceModel(IContentType contentType);
+
+
+ // ********** root structure nodes **********
+
+ /**
+ * Return the JPA file's root structure nodes.
+ */
+ Iterator<JpaStructureNode> rootStructureNodes();
+ String ROOT_STRUCTURE_NODES_COLLECTION = "rootStructureNodes"; //$NON-NLS-1$
+
+ /**
+ * Return the count of the JPA file's root context model objects.
+ */
+ int rootStructureNodesSize();
+
+ /**
+ * Add a root structure node.
+ * There is the potential for multiple root structure nodes
+ * for a particular key. For example, a Java type can be listed
+ * both as a {@code <class>} in the <code>persistence.xml</code> file
+ * and as an {@code <entity>} in
+ * an <code>orm.xml</code> file. In this case, the Jave type in
+ * the <code>orm.xml</code> file must set
+ * the root structure node <em>after</em> the Java type in the
+ * <code>persistence.xml</code> file.
+ * Last one in during project <em>update</em> wins.
+ */
+ void addRootStructureNode(Object key, JpaStructureNode rootStructureNode);
+
+ /**
+ * Remove the root structure node for the specified key if its current value
+ * is the same as the specified node.
+ *
+ * @see #addRootStructureNode(Object, JpaStructureNode)
+ */
+ void removeRootStructureNode(Object key, JpaStructureNode rootStructureNode);
+
+ /**
+ * Return the structure node best corresponding to the location in the file.
+ */
+ JpaStructureNode getStructureNode(int textOffset);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java
new file mode 100644
index 0000000000..b1e0e5dfbc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jpt.common.core.IResourcePart;
+import org.eclipse.jpt.common.utility.model.Model;
+
+/**
+ * JPA-specific protocol. All JPA objects belong to a JPA project, are
+ * associated with a resource, and have a parent (excepting the JPA project).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface JpaNode
+ extends Model, IAdaptable, IResourcePart
+{
+ /**
+ * Return the JPA project the node belongs to.
+ */
+ JpaProject getJpaProject();
+
+ /**
+ * Return the JPA node's parent. The JPA project will not have a parent.
+ */
+ JpaNode getParent();
+
+ /**
+ * Some state or child (or grandchild etc.) of the JPA node changed.
+ * Fire a state change event. Implied by this behavior is that any change
+ * to any JPA node in a JPA project will trigger the JPA project to fire a
+ * state change event.
+ *
+ * @see Model#addStateChangeListener(org.eclipse.jpt.common.utility.model.listener.StateChangeListener)
+ * @see org.eclipse.jpt.common.utility.model.event.StateChangeEvent
+ * @see org.eclipse.jpt.common.utility.model.listener.StateChangeListener
+ */
+ void stateChanged();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
new file mode 100644
index 0000000000..d3cec2c329
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
+
+/**
+ * This interface is to be implemented by a JPA vendor to provide extensions to
+ * the core JPA model. The core JPA model will provide functionality for JPA
+ * spec annotations in Java, <code>persistence.xml</code> and mapping
+ * (<code>orm.xml</code>) files.
+ * The <code>org.eclipse.jpt.jpa.core.generic</code> extension supplies
+ * 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. In the extension point you actually provide a
+ * {@link JpaPlatformFactory} that will build the JPA platform.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <p>
+ * See the <code>org.eclipse.jpt.jpa.core.jpaPlatforms</code> extension point.
+ * @see JpaPlatformFactory
+ * @see JpaPlatformProvider
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface JpaPlatform
+{
+ // ********** meta stuff **********
+
+ /**
+ * Get the ID for this platform
+ */
+ String getId();
+
+ /**
+ * Return the description for this platform
+ */
+ JpaPlatformDescription getDescription();
+
+ /**
+ * Get the version object for this platform.
+ */
+ Version getJpaVersion();
+
+
+ // ********** factory **********
+
+ /**
+ * Return a factory responsible for creating core (e.g. JpaProject), resource
+ * (e.g. PersistenceResource), and context (e.g. PersistenceUnit) model
+ * objects
+ */
+ JpaFactory getJpaFactory();
+
+
+ // ********** JPA files **********
+
+ /**
+ * Return a JPA file corresponding to the specified Eclipse file.
+ * Return null if the file's content is unsupported.
+ */
+ JpaFile buildJpaFile(JpaProject jpaProject, IFile file);
+
+
+ // ********** Java annotations **********
+
+ /**
+ * Return an annotation provider responsible for determining what Java
+ * annotations are supported and constructing java resource model objects.
+ */
+ JpaAnnotationProvider getAnnotationProvider();
+
+ /**
+ * Return a formatter that can clean up the Java annotations added to source
+ * code.
+ */
+ AnnotationEditFormatter getAnnotationEditFormatter();
+
+
+ // ********** Java type mappings **********
+
+ /**
+ * Return the Java type mapping definitions that will be used to build Java
+ * type mappings and their corresponding annotations.
+ */
+ Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions();
+
+
+ // ********** Java attribute mappings **********
+
+ /**
+ * Return the Java attribute mapping definitions that will be used to build
+ * Java attribute mappings and their corresponding annotations.
+ */
+ Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions();
+
+ /**
+ * Return the Java attribute mapping definitions that will be used to build
+ * default Java attribute mappings.
+ */
+ Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions();
+
+
+ // ********** resource types and definitions **********
+
+ /**
+ * Return true if the resource type is supported. The result of this call is consistent with
+ * the result of {@link #getResourceDefinition(JptResourceType)}
+ */
+ boolean supportsResourceType(JptResourceType resourceType);
+
+ /**
+ * Return a {@link ResourceDefinition} to describe the context model for a file of the given
+ * resource type.
+ * Throw an {@link IllegalArgumentException} if the resource type is not supported by the platform.
+ *
+ * @param resourceType The resource type of a potential resource definition
+ * @return The resource definition that can be used for such a file
+ */
+ ResourceDefinition getResourceDefinition(JptResourceType resourceType);
+
+ /**
+ * Return the most recent supported {@link JptResourceType} for the given content type.
+ * Throw an {@link IllegalArgumentException} if the content type is not supported by the platform.
+ *
+ * @param contentType A content type supported by the platform
+ * @return The most recent resource type supported by the platform
+ */
+ JptResourceType getMostRecentSupportedResourceType(IContentType contentType);
+
+
+ // ********** database **********
+
+ /**
+ * Return a connection repository that can be used to query the database
+ * about database metadata.
+ */
+ ConnectionProfileFactory getConnectionProfileFactory();
+
+ /**
+ * Return an entity generator database annotation name builder, which is
+ * used by Entity Generation to determine whether and how the entity generator
+ * prints the names of various database objects.
+ */
+ EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder();
+
+
+ // ********** platform variation **********
+
+ /**
+ * Return a platform variation that is used to determine differences platforms and/or JPA specification versions
+ */
+ JpaPlatformVariation getJpaVariation();
+
+
+ interface Version {
+
+ /**
+ * Return the platform's version.
+ */
+ String getVersion();
+
+ /**
+ * Return the highest JPA specification version supported by the platform.
+ * @see JpaFacet#VERSION_1_0
+ * @see JpaFacet#VERSION_2_0
+ */
+ String getJpaVersion();
+
+ /**
+ * Return whether the platform is compatible with the specified JPA
+ * specification version.
+ * @see JpaFacet#VERSION_1_0
+ * @see JpaFacet#VERSION_2_0
+ */
+ boolean isCompatibleWithJpaVersion(String jpaVersion);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java
new file mode 100644
index 0000000000..c3bb9dd128
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+/**
+ * This interface is to be implemented by a JPA vendor to build a
+ * {@link JpaPlatform}.
+ * <p>
+ * See the <code>org.eclipse.jpt.jpa.core.jpaPlatforms</code> extension point.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JpaPlatformFactory {
+ /**
+ * Build the JPA platform with the specified ID.
+ */
+ JpaPlatform buildJpaPlatform(String id);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java
new file mode 100644
index 0000000000..a511eda3b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+
+/**
+ * This interface is to be implemented by a JPA vendor to provide extensions to
+ * the core JPA model. The core JPA model will provide functionality for JPA
+ * spec annotations in java, persistence.xml and mapping (orm.xml) files.
+ * The org.eclipse.jpt.jpa.core.generic extension supplies
+ * resource models for those file types in GenericJpaPlatformProvider.
+ *
+ * This JpaPlatformProvider implementation most likely only returns providers
+ * that are extensions of other platforms. Then in the GenericJpaPlatform implementation
+ * you pass in 1 or more JpaPlatformProviders.
+ *
+ * See the org.eclipse.jpt.jpa.core.jpaPlatforms extension point
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JpaPlatformProvider
+{
+ /**
+ * Return the most recent resource type for the given content type supported by this platform
+ */
+ JptResourceType getMostRecentSupportedResourceType(IContentType contentType);
+
+ /**
+ * Return the resource model providers that apply to this platform.
+ */
+ Iterable<JpaResourceModelProvider> getResourceModelProviders();
+
+ /**
+ * Return the resource definitions supported by this platform.
+ */
+ Iterable<ResourceDefinition> getResourceDefinitions();
+
+ /**
+ * Return the platform's Java type mapping definitions.
+ */
+ Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions();
+
+ /**
+ * Return the platform's default Java attribute mapping definitions.
+ */
+ Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions();
+
+ /**
+ * Return the platform's specified Java attribute mapping definitions.
+ */
+ Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java
new file mode 100644
index 0000000000..156628e336
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+/**
+ * A JpaPlatform contains a JpaPlatformVariation. This is used for various jpa spec
+ * items that are either optional or only supported by certain version of the spec.
+ * Each platform implementation must determine if it supports these things.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JpaPlatformVariation
+{
+ /**
+ * Return whether table-per-concrete-class is a supported
+ * inheritance strategy in the JPA platform.
+ * Supported.MAYBE means that it is in the JPA spec, but not portable
+ * or might not be supported by a particular provider.
+ * @return
+ */
+ Supported getTablePerConcreteClassInheritanceIsSupported();
+
+ /**
+ * This is used to determine if a relationship mapping that uses a join table
+ * can be overridden with an association override.
+ */
+ boolean isJoinTableOverridable();
+
+
+ public enum Supported {
+ /**
+ * fully supported by the platform
+ */
+ YES,
+
+ /**
+ * not supported by the platform
+ */
+ NO,
+
+ /**
+ * in the JPA spec, might not supported be supported by a particular provider
+ */
+ MAYBE,
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
new file mode 100644
index 0000000000..ba7a6e5c57
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
@@ -0,0 +1,549 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import java.util.Iterator;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.IPath;
+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.jpt.common.utility.CommandExecutor;
+import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer;
+import org.eclipse.jpt.common.utility.synchronizers.Synchronizer;
+import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.ConnectionProfile;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * A JPA project is associated with an Eclipse project (and its corresponding
+ * Java project). It holds the <em>resource</em> model that corresponds to the
+ * various JPA-related resources (the <code>persistence.xml</code> file, its
+ * mapping files [<code>orm.xml</code>], and the Java source files). It also
+ * holds the <em>context</em> model that represents
+ * the JPA metadata, as derived from spec-defined defaults, Java source code
+ * annotations, and XML descriptors.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface JpaProject
+ extends JpaNode
+{
+
+ // ********** general **********
+
+ /**
+ * Return the JPA project's name, which is the same as the associated
+ * Eclipse project's name.
+ */
+ String getName();
+
+ /**
+ * Return the Eclipse project associated with the JPA project.
+ */
+ IProject getProject();
+
+ /**
+ * Return the Java project associated with the JPA project.
+ */
+ IJavaProject getJavaProject();
+
+ /**
+ * Return the vendor-specific JPA platform that builds the JPA project
+ * and its contents.
+ */
+ JpaPlatform getJpaPlatform();
+
+ /**
+ * Return the root of the JPA project's context model.
+ */
+ JpaRootContextNode getRootContextNode();
+
+ /**
+ * The JPA project has been removed from the JPA model. Clean up any
+ * hooks to external resources etc.
+ */
+ void dispose();
+
+
+ // ********** JPA files **********
+
+ /**
+ * ID string used when the JPA project's collection of JPA files changes.
+ * @see #addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener)
+ */
+ String JPA_FILES_COLLECTION = "jpaFiles"; //$NON-NLS-1$
+
+ /**
+ * Return the JPA project's JPA files.
+ */
+ Iterator<JpaFile> jpaFiles();
+
+ /**
+ * Return the size of the JPA project's JPA files.
+ */
+ int jpaFilesSize();
+
+ /**
+ * Return the JPA file corresponding to the specified file.
+ * Return null if there is no JPA file associated with the specified file.
+ */
+ JpaFile getJpaFile(IFile file);
+
+
+ // ********** external Java resource compilation units **********
+
+ /**
+ * ID string used when the JPA project's collection of external Java
+ * resource compilation units changes.
+ * @see #addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener)
+ */
+ String EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION = "externalJavaResourceCompilationUnits"; //$NON-NLS-1$
+
+ /**
+ * Return the JPA project's external Java resource compilation units.
+ */
+ Iterator<JavaResourceCompilationUnit> externalJavaResourceCompilationUnits();
+
+ /**
+ * Return the size of the JPA project's external Java resource compilation units.
+ */
+ int externalJavaResourceCompilationUnitsSize();
+
+
+ // ********** external Java resource persistent types **********
+
+ /**
+ * Return the JPA project's external Java resource persistent type cache.
+ */
+ JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache();
+
+
+ // ********** XML resources **********
+
+ /**
+ * Return the XML resource model corresponding to the file with runtime path
+ * <code>META-INF/persistence.xml</code> if that file has the persistence content type
+ * (<code>"org.eclipse.jpt.jpa.core.content.persistence"</code>).
+ *
+ * @see JptJpaCorePlugin#DEFAULT_PERSISTENCE_XML_RUNTIME_PATH
+ * @see JptJpaCorePlugin#PERSISTENCE_XML_CONTENT_TYPE
+ */
+ JpaXmlResource getPersistenceXmlResource();
+
+ /**
+ * Return the XML resource model corresponding to the file with the specified
+ * runtime path if that file has the mapping file content type
+ * (<code>"org.eclipse.jpt.jpa.core.content.mappingFile"</code>)
+ *
+ * @see JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE
+ */
+ JpaXmlResource getMappingFileXmlResource(IPath runtimePath);
+
+ /**
+ * Return the XML resource model corresponding to the file
+ * <code>META-INF/orm.xml</code> if that file has the mapping file content type.
+ *
+ * @see JptJpaCorePlugin#DEFAULT_ORM_XML_RUNTIME_PATH
+ */
+ JpaXmlResource getDefaultOrmXmlResource();
+
+
+ // ********** Java resources **********
+
+ /**
+ * Return the names of the JPA project's annotated Java classes
+ * (ignoring classes in JARs referenced in the <code>persistence.xml</code>).
+ */
+ Iterator<String> annotatedJavaSourceClassNames();
+
+ /**
+ * Return only the names of those valid <em>mapped</em> (i.e. annotated with
+ * <code>@Entity</code>, <code>@Embeddable</code>, etc.) Java resource
+ * persistent types that are directly part of the JPA project, ignoring
+ * those in JARs referenced in <code>persistence.xml</code>.
+ */
+ Iterable<String> getMappedJavaSourceClassNames();
+
+ /**
+ * Return the Java resource persistent type for the specified type.
+ * Return null if invalid or absent.
+ */
+ JavaResourcePersistentType getJavaResourcePersistentType(String typeName);
+
+ /**
+ * Return the Java resource package for the specified package.
+ * Return null if invalid or absent.
+ */
+ JavaResourcePackage getJavaResourcePackage(String packageName);
+
+ /**
+ * Return the Java resource packages for the project.
+ * Return null if invalid or absent.
+ */
+ Iterable<JavaResourcePackage> getJavaResourcePackages();
+
+ /**
+ * Return the Java resource package fragement root for the specified JAR.
+ * Return null if absent.
+ */
+ JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(String jarFileName);
+
+ /**
+ * Return the JPA project's JPA files for jars.
+ */
+ Iterable<JpaFile> getJarJpaFiles();
+
+
+ // ********** external events **********
+
+ /**
+ * Synchronize the JPA project with the specified project resource
+ * delta, watching for added and removed files in particular.
+ */
+ void projectChanged(IResourceDelta delta);
+
+ /**
+ * Synchronize the JPA project with the specified Java change.
+ */
+ void javaElementChanged(ElementChangedEvent event);
+
+
+ // ********** synchronize context model with resource model **********
+
+ /**
+ * Return the synchronizer that will synchronize the context model with
+ * the resource model whenever the resource model changes.
+ */
+ Synchronizer getContextModelSynchronizer();
+
+ /**
+ * Set the synchronizer that will keep the context model synchronized with
+ * the resource model whenever the resource model changes.
+ * Before setting the synchronizer, clients should save the current
+ * synchronizer so it can be restored later.
+ *
+ * @see #getContextModelSynchronizer()
+ */
+ void setContextModelSynchronizer(Synchronizer synchronizer);
+
+ /**
+ * The JPA project's resource model has changed; synchronize the JPA
+ * project's context model with it. This method is typically called when the
+ * resource model state has changed when it is synchronized with its
+ * underlying Eclipse resource as the result of an Eclipse resource change
+ * event. This method can also be called when a client (e.g. a JUnit test
+ * case) has manipulated the resource model via its API (as opposed to
+ * modifying the underlying Eclipse resource directly) and needs the context
+ * model to be synchronized accordingly (since manipulating the resource
+ * model via its API will not trigger this method). Whether the context
+ * model is synchronously (or asynchronously) depends on the current context
+ * model synchronizer.
+ *
+ * @see #synchronizeContextModelAndWait()
+ */
+ void synchronizeContextModel();
+
+ /**
+ * Force the JPA project's context model to synchronize with it resource
+ * model <em>synchronously</em>.
+ *
+ * @see #synchronizeContextModel()
+ * @see #updateAndWait()
+ */
+ void synchronizeContextModelAndWait();
+
+ /**
+ * This is the callback used by the context model synchronizer to perform
+ * the actual "synchronize".
+ */
+ IStatus synchronizeContextModel(IProgressMonitor monitor);
+
+
+ // ********** project "update" **********
+
+ /**
+ * Return the synchronizer that will update the context model whenever
+ * it has any changes. This allows any intra-JPA project dependencies to
+ * be updated.
+ */
+ CallbackSynchronizer getUpdateSynchronizer();
+
+ /**
+ * Set the synchronizer that will update the context model whenever
+ * it has any changes. This allows any intra-JPA project dependencies to
+ * be updated.
+ * Before setting the update synchronizer, clients should save the current
+ * synchronizer so it can be restored later.
+ *
+ * @see #getUpdateSynchronizer()
+ */
+ void setUpdateSynchronizer(CallbackSynchronizer synchronizer);
+
+ /**
+ * Force the JPA project to "update" <em>synchronously</em>.
+ *
+ * @see #synchronizeContextModelAndWait()
+ */
+ void updateAndWait();
+
+ /**
+ * This is the callback used by the update synchronizer to perform the
+ * actual "update".
+ */
+ IStatus update(IProgressMonitor monitor);
+
+
+ // ********** utility **********
+
+ /**
+ * Return an {@link IFile} that best represents the given runtime location
+ */
+ IFile getPlatformFile(IPath runtimePath);
+
+
+ // ********** validation **********
+
+ /**
+ * Return JPA project's validation messages.
+ */
+ Iterator<IMessage> validationMessages(IReporter reporter);
+
+
+ // ********** database **********
+
+ /**
+ * Return the data source the JPA project is mapped to.
+ */
+ JpaDataSource getDataSource();
+
+ /**
+ * Return the JPA project's connection.
+ * The connection profile is null if the JPA project's connection profile
+ * name does not match the name of a DTP connection profile.
+ */
+ ConnectionProfile getConnectionProfile();
+
+ /**
+ * Return the JPA project's default database schema container;
+ * which is either the JPA project's default catalog or the JPA project's
+ * database, depending on how the DTP model is implemented.
+ */
+ SchemaContainer getDefaultDbSchemaContainer();
+
+ /**
+ * Return the JPA project's default catalog; which is either the user
+ * override catalog or the database's default catalog.
+ */
+ String getDefaultCatalog();
+
+ /**
+ * Return the JPA project's default database catalog.
+ * @see #getDefaultCatalog()
+ */
+ Catalog getDefaultDbCatalog();
+
+ /**
+ * Return the JPA project's default schema; which can be one of the
+ * following:<ul>
+ * <li>the user override schema
+ * <li>the default catalog's default schema
+ * <li>the database's default schema (if catalogs are not supported)
+ * </ul>
+ */
+ String getDefaultSchema();
+
+ /**
+ * Return the JPA project's default database schema.
+ * @see #getDefaultSchema()
+ * @see #getDefaultDbSchemaContainer()
+ */
+ Schema getDefaultDbSchema();
+
+
+ // ********** user override default catalog **********
+
+ /**
+ * ID string used when the JPA project's user override default catalog changes.
+ * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener)
+ */
+ String USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY = "userOverrideDefaultCatalog"; //$NON-NLS-1$
+
+ /**
+ * Return the <em>identifier</em> of the catalog to be used as a default
+ * for the JPA project instead of the one that is associated by default
+ * with the connection profile.
+ * @return The catalog identifier. May be null (implying the connection profile
+ * default catalog should be used).
+ */
+ String getUserOverrideDefaultCatalog();
+
+ /**
+ * Set the <em>identifier</em> of the catalog to be used as a default
+ * for the JPA project instead of the one that is associated by default
+ * with the connection profile.
+ * @parameter catalog The catalog identifier. May be null (implying the connection profile
+ * default catalog should be used).
+ */
+ void setUserOverrideDefaultCatalog(String catalog);
+
+
+ // ********** user override default schema **********
+
+ /**
+ * ID string used when the JPA project's user override default schema changes.
+ * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener)
+ */
+ String USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY = "userOverrideDefaultSchema"; //$NON-NLS-1$
+
+ /**
+ * Return the <em>identifier</em> of the schema to be used as a default
+ * for the JPA project instead of the one that is associated by default
+ * with the connection profile.
+ * @return The schema identifier. May be null (implying the connection profile
+ * default schema should be used).
+ */
+ String getUserOverrideDefaultSchema();
+
+ /**
+ * Set the <em>identifier</em> of the schema to be used as a default
+ * for the JPA project instead of the one that is associated by default
+ * with the connection profile.
+ * @parameter schema The schema identifier. May be null (implying the connection profile
+ * default schema should be used).
+ */
+ void setUserOverrideDefaultSchema(String schema);
+
+
+ // ********** discover annotated classes **********
+
+ /**
+ * ID string used when discoversAnnotatedClasses property is changed.
+ * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener)
+ */
+ String DISCOVERS_ANNOTATED_CLASSES_PROPERTY = "discoversAnnotatedClasses"; //$NON-NLS-1$
+
+ /**
+ * Return whether the JPA project will not generate error messages for any
+ * annotated classes that are not listed in the <code>persistence.xml</code>
+ * file or one of its mapping files. If this flag is set to
+ * <code>false</code>, error messages will be generated for all of the
+ * annotated classes that are not explicitly listed. The JPA project
+ * <em>always</em> "discovers" annotated classes and allows the user to
+ * reference them throughout the model; this flag simply controls whether
+ * the error messages are generated during validation.
+ * <p>
+ * This is a user-specified preference that is probably
+ * only helpful when deploying to a JavaSE environment. The JPA spec
+ * says annotated classes are to be discovered automatically in a JavaEE
+ * environment; while the managed persistence classes must be explicitly
+ * listed in a JavaSE environment: "A list of all named managed persistence
+ * classes must be specified in Java SE environments to insure portability".
+ * This flag allows Dali to behave consistently with the user's JPA
+ * implementation, which may allow "discovery" in a JavaSE environment
+ * (e.g. EclipseLink). This setting can also be used when the user wants
+ * to explicitly list classes, even when the classes are "discovered"
+ * by the JPA implementation.
+ */
+ boolean discoversAnnotatedClasses();
+
+ /**
+ * Set whether the JPA project will not generate error messages for any
+ * annotated classes that are not listed in the <code>persistence.xml</code>
+ * file or one of its mapping files.
+ * @see #discoversAnnotatedClasses()
+ */
+ void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses);
+
+
+ // ********** modifying shared documents **********
+
+ /**
+ * Set a thread-specific implementation of the {@link CommandExecutor}
+ * interface that will be used to execute a command to modify a shared
+ * document. If necessary, the command executor can be cleared by
+ * setting it to <code>null</code>.
+ * This allows background clients to modify documents that are
+ * already present in the UI. See implementations of {@link CommandExecutor}.
+ */
+ void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor);
+
+ /**
+ * Return the project-wide implementation of the
+ * {@link CommandExecutor} interface.
+ */
+ CommandExecutor getModifySharedDocumentCommandExecutor();
+
+
+ // ********** construction config **********
+
+ /**
+ * The settings used to construct a JPA project.
+ */
+ interface Config
+ {
+ /**
+ * Return the Eclipse project to be associated with the new JPA project.
+ */
+ IProject getProject();
+
+ /**
+ * Return the JPA platform to be associated with the new JPA project.
+ */
+ JpaPlatform getJpaPlatform();
+
+ /**
+ * Return the name of the connection profile to be associated
+ * with the new JPA project. (This connection profile wraps a DTP
+ * connection profile.)
+ */
+ String getConnectionProfileName();
+
+ /**
+ * Return the catalog to use instead of the connection profile's
+ * default catalog.
+ * May be null.
+ */
+ String getUserOverrideDefaultCatalog();
+
+ /**
+ * Return the name of the schema to use instead of the default schema
+ * of the connection profile.
+ * May be null.
+ */
+ String getUserOverrideDefaultSchema();
+
+ /**
+ * Return whether the new JPA project is to "discover" annotated
+ * classes.
+ */
+ boolean discoverAnnotatedClasses();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java
new file mode 100644
index 0000000000..2601919a09
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.common.utility.model.Model;
+
+/**
+ * The JPA project manager holds all the JPA projects in the workspace.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JpaProjectManager
+ extends Model
+{
+ /**
+ * Return the JPA model's JPA projects.
+ */
+ Iterable<JpaProject> getJpaProjects();
+ public static final String JPA_PROJECTS_COLLECTION = "jpaProjects"; //$NON-NLS-1$
+
+ /**
+ * Return the size of the JPA model's list of JPA projects.
+ */
+ int getJpaProjectsSize();
+
+ /**
+ * Return the JPA project corresponding to the specified Eclipse project.
+ * Return <code>null</code> if unable to associate the specified Eclipse
+ * project with a JPA project.
+ */
+ JpaProject getJpaProject(IProject project);
+
+ /**
+ * Return the JPA file corresponding to the specified Eclipse file,
+ * or <code>null</code> if unable to associate the specified file with a
+ * JPA file.
+ */
+ JpaFile getJpaFile(IFile file);
+
+ /**
+ * The JPA settings associated with the specified Eclipse project
+ * have changed in such a way as to require the associated
+ * JPA project to be completely rebuilt
+ * (e.g. when the user changes a project's JPA platform).
+ */
+ void rebuildJpaProject(IProject project);
+
+ /**
+ * Return whether the model's Java change listener is active.
+ */
+ boolean javaElementChangeListenerIsActive();
+
+ /**
+ * Set whether the model's Java change listener is active.
+ */
+ void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java
new file mode 100644
index 0000000000..0b434b8c6d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceModel;
+
+/**
+ * Map a content type to a JPA resource model.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JpaResourceModelProvider
+{
+ /**
+ * Return the file content type the provider is for.
+ */
+ IContentType getContentType();
+
+ /**
+ * Build a JPA resource model for the specified JPA project and file.
+ * Use the specified factory for creation so extenders can simply override
+ * the appropriate creation method instead of building a provider for the
+ * same content.
+ */
+ JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java
new file mode 100644
index 0000000000..c94dbd0088
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+
+/**
+ * Implement this interface for objects that appear in the Structure view
+ * This is used by JpaSelection to determine selection in the editor.
+ * Details pages are also provided for each JpaStructureNode.
+ *
+ * I did not implement JpaContextNode and I'm not even sure we should implement
+ * JpaNode. It is possibly someone could want a structure node that is
+ * not actually a contextNode in the model.//TODO
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JpaStructureNode
+ extends JpaNode
+{
+ /**
+ * Return the structure node at the given offset.
+ */
+ JpaStructureNode getStructureNode(int textOffset);
+
+ /**
+ * Return the text range to be used to select text in the editor
+ * corresponding to this node.
+ */
+ TextRange getSelectionTextRange();
+
+ /**
+ * Return a unique identifier for all of this class of structure nodes
+ */
+ String getId();
+
+ /**
+ * Return the content type of the structure node's resource.
+ * This is used to find the appropriate ui provider for building composites
+ */
+ JptResourceType getResourceType();
+
+ /**
+ * Dispose of this structureNode and dispose of child structureNodes.
+ * Typically this would be used to update the JpaFile rootStructureNodes.
+ */
+ void dispose();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java
new file mode 100644
index 0000000000..36c3dbf976
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java
@@ -0,0 +1,774 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import javax.xml.parsers.SAXParserFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.platform.JpaPlatformManagerImpl;
+import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferenceInitializer;
+import org.eclipse.jpt.jpa.core.platform.GenericPlatform;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * The Dali core plug-in lifecycle implementation.
+ * A number of globally-available constants and methods.
+ * <p>
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public class JptJpaCorePlugin
+ extends Plugin
+{
+ private volatile GenericJpaProjectManager jpaProjectManager;
+ private volatile ServiceTracker<?, SAXParserFactory> parserTracker;
+ private static volatile boolean flushPreferences = true;
+
+
+ // ********** public constants **********
+
+ /**
+ * The plug-in identifier of the persistence support
+ * (value <code>"org.eclipse.jpt.jpa.core"</code>).
+ */
+ public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.core"; //$NON-NLS-1$
+ public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
+
+ /**
+ * The key for storing a JPA project's platform ID in the Eclipse
+ * project's preferences.
+ */
+ private static final String JPA_PLATFORM_PREF_KEY = PLUGIN_ID_ + "platform"; //$NON-NLS-1$
+
+ /**
+ * The old key for storing the default JPA platform ID in the workspace preferences.
+ * @deprecated As of version 2.3. Instead use {@link #DEFAULT_JPA_PLATFORM_1_0_PREF_KEY} or
+ * {@link #DEFAULT_JPA_PLATFORM_2_0_PREF_KEY}
+ */
+ @Deprecated
+ public static final String DEFAULT_JPA_PLATFORM_PREF_KEY = "defaultJpaPlatform"; //$NON-NLS-1$
+
+ /**
+ * The key for storing the default JPA platform ID for JPA 1.0 in the workspace preferences.
+ */
+ public static final String DEFAULT_JPA_PLATFORM_1_0_PREF_KEY =
+ DEFAULT_JPA_PLATFORM_PREF_KEY + "_" + JpaFacet.VERSION_1_0.getVersionString(); //$NON-NLS-1$
+
+ /**
+ * The key for storing the default JPA platform ID for JPA 2.0 in the workspace preferences.
+ */
+ public static final String DEFAULT_JPA_PLATFORM_2_0_PREF_KEY =
+ DEFAULT_JPA_PLATFORM_PREF_KEY + "_" + JpaFacet.VERSION_2_0.getVersionString(); //$NON-NLS-1$
+
+ /**
+ * The key for storing a JPA project's "discover" flag in the Eclipse
+ * project's preferences.
+ */
+ public static final String DISCOVER_ANNOTATED_CLASSES = PLUGIN_ID_ + "discoverAnnotatedClasses"; //$NON-NLS-1$
+
+ /**
+ * The key for storing the name of a JPA project's metamodel source folder
+ * in the Eclipse project's preferences.
+ */
+ public static final String METAMODEL_SOURCE_FOLDER_NAME = PLUGIN_ID_ + "metamodelSourceFolderName"; //$NON-NLS-1$
+
+ /**
+ * The key for storing a JPA project's data source connection profile name
+ * in the Eclipse project's persistent properties.
+ */
+ public static final QualifiedName DATA_SOURCE_CONNECTION_PROFILE_NAME =
+ new QualifiedName(PLUGIN_ID, "dataSource.connectionProfileName"); //$NON-NLS-1$
+
+ /**
+ * The key for storing a JPA project's user overridden default catalog name
+ * in the Eclipse project's persistent properties.
+ */
+ public static final QualifiedName USER_OVERRIDE_DEFAULT_CATALOG =
+ new QualifiedName(PLUGIN_ID, "userOverrideDefaultCatalogName"); //$NON-NLS-1$
+
+ /**
+ * The key for storing a JPA project's user overridden default schema name
+ * in the Eclipse project's persistent properties.
+ */
+ public static final QualifiedName USER_OVERRIDE_DEFAULT_SCHEMA =
+ new QualifiedName(PLUGIN_ID, "userOverrideDefaultSchemaName"); //$NON-NLS-1$
+
+
+ /**
+ * The identifier for the JPA validation marker
+ * (value <code>"org.eclipse.jpt.jpa.core.jpaProblemMarker"</code>).
+ */
+ public static final String VALIDATION_MARKER_ID = PLUGIN_ID + ".jpaProblemMarker"; //$NON-NLS-1$
+
+ /**
+ * The identifier for the JPA validator
+ * (value <code>"org.eclipse.jpt.jpa.core.jpaValidator"</code>).
+ */
+ public static final String VALIDATOR_ID = PLUGIN_ID_ + "jpaValidator"; //$NON-NLS-1$
+
+ /**
+ * The content type for <code>persistence.xml</code> files.
+ */
+ public static final IContentType PERSISTENCE_XML_CONTENT_TYPE = getJpaContentType("persistence"); //$NON-NLS-1$
+
+ /**
+ * The resource type for <code>persistence.xml</code> version 1.0 files
+ */
+ public static final JptResourceType PERSISTENCE_XML_1_0_RESOURCE_TYPE =
+ new JptResourceType(PERSISTENCE_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.persistence.JPA.SCHEMA_VERSION);
+
+ /**
+ * The resource type for <code>persistence.xml</code> version 2.0 files
+ */
+ public static final JptResourceType PERSISTENCE_XML_2_0_RESOURCE_TYPE =
+ new JptResourceType(PERSISTENCE_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0.SCHEMA_VERSION);
+
+ /**
+ * The base content type for all mapping files.
+ */
+ public static final IContentType MAPPING_FILE_CONTENT_TYPE = getJpaContentType("mappingFile"); //$NON-NLS-1$
+
+ /**
+ * The content type for <code>orm.xml</code> mapping files.
+ */
+ public static final IContentType ORM_XML_CONTENT_TYPE = getJpaContentType("orm"); //$NON-NLS-1$
+
+ /**
+ * The resource type for <code>orm.xml</code> version 1.0 mapping files
+ */
+ public static final JptResourceType ORM_XML_1_0_RESOURCE_TYPE =
+ new JptResourceType(ORM_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.orm.JPA.SCHEMA_VERSION);
+
+ /**
+ * The resource type for <code>orm.xml</code> version 2.0 mapping files
+ */
+ public static final JptResourceType ORM_XML_2_0_RESOURCE_TYPE =
+ new JptResourceType(ORM_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0.SCHEMA_VERSION);
+
+ /**
+ * Web projects have some special exceptions.
+ */
+ public static final IProjectFacet WEB_FACET
+ = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE);
+
+ public static final IPath DEFAULT_PERSISTENCE_XML_RUNTIME_PATH = new Path("META-INF/persistence.xml"); //$NON-NLS-1$
+
+ public static final IPath DEFAULT_ORM_XML_RUNTIME_PATH = new Path("META-INF/orm.xml"); //$NON-NLS-1$
+
+ private static IContentType getJpaContentType(String jpaContentType) {
+ return getContentType(CONTENT_PREFIX_ + jpaContentType);
+ }
+
+ public static final String CONTENT_PREFIX = PLUGIN_ID_ + "content"; //$NON-NLS-1$
+
+ public static final String CONTENT_PREFIX_ = CONTENT_PREFIX + '.';
+
+ private static IContentType getContentType(String contentType) {
+ return Platform.getContentTypeManager().getContentType(contentType);
+ }
+
+
+ // ********** singleton **********
+
+ private static JptJpaCorePlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali core plug-in.
+ */
+ public static JptJpaCorePlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** public static methods **********
+
+ /**
+ * Return the singular JPA project manager corresponding
+ * to the current workspace.
+ */
+ public static JpaProjectManager getJpaProjectManager() {
+ return INSTANCE.getJpaProjectManager_();
+ }
+
+ /**
+ * Return the JPA project corresponding to the specified Eclipse project,
+ * or <code>null</code> if unable to associate the specified project with a
+ * JPA project.
+ */
+ public static JpaProject getJpaProject(IProject project) {
+ return getJpaProjectManager().getJpaProject(project);
+ }
+
+ /**
+ * Return the JPA file corresponding to the specified Eclipse file,
+ * or <code>null</code> if unable to associate the specified file with a JPA file.
+ */
+ public static JpaFile getJpaFile(IFile file) {
+ return getJpaProjectManager().getJpaFile(file);
+ }
+
+ /**
+ * The JPA settings associated with the specified Eclipse project
+ * have changed in such a way as to require the associated
+ * JPA project to be completely rebuilt
+ * (e.g. when the user changes a project's JPA platform).
+ */
+ public static void rebuildJpaProject(IProject project) {
+ getJpaProjectManager().rebuildJpaProject(project);
+ }
+
+ /**
+ * Return whether the specified Eclipse project has a Web facet.
+ */
+ public static boolean projectHasWebFacet(IProject project) {
+ return projectHasFacet(project, WEB_FACET);
+ }
+
+ /**
+ * Checked exceptions bite.
+ */
+ private static boolean projectHasFacet(IProject project, IProjectFacet facet) {
+ try {
+ return FacetedProjectFramework.hasProjectFacet(project, facet.getId());
+ } catch (CoreException ex) {
+ log(ex); // problems reading the project metadata - assume facet doesn't exist - return 'false'
+ return false;
+ }
+ }
+
+ public static JpaFile getJpaFile(IProject project, IPath runtimePath) {
+ IFile xmlFile = JptCommonCorePlugin.getPlatformFile(project, runtimePath);
+ return xmlFile.exists() ? getJpaFile(xmlFile) : null;
+ }
+
+ /**
+ * Return the runtime path to which JARs are relatively specified for
+ * the given project.
+ * (Web projects have a different runtime structure than non-web projects.)
+ */
+ public static IPath getJarRuntimeRootPath(IProject project) {
+ return projectHasWebFacet(project) ?
+ new Path("/" + J2EEConstants.WEB_INF) //$NON-NLS-1$
+ : new Path("/"); //$NON-NLS-1$
+ }
+
+ public static void initializeDefaultPreferences() {
+ IEclipsePreferences node = getDefaultPreferences();
+
+ // default JPA platforms
+ JpaPlatformDescription defaultPlatform_1_0 =
+ JpaPlatformManagerImpl.instance().getDefaultJpaPlatform(JpaFacet.VERSION_1_0);
+ if (defaultPlatform_1_0 == null) {
+ defaultPlatform_1_0 = GenericPlatform.VERSION_1_0;
+ }
+ node.put(DEFAULT_JPA_PLATFORM_1_0_PREF_KEY, defaultPlatform_1_0.getId());
+
+ JpaPlatformDescription defaultPlatform_2_0 =
+ JpaPlatformManagerImpl.instance().getDefaultJpaPlatform(JpaFacet.VERSION_2_0);
+ if (defaultPlatform_2_0 == null) {
+ defaultPlatform_2_0 = GenericPlatform.VERSION_2_0;
+ }
+ node.put(DEFAULT_JPA_PLATFORM_2_0_PREF_KEY, defaultPlatform_2_0.getId());
+ }
+
+ /**
+ * Return the default Dali preferences
+ * @see JpaPreferenceInitializer
+ */
+ public static IEclipsePreferences getDefaultPreferences() {
+ return getPreferences(new DefaultScope());
+ }
+
+ /**
+ * Return the Dali preferences for the current workspace instance.
+ */
+ public static IEclipsePreferences getWorkspacePreferences() {
+ return getPreferences(new InstanceScope());
+ }
+
+ /**
+ * Set the workspace preference.
+ */
+ public static void setWorkspacePreference(String preferenceKey, String preferenceValue) {
+ IEclipsePreferences prefs = getWorkspacePreferences();
+ prefs.put(preferenceKey, preferenceValue);
+ flush(prefs);
+ }
+
+ /**
+ * Return the Dali preferences for the specified Eclipse project.
+ */
+ public static IEclipsePreferences getProjectPreferences(IProject project) {
+ return getPreferences(new ProjectScope(project));
+ }
+
+ /**
+ * Set the project preference
+ */
+ public static void setProjectPreference(IProject project, String preferenceKey, String preferenceValue) {
+ IEclipsePreferences prefs = getProjectPreferences(project);
+ if (preferenceValue == null) {
+ prefs.remove(preferenceKey);
+ }
+ else {
+ prefs.put(preferenceKey, preferenceValue);
+ }
+ flush(prefs);
+ }
+
+ /**
+ * Set the project preference
+ */
+ public static void setProjectPreference(IProject project, String preferenceKey, boolean preferenceValue) {
+ IEclipsePreferences prefs = getProjectPreferences(project);
+ prefs.putBoolean(preferenceKey, preferenceValue);
+ flush(prefs);
+ }
+
+ /**
+ * Clears the project of JPA-specific preferences
+ */
+ public static void clearProjectPreferences(IProject project) {
+ clearProjectPreferences(
+ project,
+ JPA_PLATFORM_PREF_KEY, DISCOVER_ANNOTATED_CLASSES, METAMODEL_SOURCE_FOLDER_NAME);
+ }
+
+ /**
+ * Clears the specified preferences
+ */
+ public static void clearProjectPreferences(IProject project, String ... preferenceKeys) {
+ IEclipsePreferences prefs = getProjectPreferences(project);
+ for (String preferenceKey : preferenceKeys) {
+ prefs.remove(preferenceKey);
+ }
+ flush(prefs);
+ }
+
+ /**
+ * Return the Dali preferences for the specified context.
+ */
+ private static IEclipsePreferences getPreferences(IScopeContext context) {
+ return context.getNode(PLUGIN_ID);
+ }
+
+ /**
+ * Return the default {@link JpaPlatformDescription} for new JPA projects with the given JPA facet version.
+ */
+ public static JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion) {
+ JpaPlatformDescription defaultPlatform =
+ getDefaultJpaPlatform(jpaFacetVersion, getWorkspacePreferences(), getDefaultPreferences());
+ if (defaultPlatform == null) {
+ // if the platform ID stored in the workspace prefs is invalid (i.e. null), look in the default prefs
+ defaultPlatform = getDefaultJpaPlatform(jpaFacetVersion, getDefaultPreferences());
+ }
+ return defaultPlatform;
+ }
+
+ private static JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion, Preferences ... nodes) {
+ JpaPlatformDescription defaultDefaultPlatform =
+ getDefaultJpaPlatform(jpaFacetVersion, DEFAULT_JPA_PLATFORM_PREF_KEY, null, nodes);
+ String preferenceKey = null;
+ if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0)) {
+ if (defaultDefaultPlatform == null) {
+ defaultDefaultPlatform = GenericPlatform.VERSION_1_0;
+ }
+ preferenceKey = DEFAULT_JPA_PLATFORM_1_0_PREF_KEY;
+ }
+ else if (jpaFacetVersion.equals(JpaFacet.VERSION_2_0)) {
+ if (defaultDefaultPlatform == null) {
+ defaultDefaultPlatform = GenericPlatform.VERSION_2_0;
+ }
+ preferenceKey = DEFAULT_JPA_PLATFORM_2_0_PREF_KEY;
+ }
+ else {
+ throw new IllegalArgumentException("Illegal JPA facet version: " + jpaFacetVersion); //$NON-NLS-1$
+ }
+ return getDefaultJpaPlatform(jpaFacetVersion, preferenceKey, defaultDefaultPlatform, nodes);
+ }
+
+ private static JpaPlatformDescription getDefaultJpaPlatform(
+ IProjectFacetVersion jpaFacetVersion, String preferenceKey, JpaPlatformDescription defaultDefault, Preferences ... nodes) {
+
+ String defaultDefaultId = (defaultDefault == null) ? null : defaultDefault.getId();
+ String defaultPlatformId = Platform.getPreferencesService().get(preferenceKey, defaultDefaultId, nodes);
+ JpaPlatformDescription defaultPlatform = getJpaPlatformManager().getJpaPlatform(defaultPlatformId);
+ if (defaultPlatform != null && defaultPlatform.supportsJpaFacetVersion(jpaFacetVersion)) {
+ return defaultPlatform;
+ }
+ else if (defaultDefault != null && defaultDefault.supportsJpaFacetVersion(jpaFacetVersion)) {
+ return defaultDefault;
+ }
+ return null;
+ }
+
+ public static JpaPlatformManager getJpaPlatformManager() {
+ return JpaPlatformManagerImpl.instance();
+ }
+
+ /**
+ * Set the default JPA platform ID for creating new JPA projects
+ */
+ public static void setDefaultJpaPlatformId(String jpaFacetVersion, String platformId) {
+ String preferenceKey = null;
+ if (JpaFacet.VERSION_1_0.getVersionString().equals(jpaFacetVersion)) {
+ preferenceKey = DEFAULT_JPA_PLATFORM_1_0_PREF_KEY;
+ }
+ else if (JpaFacet.VERSION_2_0.getVersionString().equals(jpaFacetVersion)) {
+ preferenceKey = DEFAULT_JPA_PLATFORM_2_0_PREF_KEY;
+ }
+ else {
+ throw new IllegalArgumentException("Illegal JPA facet version: " + jpaFacetVersion); //$NON-NLS-1$
+ }
+ setWorkspacePreference(preferenceKey, platformId);
+ }
+
+ /**
+ * Return the JPA platform ID associated with the specified Eclipse project.
+ */
+ public static String getJpaPlatformId(IProject project) {
+ return getProjectPreferences(project).get(JPA_PLATFORM_PREF_KEY, GenericPlatform.VERSION_1_0.getId());
+ }
+
+ /**
+ * Return the JPA platform description associated with the specified Eclipse project.
+ */
+ public static JpaPlatformDescription getJpaPlatformDescription(IProject project) {
+ String jpaPlatformId = getJpaPlatformId(project);
+ return getJpaPlatformManager().getJpaPlatform(jpaPlatformId);
+ }
+
+ /**
+ * Set the JPA platform ID associated with the specified Eclipse project.
+ */
+ public static void setJpaPlatformId(IProject project, String jpaPlatformId) {
+ setProjectPreference(project, JPA_PLATFORM_PREF_KEY, jpaPlatformId);
+ }
+
+ /**
+ * Return the preferences key used to look up an Eclipse project's
+ * JPA platform ID.
+ */
+ public static String getJpaPlatformIdPrefKey() {
+ return JPA_PLATFORM_PREF_KEY;
+ }
+
+ /**
+ * Return the JPA "discover" flag associated with the specified
+ * Eclipse project.
+ */
+ public static boolean discoverAnnotatedClasses(IProject project) {
+ return getProjectPreferences(project).getBoolean(DISCOVER_ANNOTATED_CLASSES, false);
+ }
+
+ /**
+ * Set the JPA "discover" flag associated with the specified
+ * Eclipse project.
+ */
+ public static void setDiscoverAnnotatedClasses(IProject project, boolean discoverAnnotatedClasses) {
+ setProjectPreference(project, DISCOVER_ANNOTATED_CLASSES, discoverAnnotatedClasses);
+ }
+
+ /**
+ * Return the name of the metamodel source folder associated with the
+ * specified Eclipse project.
+ */
+ public static String getMetamodelSourceFolderName(IProject project) {
+ return getProjectPreferences(project).get(METAMODEL_SOURCE_FOLDER_NAME, null);
+ }
+
+ /**
+ * Set the name of the metamodel source folder associated with the
+ * specified Eclipse project.
+ */
+ public static void setMetamodelSourceFolderName(IProject project, String metamodelSourceFolderName) {
+ setProjectPreference(project, METAMODEL_SOURCE_FOLDER_NAME, metamodelSourceFolderName);
+ }
+
+ /**
+ * This method is called (via reflection) when the test plug-in is loaded.
+ * The preferences end up getting flushed after the test case has deleted
+ * its project, resulting in resource exceptions in the log, e.g.
+ * <pre>
+ * Resource '/JpaProjectManagerTests' is not open.
+ * </pre>
+ * See <code>JptCoreTestsPlugin.start(BundleContext)</code>
+ */
+ @SuppressWarnings("unused")
+ private static void doNotFlushPreferences() {
+ flushPreferences = false;
+ }
+
+ /**
+ * Flush preferences in an asynchronous Job because the flush request will
+ * trigger a lock on the project, which can cause us some deadlocks (e.g.
+ * when deleting the metamodel source folder).
+ * Note: the flush will also remove the prefs node if it is empty
+ */
+ private static void flush(IEclipsePreferences prefs) {
+ if (flushPreferences) {
+ new PreferencesFlushJob(prefs).schedule();
+ }
+ }
+
+ private static class PreferencesFlushJob extends Job {
+ private final IEclipsePreferences prefs;
+ PreferencesFlushJob(IEclipsePreferences prefs) {
+ super(NLS.bind(JptCoreMessages.PREFERENCES_FLUSH_JOB_NAME, prefs.absolutePath()));
+ this.prefs = prefs;
+ }
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ this.prefs.flush();
+ } catch(BackingStoreException ex) {
+ log(ex);
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+ /**
+ * Return the name of the connection profile associated with the specified
+ * Eclipse project.
+ */
+ public static String getConnectionProfileName(IProject project) {
+ try {
+ String connectionProfileName = project.getPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME);
+ // some old connection profile names were stored as empty strings instead of nulls :-(
+ // convert them here
+ return (StringTools.stringIsEmpty(connectionProfileName)) ? null : connectionProfileName;
+ } catch (CoreException ex) {
+ log(ex);
+ return null;
+ }
+ }
+
+ /**
+ * Set the name of the connection profile associated with the specified
+ * Eclipse project.
+ */
+ public static void setConnectionProfileName(IProject project, String connectionProfileName) {
+ try {
+ project.setPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME, connectionProfileName);
+ } catch (CoreException ex) {
+ log(ex);
+ }
+ }
+
+ /**
+ * Return the default catalog (identifier) associated with the specified Eclipse project.
+ * @see JpaProject#getUserOverrideDefaultCatalog()
+ */
+ public static String getUserOverrideDefaultCatalog(IProject project) {
+ try {
+ return project.getPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG);
+ } catch (CoreException ex) {
+ log(ex);
+ return null;
+ }
+ }
+
+ /**
+ * Set the default catalog (identifier) associated with the specified Eclipse project.
+ * @see JpaProject#setUserOverrideDefaultCatalog(String)
+ */
+ public static void setUserOverrideDefaultCatalog(IProject project, String defaultCatalog) {
+ try {
+ project.setPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG, defaultCatalog);
+ } catch (CoreException ex) {
+ log(ex);
+ }
+ }
+
+ /**
+ * Return the default schema (identifier) associated with the specified Eclipse project.
+ * @see JpaProject#getUserOverrideDefaultSchema()
+ */
+ public static String getUserOverrideDefaultSchema(IProject project) {
+ try {
+ return project.getPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA);
+ } catch (CoreException ex) {
+ log(ex);
+ return null;
+ }
+ }
+
+ /**
+ * Set the default schema (identifier) associated with the specified Eclipse project.
+ * @see JpaProject#setUserOverrideDefaultSchema(String)
+ */
+ public static void setUserOverrideDefaultSchema(IProject project, String defaultSchema) {
+ try {
+ project.setPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA, defaultSchema);
+ } catch (CoreException ex) {
+ log(ex);
+ }
+ }
+
+ /**
+ * Clear the JPA-specific project properties
+ */
+ public static void clearProjectPersistentProperties(IProject project) {
+ try {
+ project.setPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME, null);
+ project.setPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG, null);
+ project.setPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA, null);
+ }
+ catch (CoreException ce) {
+ log(ce);
+ }
+ }
+
+ public static boolean nodeIsJpa2_0Compatible(JpaNode jpaNode) {
+ return jpaNode.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(JpaFacet.VERSION_2_0.getVersionString());
+ }
+
+ /**
+ * Return whether the JPA project manager's Java change listener is active.
+ */
+ public static boolean javaElementChangeListenerIsActive() {
+ return getJpaProjectManager().javaElementChangeListenerIsActive();
+ }
+
+ /**
+ * Set whether the JPA project manager's Java change listener is active.
+ */
+ public static void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive) {
+ getJpaProjectManager().setJavaElementChangeListenerIsActive(javaElementChangeListenerIsActive);
+ }
+
+ /**
+ * Log the specified status.
+ */
+ public static void log(IStatus status) {
+ INSTANCE.getLog().log(status);
+ }
+
+ /**
+ * Log the specified message.
+ */
+ public static void log(String msg) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
+ }
+
+ /**
+ * Log the specified exception or error.
+ */
+ public static void log(Throwable throwable) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
+ }
+
+
+ // ********** plug-in implementation **********
+
+ public JptJpaCorePlugin() {
+ super();
+ if (INSTANCE != null) {
+ throw new IllegalStateException();
+ }
+ // this convention is *wack*... ~bjv
+ INSTANCE = this;
+ }
+
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ // nothing yet...
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ try {
+ if (this.jpaProjectManager != null) {
+ this.jpaProjectManager.stop();
+ this.jpaProjectManager = null;
+ }
+ if (this.parserTracker != null) {
+ this.parserTracker.close();
+ this.parserTracker = null;
+ }
+ } finally {
+ super.stop(context);
+ }
+ }
+
+ private synchronized GenericJpaProjectManager getJpaProjectManager_() {
+ if (this.jpaProjectManager == null) {
+ this.jpaProjectManager = this.buildJpaProjectManager();
+ this.jpaProjectManager.start();
+ }
+ return this.jpaProjectManager;
+ }
+
+ private GenericJpaProjectManager buildJpaProjectManager() {
+ return new GenericJpaProjectManager();
+ }
+
+ public synchronized SAXParserFactory getSAXParserFactory() {
+ SAXParserFactory factory = this.getParserTracker().getService();
+ if (factory != null) {
+ factory.setNamespaceAware(true);
+ }
+ return factory;
+ }
+
+ private ServiceTracker<?, SAXParserFactory> getParserTracker() {
+ if (this.parserTracker == null) {
+ this.parserTracker = this.buildParserTracker();
+ this.parserTracker.open();
+ }
+ return this.parserTracker;
+ }
+
+ private ServiceTracker<?, SAXParserFactory> buildParserTracker() {
+ return new ServiceTracker<Object, SAXParserFactory>(this.getBundle().getBundleContext(), "javax.xml.parsers.SAXParserFactory", null); //$NON-NLS-1$
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java
new file mode 100644
index 0000000000..0a556c8cc8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public interface MappingKeys {
+
+ String ENTITY_TYPE_MAPPING_KEY = "entity";
+ String MAPPED_SUPERCLASS_TYPE_MAPPING_KEY = "mappedSuperclass";
+ String EMBEDDABLE_TYPE_MAPPING_KEY = "embeddable";
+ String NULL_TYPE_MAPPING_KEY = null;
+
+ String BASIC_ATTRIBUTE_MAPPING_KEY = "basic";
+ String ID_ATTRIBUTE_MAPPING_KEY = "id";
+ String VERSION_ATTRIBUTE_MAPPING_KEY = "version";
+ String ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY = "oneToOne";
+ String ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY = "oneToMany";
+ String MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY = "manyToOne";
+ String MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY = "manyToMany";
+ String EMBEDDED_ATTRIBUTE_MAPPING_KEY = "embedded";
+ String EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY = "embeddedId";
+ String TRANSIENT_ATTRIBUTE_MAPPING_KEY = "transient";
+ String NULL_ATTRIBUTE_MAPPING_KEY = null;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java
new file mode 100644
index 0000000000..7c73fe07f5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core;
+
+import org.eclipse.jpt.common.core.JptResourceType;
+
+/**
+ * A JPA platform can support multiple resources. Each will
+ * have a unique resource type and must be defined with a resource definition.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ResourceDefinition
+{
+ /**
+ * Return the definition's resource type.
+ */
+ JptResourceType getResourceType();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java
new file mode 100644
index 0000000000..441e633b01
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Common interface that can be used by clients interested only in a type
+ * or attribute's access setting (e.g. a UI composite).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface AccessHolder
+ extends ReadOnlyAccessHolder
+{
+ /**
+ * Return the specified access type;
+ */
+ AccessType getSpecifiedAccess();
+
+ /**
+ * Set the specified access type.
+ */
+ void setSpecifiedAccess(AccessType newSpecifiedAccess);
+
+ /**
+ * String constant associated with changes to the specified access type
+ */
+ String SPECIFIED_ACCESS_PROPERTY = "specifiedAccess"; //$NON-NLS-1$
+
+ /**
+ * Return the default access type, never null
+ */
+ AccessType getDefaultAccess();
+
+ /**
+ * String constant associated with changes to the default access type
+ */
+ String DEFAULT_ACCESS_PROPERTY = "defaultAccess"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java
new file mode 100644
index 0000000000..29ea8a482d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Context model corresponding to:<ul>
+ * <li>the XML resource model
+ * {@link org.eclipse.jpt.jpa.core.resource.orm.AccessType},
+ * which corresponds to the <code>access</code> element in the
+ * <code>orm.xml</code> file.
+ * <li>the Java resource model {@link org.eclipse.jpt.jpa.core.resource.java.AccessType}
+ * which corresponds to the <code>javax.persistence.Access</code> annotation.
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum AccessType {
+
+ FIELD(
+ org.eclipse.jpt.jpa.core.resource.java.AccessType.FIELD,
+ org.eclipse.jpt.jpa.core.resource.orm.AccessType.FIELD
+ ),
+ PROPERTY(
+ org.eclipse.jpt.jpa.core.resource.java.AccessType.PROPERTY,
+ org.eclipse.jpt.jpa.core.resource.orm.AccessType.PROPERTY
+ );
+
+
+ private org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType;
+ private org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType;
+
+ AccessType(org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType, org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType) {
+ if (javaAccessType == null) {
+ throw new NullPointerException();
+ }
+ if (ormAccessType == null) {
+ throw new NullPointerException();
+ }
+ this.javaAccessType = javaAccessType;
+ this.ormAccessType = ormAccessType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.AccessType getJavaAccessType() {
+ return this.javaAccessType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.AccessType getOrmAccessType() {
+ return this.ormAccessType;
+ }
+
+
+ // ********** static methods **********
+
+ public static AccessType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType) {
+ return (javaAccessType == null) ? null : fromJavaResourceModel_(javaAccessType);
+ }
+
+ private static AccessType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType) {
+ for (AccessType accessType : AccessType.values()) {
+ if (accessType.getJavaAccessType() == javaAccessType) {
+ return accessType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.java.AccessType toJavaResourceModel(AccessType accessType) {
+ return (accessType == null) ? null : accessType.getJavaAccessType();
+ }
+
+ public static AccessType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType) {
+ return (ormAccessType == null) ? null : fromOrmResourceModel_(ormAccessType);
+ }
+
+ private static AccessType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType) {
+ for (AccessType accessType : AccessType.values()) {
+ if (accessType.getOrmAccessType() == ormAccessType) {
+ return accessType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.AccessType toOrmResourceModel(AccessType accessType) {
+ return (accessType == null) ? null : accessType.getOrmAccessType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java
new file mode 100644
index 0000000000..2e34373553
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface AssociationOverride
+ extends Override_, ReadOnlyAssociationOverride
+{
+ VirtualAssociationOverride convertToVirtual();
+
+ OverrideRelationship getRelationship();
+
+ void initializeFrom(ReadOnlyAssociationOverride oldOverride);
+
+ void initializeFromVirtual(ReadOnlyAssociationOverride virtualOverride);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java
new file mode 100644
index 0000000000..3155aad2cc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+
+/**
+ * Association override container.
+ * Used by entities, embedded mappings, and element collection mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.3
+ */
+public interface AssociationOverrideContainer
+ extends OverrideContainer
+{
+ ListIterator<? extends ReadOnlyAssociationOverride> overrides();
+ ReadOnlyAssociationOverride getOverrideNamed(String name);
+ ListIterator<? extends AssociationOverride> specifiedOverrides();
+ AssociationOverride getSpecifiedOverride(int index);
+ AssociationOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<? extends VirtualAssociationOverride> virtualOverrides();
+ VirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ AssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+ /**
+ * Return the relationship mapping with the given attribute name.
+ * Return null if it does not exist. This relationship mapping
+ * will be found in the mapped superclass, not in the owning entity
+ */
+ RelationshipMapping getRelationshipMapping(String attributeName);
+
+ /**
+ * Return the relationship with the specified attribute name.
+ */
+ Relationship resolveOverriddenRelationship(String attributeName);
+
+ JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver);
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends OverrideContainer.Owner
+ {
+ Relationship resolveOverriddenRelationship(String attributeName);
+
+ JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java
new file mode 100644
index 0000000000..3422add9a4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+
+/**
+ * JPA attribute mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface AttributeMapping
+ extends JpaContextNode
+{
+ /**
+ * Return the mapping's attribute (typically its parent node in the
+ * containment hierarchy).
+ */
+ PersistentAttribute getPersistentAttribute();
+
+ /**
+ * Return the mapping's name, which corresponds to the name of the
+ * associated attribute.
+ */
+ String getName();
+
+ /**
+ * Return whether the mapping is its attribute's <em>default</em> mapping
+ * (as opposed to its <em>specified</em> mapping).
+ */
+ boolean isDefault();
+ String DEFAULT_PROPERTY = "default"; //$NON-NLS-1$
+
+ /**
+ * Return a unique key for the attribute mapping. If this is defined in
+ * an extension they should be equal.
+ */
+ String getKey();
+
+ /**
+ * Return whether the "attribute" mapping can be overridden.
+ * The mapping must be a {@link ColumnMapping}.
+ */
+ boolean isOverridableAttributeMapping();
+
+ /**
+ * Return whether the "association" mapping can be overridden.
+ * The mapping must be a {@link RelationshipMapping}.
+ */
+ boolean isOverridableAssociationMapping();
+
+ /**
+ * Return the mapping for the type that contains the mapping's attribute.
+ */
+ TypeMapping getTypeMapping();
+
+ /**
+ * If the mapping is for a primary key column, return the column's name,
+ * otherwise return <code>null</code>.
+ */
+ String getPrimaryKeyColumnName();
+
+ /**
+ * Return whether this mapping is the owning side of a relationship.
+ * Either this is a unidirectional mapping or it is the owning side of a
+ * bidirectional relationship. If bidirectional, the owning side is the
+ * side that does <em>not</em> specify a "mapped by" attribute name.
+ * The owning side is the side where the join table is to be specified.
+ * If this returns <code>true</code> the mapping will be a
+ * {@link RelationshipMapping}.
+ */
+ boolean isRelationshipOwner();
+
+ /**
+ * Return whether the specified mapping manages a relationship with the
+ * mapping.
+ */
+ boolean isOwnedBy(AttributeMapping mapping);
+
+ /**
+ * Return whether any database metadata specific validation should occur.
+ * (For instance, if the connection is not active, then it should not.)
+ */
+ boolean validatesAgainstDatabase();
+
+ /**
+ * Return the relationship for the specified attribute.
+ */
+ Relationship resolveOverriddenRelationship(String attributeName);
+
+
+ // ********** embedded mappings **********
+
+ /**
+ * This is used for "mapped by" choices in a relationship mapping.
+ * Typically this will just be a single element iterator with the mapping's
+ * name.
+ * <p>
+ * In a JPA 2.0 project, an embedded mapping should return its own name as
+ * well as the name of its target embeddable's mappings with the embedded
+ * mapping name prepended, e.g.:<ul>
+ * <li><code>"embedded"</code>
+ * <li><code>"embedded.foo"</code>
+ * <li><code>"embedded.bar"</code>
+ * </ul>
+ */
+ Iterator<String> allMappingNames();
+
+ /**
+ * This is used to determine the virtual attribute overrides for an
+ * embedded mapping or entity. Return the names of all the attributes
+ * that can be overridden.
+ * <p>
+ * In a JPA 2.0 project this will include overridable nested attributes.
+ * @see #isOverridableAttributeMapping()
+ */
+ Iterator<String> allOverridableAttributeMappingNames();
+
+ /**
+ * This is used to determine the virtual association overrides for an
+ * embedded mapping or entity. Return the names of all the associations
+ * that can be overridden.
+ * <p>
+ * In a JPA 2.0 project this will include overridable nested associations.
+ * @see #isOverridableAssociationMapping()
+ */
+ Iterator<String> allOverridableAssociationMappingNames();
+
+ /**
+ * Return the mapping itself if its name matches the specified name.
+ * <p>
+ * In JPA 2.0 this name could use dot-notation for nested mappings.
+ * JPA 2.0 embedded mappings will have to parse this name and return the
+ * appropriate nested mapping.
+ */
+ AttributeMapping resolveAttributeMapping(String name);
+
+ /**
+ * Return the column of the overridable attribute mapping (or attribute
+ * override) with the specified attribute name.
+ * <p>
+ * In JPA 2.0 this name can use dot-notation to designate nested attributes
+ * in embedded attribute mapping's embeddable type mapping.
+ */
+ Column resolveOverriddenColumn(String attributeName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java
new file mode 100644
index 0000000000..e3cf50a22c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Attribute override.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface AttributeOverride
+ extends Override_, ReadOnlyAttributeOverride
+{
+ VirtualAttributeOverride convertToVirtual();
+
+ Column getColumn();
+
+ void initializeFrom(ReadOnlyAttributeOverride oldOverride);
+
+ void initializeFromVirtual(ReadOnlyAttributeOverride oldOverride);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java
new file mode 100644
index 0000000000..fa4fac7254
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Attribute override container.
+ * Used by entities, embedded mappings, and element collection mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface AttributeOverrideContainer
+ extends OverrideContainer
+{
+ ListIterator<? extends ReadOnlyAttributeOverride> overrides();
+ ReadOnlyAttributeOverride getOverrideNamed(String name);
+ ListIterator<? extends AttributeOverride> specifiedOverrides();
+ AttributeOverride getSpecifiedOverride(int index);
+ AttributeOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<? extends VirtualAttributeOverride> virtualOverrides();
+ VirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ AttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+ /**
+ * Return the column of the mapping or attribute override with the specified
+ * attribute name. Return <code>null</code> if it does not exist. This
+ * column mapping/attribute override will be found in the mapped superclass
+ * (or embeddable), not in the owning entity.
+ */
+ Column resolveOverriddenColumn(String attributeName);
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends OverrideContainer.Owner
+ {
+ Column resolveOverriddenColumn(String attributeName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java
new file mode 100644
index 0000000000..1b63c9bd71
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+
+/**
+ * column or join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface BaseColumn
+ extends NamedColumn, ReadOnlyBaseColumn
+{
+ void setSpecifiedTable(String table);
+ void setSpecifiedUnique(Boolean unique);
+ void setSpecifiedNullable(Boolean nullable);
+ void setSpecifiedInsertable(Boolean insertable);
+ void setSpecifiedUpdatable(Boolean updatable);
+
+ boolean tableNameIsInvalid();
+
+ //TODO 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
+ /**
+ * Return a list of table names that are valid for this column
+ */
+ Iterator<String> candidateTableNames();
+
+
+ // ********** owner **********
+
+ /**
+ * Interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides).
+ */
+ interface Owner
+ extends NamedColumn.Owner
+ // ReadOnlyBaseColumn does not define an Owner
+ {
+ /**
+ * return whether the given table cannot be explicitly specified
+ * in the column's 'table' element
+ */
+ boolean tableNameIsInvalid(String tableName);
+
+ /**
+ * Return a list of table names that are valid for this column
+ */
+ Iterator<String> candidateTableNames();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java
new file mode 100644
index 0000000000..2e6ddedaf7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Behavior common to embedded and embedded ID mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface BaseEmbeddedMapping
+ extends AttributeMapping
+{
+ AttributeOverrideContainer getAttributeOverrideContainer();
+
+ /**
+ * Return the embeddable the embedded mapping references.
+ * Return <code>null</code> if there is none.
+ */
+ Embeddable getTargetEmbeddable();
+
+ /**
+ * String associated with property change events for the target embeddable
+ */
+ String TARGET_EMBEDDABLE_PROPERTY = "targetEmbeddable"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java
new file mode 100644
index 0000000000..8cefbf942e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Specified
+ * <ul>
+ * <li>join column
+ * <li>primary key join column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface BaseJoinColumn
+ extends NamedColumn, ReadOnlyBaseJoinColumn
+{
+ void setSpecifiedReferencedColumnName(String value);
+
+ /**
+ * Return the wrapper for the referenced column datasource table
+ */
+ Table getReferencedColumnDbTable();
+
+ boolean referencedColumnIsResolved();
+
+ boolean isVirtual();
+
+
+ // ********** owner **********
+
+ /**
+ * Interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides).
+ */
+ interface Owner
+ extends ReadOnlyBaseJoinColumn.Owner, NamedColumn.Owner
+ {
+ /**
+ * Return the wrapper for the datasource table for the referenced column
+ */
+ Table getReferencedColumnDbTable();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java
new file mode 100644
index 0000000000..c23cfb6628
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA basic mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface BasicMapping
+ extends ColumnMapping, FetchableMapping, OptionalMapping, ConvertibleMapping
+{
+ FetchType DEFAULT_FETCH_TYPE = FetchType.EAGER;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java
new file mode 100644
index 0000000000..4edc0d63f8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA cascade (persist, merge, remove, refresh)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface Cascade
+ extends JpaContextNode
+{
+ boolean isAll();
+ void setAll(boolean value);
+ String ALL_PROPERTY = "all"; //$NON-NLS-1$
+
+ boolean isPersist();
+ void setPersist(boolean value);
+ String PERSIST_PROPERTY = "persist"; //$NON-NLS-1$
+
+ boolean isMerge();
+ void setMerge(boolean value);
+ String MERGE_PROPERTY = "merge"; //$NON-NLS-1$
+
+ boolean isRemove();
+ void setRemove(boolean value);
+ String REMOVE_PROPERTY = "remove"; //$NON-NLS-1$
+
+ boolean isRefresh();
+ void setRefresh(boolean value);
+ String REFRESH_PROPERTY = "refresh"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java
new file mode 100644
index 0000000000..5b8dc30347
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+
+/**
+ * JPA collection mapping (e.g. 1:m, m:m, element collection)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface CollectionMapping
+ extends FetchableMapping
+{
+ FetchType DEFAULT_FETCH_TYPE = FetchType.LAZY;
+
+ Orderable getOrderable();
+
+ PersistentType getResolvedTargetType();
+
+
+ // ********** types **********
+
+ Type getValueType();
+ String VALUE_TYPE_PROPERTY = "valueType"; //$NON-NLS-1$
+
+ Type getKeyType();
+ String KEY_TYPE_PROPERTY = "keyType"; //$NON-NLS-1$
+
+ public enum Type {
+ BASIC_TYPE,
+ EMBEDDABLE_TYPE,
+ ENTITY_TYPE,
+ NO_TYPE
+ }
+
+
+ // ********** map key **********
+
+ String getMapKey();
+
+ String getSpecifiedMapKey();
+ void setSpecifiedMapKey(String mapKey);
+ String SPECIFIED_MAP_KEY_PROPERTY = "specifiedMapKey"; //$NON-NLS-1$
+
+ boolean isNoMapKey();
+ void setNoMapKey(boolean noMapKey);
+ String NO_MAP_KEY_PROPERTY = "noMapKey"; //$NON-NLS-1$
+
+ boolean isPkMapKey();
+ void setPkMapKey(boolean pkMapKey);
+ String PK_MAP_KEY_PROPERTY = "pkMapKey"; //$NON-NLS-1$
+
+ boolean isCustomMapKey();
+ void setCustomMapKey(boolean customMapKey);
+ String CUSTOM_MAP_KEY_PROPERTY = "customMapKey"; //$NON-NLS-1$
+
+ Iterator<String> candidateMapKeyNames();
+
+ String getMetamodelFieldMapKeyTypeName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java
new file mode 100644
index 0000000000..6c1fa9a8be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Normal column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface Column
+ extends BaseColumn, ReadOnlyColumn
+{
+ void initializeFrom(ReadOnlyColumn oldColumn);
+
+ void initializeFromVirtual(ReadOnlyColumn oldColumn);
+
+ void setSpecifiedLength(Integer length);
+
+ void setSpecifiedPrecision(Integer precision);
+
+ void setSpecifiedScale(Integer scale);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java
new file mode 100644
index 0000000000..9fa16f69b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA attribute mapping that has a converter (e.g. basic, ID, version).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface ColumnMapping
+ extends AttributeMapping, BaseColumn.Owner
+{
+ Column getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java
new file mode 100644
index 0000000000..78be6044f1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA attribute mapping converter.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface Converter
+ extends JpaContextNode
+{
+ AttributeMapping getParent();
+
+ /**
+ * Return the converter's type.
+ */
+ Class<? extends Converter> getType();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java
new file mode 100644
index 0000000000..db587e8ce9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA attribute mapping that has a converter (e.g. basic, ID, version).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.1
+ */
+public interface ConvertibleMapping
+ extends AttributeMapping
+{
+ /**
+ * Return the mapping's converter. Never <code>null</code>.
+ */
+ Converter getConverter();
+ String CONVERTER_PROPERTY = "converter"; //$NON-NLS-1$
+
+ /**
+ * Set the converter type, adding the appropriate converter to the resource
+ * model and removing any other converters. Clear all converters if the
+ * specified type is <code>null</code>.
+ */
+ void setConverter(Class<? extends Converter> converterType);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java
new file mode 100644
index 0000000000..6b7d22d13f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * discriminator column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface DiscriminatorColumn
+ extends NamedColumn
+{
+ String DEFAULT_NAME = "DTYPE"; //$NON-NLS-1$
+
+
+ // ********** discriminator type **********
+
+ /**
+ * Return the specified discriminator type if present,
+ * otherwise return the default discriminator type.
+ */
+ DiscriminatorType getDiscriminatorType();
+ DiscriminatorType getSpecifiedDiscriminatorType();
+ void setSpecifiedDiscriminatorType(DiscriminatorType newSpecifiedDiscriminatorType);
+ String SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY = "specifiedDiscriminatorType"; //$NON-NLS-1$
+ DiscriminatorType getDefaultDiscriminatorType();
+ String DEFAULT_DISCRIMINATOR_TYPE_PROPERTY = "defaultDiscriminatorType"; //$NON-NLS-1$
+ DiscriminatorType DEFAULT_DISCRIMINATOR_TYPE = DiscriminatorType.STRING;
+
+
+ // ********** length **********
+
+ /**
+ * Return the specified length if present,
+ * otherwise return the default length.
+ */
+ int getLength();
+ Integer getSpecifiedLength();
+ void setSpecifiedLength(Integer value);
+ String SPECIFIED_LENGTH_PROPERTY = "specifiedLength"; //$NON-NLS-1$
+ int getDefaultLength();
+ String DEFAULT_LENGTH_PROPERTY = "defaultLength"; //$NON-NLS-1$
+ int DEFAULT_LENGTH = 31;
+
+
+ // ********** validation **********
+
+ /**
+ * Return whether the column is specified in the resource.
+ */
+ boolean isResourceSpecified();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing discriminator columns to be used in multiple places
+ * (but pretty much just entities)
+ */
+ interface Owner
+ extends NamedColumn.Owner
+ {
+ /**
+ * Return the default discriminator column length
+ */
+ int getDefaultLength();
+
+ /**
+ * Return the default discriminator column type
+ */
+ DiscriminatorType getDefaultDiscriminatorType();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java
new file mode 100644
index 0000000000..ebfd0b93ad
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Discriminator Type
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum DiscriminatorType {
+
+ STRING(
+ org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.STRING,
+ org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType.STRING
+ ),
+ CHAR(
+ org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.CHAR,
+ org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType.CHAR
+ ),
+ INTEGER(
+ org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.INTEGER,
+ org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType.INTEGER
+ );
+
+
+ private org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType;
+ private org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType;
+
+ DiscriminatorType(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType, org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType) {
+ if (javaDiscriminatorType == null) {
+ throw new NullPointerException();
+ }
+ if (ormDiscriminatorType == null) {
+ throw new NullPointerException();
+ }
+ this.javaDiscriminatorType = javaDiscriminatorType;
+ this.ormDiscriminatorType = ormDiscriminatorType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType getJavaDiscriminatorType() {
+ return this.javaDiscriminatorType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType getOrmDiscriminatorType() {
+ return this.ormDiscriminatorType;
+ }
+
+
+ // ********** static methods **********
+
+ public static DiscriminatorType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType) {
+ return (javaDiscriminatorType == null) ? null : fromJavaResourceModel_(javaDiscriminatorType);
+ }
+
+ private static DiscriminatorType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType) {
+ for (DiscriminatorType discriminatorType : DiscriminatorType.values()) {
+ if (discriminatorType.getJavaDiscriminatorType() == javaDiscriminatorType) {
+ return discriminatorType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType toJavaResourceModel(DiscriminatorType discriminatorType) {
+ return (discriminatorType == null) ? null : discriminatorType.getJavaDiscriminatorType();
+ }
+
+ public static DiscriminatorType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType) {
+ return (ormDiscriminatorType == null) ? null : fromOrmResourceModel_(ormDiscriminatorType);
+ }
+
+ private static DiscriminatorType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType) {
+ for (DiscriminatorType discriminatorType : DiscriminatorType.values()) {
+ if (discriminatorType.getOrmDiscriminatorType() == ormDiscriminatorType) {
+ return discriminatorType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType toOrmResourceModel(DiscriminatorType discriminatorType) {
+ return (discriminatorType == null) ? null : discriminatorType.getOrmDiscriminatorType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java
new file mode 100644
index 0000000000..4c06592dd2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * embeddable type mapping
+ * <b>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface Embeddable
+ extends TypeMapping
+{
+ // nothing yet
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java
new file mode 100644
index 0000000000..6bd03dff15
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA embedded ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface EmbeddedIdMapping
+ extends BaseEmbeddedMapping
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java
new file mode 100644
index 0000000000..4a9f747c34
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA embedded mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface EmbeddedMapping
+ extends BaseEmbeddedMapping
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
new file mode 100644
index 0000000000..ed494b6929
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * entity
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface Entity
+ extends TypeMapping
+{
+ // ********** name **********
+
+ String getSpecifiedName();
+ String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$
+ void setSpecifiedName(String name);
+ String getDefaultName();
+ String DEFAULT_NAME_PROPERTY = "defaultName"; //$NON-NLS-1$
+
+
+ // ********** id class **********
+
+ /**
+ * Return the (aggregate) class reference for configuring and validating id class
+ */
+ IdClassReference getIdClassReference();
+
+
+ // ********** table **********
+
+ /**
+ * Return the table for this entity, either specified or default.
+ * This will not be null.
+ */
+ Table getTable();
+
+ /**
+ * 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 getPrimaryKeyColumnName();
+
+ /**
+ * Return the entity's default table name, which depends on the entity's
+ * inheritance hierarchy.
+ */
+ String getDefaultTableName();
+
+ /**
+ * Return the entity's default schema, which depends on the entity's
+ * inheritance hierarchy.
+ */
+ String getDefaultSchema();
+
+ /**
+ * Return the entity's default catalog, which depends on the entity's
+ * inheritance hierarchy.
+ */
+ String getDefaultCatalog();
+
+
+ // ********** secondary tables **********
+
+ /**
+ * Return the secondary tables whether specified or default.
+ */
+ ListIterator<? extends ReadOnlySecondaryTable> secondaryTables();
+
+ /**
+ * Return the number of secondary tables, both specified and default.
+ */
+ int secondaryTablesSize();
+
+ /**
+ * Return a list iterator of the specified secondary tables.
+ * This will not be null.
+ */
+ ListIterator<? extends SecondaryTable> specifiedSecondaryTables();
+ String SPECIFIED_SECONDARY_TABLES_LIST = "specifiedSecondaryTables"; //$NON-NLS-1$
+
+ /**
+ * Return the number of specified secondary tables.
+ */
+ int specifiedSecondaryTablesSize();
+
+ /**
+ * Add a specified secondary table to the entity return the object
+ * representing it.
+ */
+ SecondaryTable addSpecifiedSecondaryTable();
+
+ /**
+ * Add a specified secondary table to the entity return the object
+ * representing it.
+ */
+ SecondaryTable addSpecifiedSecondaryTable(int index);
+
+ /**
+ * Remove the specified secondary table from the entity.
+ */
+ void removeSpecifiedSecondaryTable(int index);
+
+ /**
+ * Remove the specified secondary table at the index from the entity.
+ */
+ void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable);
+
+ /**
+ * Move the specified secondary table from the source index to the target index.
+ */
+ void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex);
+
+
+ // ********** inheritance strategy **********
+
+ /**
+ * Return the specified inheritance strategy if present, otherwise return the default
+ * inheritance strategy.
+ */
+ InheritanceType getInheritanceStrategy();
+ InheritanceType getSpecifiedInheritanceStrategy();
+ void setSpecifiedInheritanceStrategy(InheritanceType inheritanceType);
+ String SPECIFIED_INHERITANCE_STRATEGY_PROPERTY = "specifiedInheritanceStrategy"; //$NON-NLS-1$
+ InheritanceType getDefaultInheritanceStrategy();
+ String DEFAULT_INHERITANCE_STRATEGY_PROPERTY = "defaultInheritanceStrategy"; //$NON-NLS-1$
+
+
+ /**
+ * 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). Return null if there is no parent entity.
+ */
+ Entity getParentEntity();
+
+ DiscriminatorColumn getDiscriminatorColumn();
+
+ String getDiscriminatorValue();
+ String getSpecifiedDiscriminatorValue();
+ void setSpecifiedDiscriminatorValue(String value);
+ String SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY = "specifiedDiscriminatorValue"; //$NON-NLS-1$
+ String getDefaultDiscriminatorValue();
+ String DEFAULT_DISCRIMINATOR_VALUE_PROPERTY = "defaultDiscriminatorValue"; //$NON-NLS-1$
+
+ /**
+ * Return whether a DiscriminatorValue is allowed for this Entity.
+ * It is allowed if the entity is not abstract and not part of
+ * a table-per-class inheritance hierarchy
+ */
+ boolean specifiedDiscriminatorValueIsAllowed();
+ String SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY = "discriminatorValueIsAllowed"; //$NON-NLS-1$
+
+ /**
+ * Return whether a DiscriminatorValue is undefined for this Entity.
+ * It is undefined if the entity is abstract or if it
+ * is part of a table-per-class inheritance hierarchy
+ */
+ boolean discriminatorValueIsUndefined();
+ String DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY = "discriminatorValueIsUndefined"; //$NON-NLS-1$
+
+ /**
+ * Return whether a DiscriminatorColumn is allowed for this Entity.
+ * It is allowed if the entity is the root of the inheritance hierarchy (with descendant entities)
+ * and the strategy is not table-per-class
+ */
+ boolean specifiedDiscriminatorColumnIsAllowed();
+ String SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY = "specifiedDiscriminatorColumnIsAllowed"; //$NON-NLS-1$
+
+ /**
+ * Return whether a DiscriminatorColumn is undefined for this Entity.
+ * It is undefined if the inheritance strategy is table-per-class
+ */
+ boolean discriminatorColumnIsUndefined();
+ String DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY = "discriminatorColumnIsUndefined"; //$NON-NLS-1$
+
+ /**
+ * Return whether a Table is allowed for this Entity.
+ * If the inheritance strategy is single-table, Table is allowed only
+ * on the root entity.
+ * If the inheritance strategy is table-per-class it is allowed only
+ * on concrete entities.
+ */
+ boolean specifiedTableIsAllowed();
+ String SPECIFIED_TABLE_IS_ALLOWED_PROPERTY = "specifiedTableIsAllowed"; //$NON-NLS-1$
+
+ /**
+ * Return whether a Table is undefined for this Entity.
+ * If the inheritance strategy is table-per-class and the entity is
+ * abstract, then a Table object is undefined
+ */
+ boolean tableIsUndefined();
+ String TABLE_IS_UNDEFINED_PROPERTY = "tableIsUndefined"; //$NON-NLS-1$
+
+
+ // ********** primary key join columns **********
+
+ ListIterator<? extends ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+
+ int primaryKeyJoinColumnsSize();
+
+ ListIterator<? extends PrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumns"; //$NON-NLS-1$
+
+ int specifiedPrimaryKeyJoinColumnsSize();
+
+ PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+
+ PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
+
+ void removeSpecifiedPrimaryKeyJoinColumn(int index);
+
+ void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn);
+
+ void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex);
+
+
+ // ********** containers **********
+
+ AttributeOverrideContainer getAttributeOverrideContainer();
+
+ AssociationOverrideContainer getAssociationOverrideContainer();
+
+ QueryContainer getQueryContainer();
+
+ GeneratorContainer getGeneratorContainer();
+
+
+ // ********** entity inheritance **********
+
+ /**
+ * Return whether this entity is a root entity in an inheritance hierarchy.
+ */
+ boolean isRoot();
+
+ /**
+ * Return the top of the entity's inheritance hierarchy.
+ * This method will never return <code>null</code>. The root
+ * is defined as the persistent type in the inheritance hierarchy
+ * that has no parent. The root will be an entity.
+ * <p>
+ * Non-entities in the hierarchy should be ignored; i.e. we skip
+ * over them in the search for the root.
+ */
+ Entity getRootEntity();
+ String ROOT_ENTITY_PROPERTY = "rootEntity"; //$NON-NLS-1$
+
+ /**
+ * If the entity is a root entity, return the entity's descendant entities;
+ * if the entity is not a root entity, return an empty collection.
+ * <p>
+ * <strong>NB:</strong> An entity A is a "descendant" of another root
+ * entity B if the <em>name</em> of entity A's root entity's type matches
+ * the name of entity B's type. This means entity A can be a "descendant"
+ * of multiple root entities (typically both the <code>orm.xml</code>
+ * and Java root entities for a particular type); despite entity have only
+ * a single "root" entity (typically the <code>orm.xml</code> root entity).
+ */
+ Iterable<Entity> getDescendants();
+ String DESCENDANTS_COLLECTION = "descendants"; //$NON-NLS-1$
+
+
+ // ********** misc **********
+
+ /**
+ * Returns the attribute mapping that matches the name.
+ * In 2.0 this name could use dot-notation for nested mappings.
+ */
+ AttributeMapping resolveAttributeMapping(String name);
+
+ /**
+ * If an entity has a single id attribute, return that attribute.
+ * Else return null.
+ */
+ PersistentAttribute getIdAttribute();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java
new file mode 100644
index 0000000000..4135ca9b2e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Enum Type
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum EnumType {
+
+ ORDINAL(
+ org.eclipse.jpt.jpa.core.resource.java.EnumType.ORDINAL,
+ org.eclipse.jpt.jpa.core.resource.orm.EnumType.ORDINAL
+ ),
+ STRING(
+ org.eclipse.jpt.jpa.core.resource.java.EnumType.STRING,
+ org.eclipse.jpt.jpa.core.resource.orm.EnumType.STRING
+ );
+
+
+ private org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType;
+ private org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType;
+
+ EnumType(org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType, org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType) {
+ if (javaEnumType == null) {
+ throw new NullPointerException();
+ }
+ if (ormEnumType == null) {
+ throw new NullPointerException();
+ }
+ this.javaEnumType = javaEnumType;
+ this.ormEnumType = ormEnumType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.EnumType getJavaEnumType() {
+ return this.javaEnumType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.EnumType getOrmEnumType() {
+ return this.ormEnumType;
+ }
+
+
+ // ********** static methods **********
+
+ public static EnumType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType) {
+ return (javaEnumType == null) ? null : fromJavaResourceModel_(javaEnumType);
+ }
+
+ private static EnumType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType) {
+ for (EnumType enumType : EnumType.values()) {
+ if (enumType.getJavaEnumType() == javaEnumType) {
+ return enumType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.java.EnumType toJavaResourceModel(EnumType enumType) {
+ return (enumType == null) ? null : enumType.getJavaEnumType();
+ }
+
+ public static EnumType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType) {
+ return (ormEnumType == null) ? null : fromOrmResourceModel_(ormEnumType);
+ }
+
+ private static EnumType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType) {
+ for (EnumType enumType : EnumType.values()) {
+ if (enumType.getOrmEnumType() == ormEnumType) {
+ return enumType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.EnumType toOrmResourceModel(EnumType enumType) {
+ return (enumType == null) ? null : enumType.getOrmEnumType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java
new file mode 100644
index 0000000000..570f8738ad
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA enumerated converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.1
+ */
+public interface EnumeratedConverter
+ extends Converter
+{
+ EnumType getEnumType();
+
+ EnumType getSpecifiedEnumType();
+ void setSpecifiedEnumType(EnumType enumType);
+ String SPECIFIED_ENUM_TYPE_PROPERTY = "specifiedEnumType"; //$NON-NLS-1$
+
+ EnumType getDefaultEnumType();
+ String DEFAULT_ENUM_TYPE_PROPERTY = "defaultEnumType"; //$NON-NLS-1$
+ EnumType DEFAULT_ENUM_TYPE = EnumType.ORDINAL;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java
new file mode 100644
index 0000000000..2ae147cf90
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Fetch Type
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum FetchType {
+
+ EAGER(
+ org.eclipse.jpt.jpa.core.resource.java.FetchType.EAGER,
+ org.eclipse.jpt.jpa.core.resource.orm.FetchType.EAGER
+ ),
+ LAZY(
+ org.eclipse.jpt.jpa.core.resource.java.FetchType.LAZY,
+ org.eclipse.jpt.jpa.core.resource.orm.FetchType.LAZY
+ );
+
+
+ private org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType;
+ private org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType;
+
+ FetchType(org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType, org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType) {
+ if (javaFetchType == null) {
+ throw new NullPointerException();
+ }
+ if (ormFetchType == null) {
+ throw new NullPointerException();
+ }
+ this.javaFetchType = javaFetchType;
+ this.ormFetchType = ormFetchType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.FetchType getJavaFetchType() {
+ return this.javaFetchType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.FetchType getOrmFetchType() {
+ return this.ormFetchType;
+ }
+
+
+ // ********** static methods **********
+
+ public static FetchType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType) {
+ return (javaFetchType == null) ? null : fromJavaResourceModel_(javaFetchType);
+ }
+
+ private static FetchType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType) {
+ for (FetchType fetchType : FetchType.values()) {
+ if (fetchType.getJavaFetchType() == javaFetchType) {
+ return fetchType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.java.FetchType toJavaResourceModel(FetchType fetchType) {
+ return (fetchType == null) ? null : fetchType.getJavaFetchType();
+ }
+
+ public static FetchType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType) {
+ return (ormFetchType == null) ? null : fromOrmResourceModel_(ormFetchType);
+ }
+
+ private static FetchType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType) {
+ for (FetchType fetchType : FetchType.values()) {
+ if (fetchType.getOrmFetchType() == ormFetchType) {
+ return fetchType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.FetchType toOrmResourceModel(FetchType fetchType) {
+ return (fetchType == null) ? null : fetchType.getOrmFetchType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java
new file mode 100644
index 0000000000..31dec5ef31
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA attribute mapping that has a fetch type (e.g. basic, relationship).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface FetchableMapping
+ extends AttributeMapping
+{
+ FetchType getFetch();
+
+ FetchType getSpecifiedFetch();
+ void setSpecifiedFetch(FetchType newSpecifiedFetch);
+ String SPECIFIED_FETCH_PROPERTY = "specifiedFetch"; //$NON-NLS-1$
+
+ FetchType getDefaultFetch();
+ String DEFAULT_FETCH_PROPERTY = "defaultFetch"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java
new file mode 100644
index 0000000000..934a08f609
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA generated value
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface GeneratedValue
+ extends JpaContextNode
+{
+ GenerationType getStrategy();
+ GenerationType getSpecifiedStrategy();
+ void setSpecifiedStrategy(GenerationType strategy);
+ String SPECIFIED_STRATEGY_PROPERTY = "specifiedStrategy"; //$NON-NLS-1$
+ GenerationType getDefaultStrategy();
+ String DEFAULT_STRATEGY_PROPERTY = "defaultStrategy"; //$NON-NLS-1$
+ GenerationType DEFAULT_STRATEGY = GenerationType.AUTO;
+
+ String getGenerator();
+ String getSpecifiedGenerator();
+ void setSpecifiedGenerator(String generator);
+ String SPECIFIED_GENERATOR_PROPERTY = "specifiedGenerator"; //$NON-NLS-1$
+ String getDefaultGenerator();
+ String DEFAULT_GENERATOR_PROPERTY = "defaultGenerator"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java
new file mode 100644
index 0000000000..6d87ae32d2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Generation Type
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum GenerationType {
+
+ TABLE(
+ org.eclipse.jpt.jpa.core.resource.java.GenerationType.TABLE,
+ org.eclipse.jpt.jpa.core.resource.orm.GenerationType.TABLE
+ ),
+ SEQUENCE(
+ org.eclipse.jpt.jpa.core.resource.java.GenerationType.SEQUENCE,
+ org.eclipse.jpt.jpa.core.resource.orm.GenerationType.SEQUENCE
+ ),
+ IDENTITY(
+ org.eclipse.jpt.jpa.core.resource.java.GenerationType.IDENTITY,
+ org.eclipse.jpt.jpa.core.resource.orm.GenerationType.IDENTITY
+ ),
+ AUTO(
+ org.eclipse.jpt.jpa.core.resource.java.GenerationType.AUTO,
+ org.eclipse.jpt.jpa.core.resource.orm.GenerationType.AUTO
+ );
+
+
+ private org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType;
+ private org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType;
+
+ GenerationType(org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType, org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType) {
+ if (javaGenerationType == null) {
+ throw new NullPointerException();
+ }
+ if (ormGenerationType == null) {
+ throw new NullPointerException();
+ }
+ this.javaGenerationType = javaGenerationType;
+ this.ormGenerationType = ormGenerationType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.GenerationType getJavaGenerationType() {
+ return this.javaGenerationType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.GenerationType getOrmGenerationType() {
+ return this.ormGenerationType;
+ }
+
+
+ // ********** static methods **********
+
+ public static GenerationType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType) {
+ return (javaGenerationType == null) ? null : fromJavaResourceModel_(javaGenerationType);
+ }
+
+ private static GenerationType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType) {
+ for (GenerationType generationType : GenerationType.values()) {
+ if (generationType.getJavaGenerationType() == javaGenerationType) {
+ return generationType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.java.GenerationType toJavaResourceModel(GenerationType generationType) {
+ return (generationType == null) ? null : generationType.getJavaGenerationType();
+ }
+
+ public static GenerationType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType) {
+ return (ormGenerationType == null) ? null : fromOrmResourceModel_(ormGenerationType);
+ }
+
+ private static GenerationType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType) {
+ for (GenerationType generationType : GenerationType.values()) {
+ if (generationType.getOrmGenerationType() == ormGenerationType) {
+ return generationType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.GenerationType toOrmResourceModel(GenerationType generationType) {
+ return (generationType == null) ? null : generationType.getOrmGenerationType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java
new file mode 100644
index 0000000000..3f82a10551
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Arrays;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * sequence and table generators
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface Generator
+ extends JpaNamedContextNode<Generator>
+{
+ /**
+ * TODO use this precedence until adopters protest...
+ * then move to JpaPlatform
+ */
+ @SuppressWarnings("unchecked")
+ Iterable<Class<? extends Generator>> PRECEDENCE_TYPE_LIST = Arrays.asList(
+ OrmGenerator.class,
+ JavaGenerator.class
+ );
+
+
+ // ********** initial value **********
+
+ /**
+ * Return the specified initial value if present, otherwise return the
+ * default initial value.
+ */
+ int getInitialValue();
+ Integer getSpecifiedInitialValue();
+ void setSpecifiedInitialValue(Integer value);
+ String SPECIFIED_INITIAL_VALUE_PROPERTY = "specifiedInitialValue"; //$NON-NLS-1$
+ int getDefaultInitialValue();
+ String DEFAULT_INITIAL_VALUE_PROPERTY = "defaultInitialValue"; //$NON-NLS-1$
+
+
+ // ********** allocation size **********
+
+ /**
+ * Return the specified allocation size if present, otherwise return the
+ * default allocation size.
+ */
+ int getAllocationSize();
+ Integer getSpecifiedAllocationSize();
+ void setSpecifiedAllocationSize(Integer value);
+ String SPECIFIED_ALLOCATION_SIZE_PROPERTY = "specifiedAllocationSize"; //$NON-NLS-1$
+ int getDefaultAllocationSize();
+ String DEFAULT_ALLOCATION_SIZE_PROPERTY = "defaultAllocationSize"; //$NON-NLS-1$
+ int DEFAULT_ALLOCATION_SIZE = 50;
+
+
+ // ********** database stuff **********
+
+ /**
+ * Return the schema container that holds the relevant schemata.
+ */
+ SchemaContainer getDbSchemaContainer();
+
+ /**
+ * Return the generator's database catalog.
+ * Return null if the generator's catalog (name) is invalid.
+ */
+ Catalog getDbCatalog();
+
+ /**
+ * Return the generator's database schema.
+ * Return null if the generator's schema (name) is invalid.
+ */
+ Schema getDbSchema();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java
new file mode 100644
index 0000000000..9297560a29
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Container for a table generator and/or sequence generator.
+ * Used by entities and ID mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface GeneratorContainer
+ extends JpaContextNode
+{
+ // ********** sequence generator **********
+
+ String SEQUENCE_GENERATOR_PROPERTY = "sequenceGenerator"; //$NON-NLS-1$
+
+ SequenceGenerator getSequenceGenerator();
+
+ SequenceGenerator addSequenceGenerator();
+
+ void removeSequenceGenerator();
+
+
+ // ********** table generator **********
+
+ String TABLE_GENERATOR_PROPERTY = "tableGenerator"; //$NON-NLS-1$
+
+ TableGenerator getTableGenerator();
+
+ TableGenerator addTableGenerator();
+
+ void removeTableGenerator();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java
new file mode 100644
index 0000000000..8d63b18cb5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+
+/**
+ * ID class reference
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface IdClassReference
+ extends PersistentType.Owner
+{
+ // ********** id class name **********
+
+ /**
+ * Return the name of the id class, taking into consideration the default value if applicable
+ */
+ String getIdClassName();
+
+ /**
+ * Property string associated with changes to the {@link IdClassHolder}'s specified id class name
+ */
+ String SPECIFIED_ID_CLASS_NAME_PROPERTY = "specifiedIdClassName"; //$NON-NLS-1$
+
+ /**
+ * Return the specified name of the id class, null if none is specified in the resource model
+ */
+ String getSpecifiedIdClassName();
+
+ /**
+ * Set the specified name of the id class.
+ * Use null to remove the id class specification from the resource model
+ */
+ void setSpecifiedIdClassName(String value);
+
+ /**
+ * Property string associated with changes to the {@link IdClassHolder}'s default id class name
+ */
+ String DEFAULT_ID_CLASS_NAME_PROPERTY = "defaultIdClassName"; //$NON-NLS-1$
+
+ /**
+ * Return the default name of the id class, null if there is none
+ */
+ String getDefaultIdClassName();
+
+ /**
+ * Return whether the id class has been specified.
+ * Generally, this simply means that the id class name has been set, although if a default
+ * applies, this should also return true.
+ */
+ boolean isSpecified();
+
+
+ // ********** id class **********
+
+ /**
+ * Property string associated with changes to the {@link IdClassHolder}'s id class.
+ * This will change (potentially) if the id class name changes, or if other changes result
+ * in changes in the id class' resolution.
+ */
+ String ID_CLASS_PROPERTY = "idClass"; //$NON-NLS-1$
+
+ /**
+ * Return the {@link JavaPersistentType} that is resolved from the id class name.
+ * This will be null if the id class name is null or if the class cannot be resolved from that
+ * name.
+ */
+ JavaPersistentType getIdClass();
+
+ /**
+ * Return the char to be used for browsing or creating the id class IType.
+ * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
+ */
+ char getIdClassEnclosingTypeSeparator();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java
new file mode 100644
index 0000000000..d4f117ff28
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface IdMapping
+ extends ColumnMapping, ConvertibleMapping
+{
+ GeneratorContainer getGeneratorContainer();
+
+ GeneratedValue getGeneratedValue();
+ GeneratedValue addGeneratedValue();
+ void removeGeneratedValue();
+ String GENERATED_VALUE_PROPERTY = "generatedValue"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java
new file mode 100644
index 0000000000..a3003bf64c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Inheritance Type
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum InheritanceType {
+
+ SINGLE_TABLE(
+ org.eclipse.jpt.jpa.core.resource.java.InheritanceType.SINGLE_TABLE,
+ org.eclipse.jpt.jpa.core.resource.orm.InheritanceType.SINGLE_TABLE
+ ),
+ JOINED(
+ org.eclipse.jpt.jpa.core.resource.java.InheritanceType.JOINED,
+ org.eclipse.jpt.jpa.core.resource.orm.InheritanceType.JOINED
+ ),
+ TABLE_PER_CLASS(
+ org.eclipse.jpt.jpa.core.resource.java.InheritanceType.TABLE_PER_CLASS,
+ org.eclipse.jpt.jpa.core.resource.orm.InheritanceType.TABLE_PER_CLASS
+ );
+
+
+ private org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType;
+ private org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType;
+
+ InheritanceType(org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType, org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType) {
+ if (javaInheritanceType == null) {
+ throw new NullPointerException();
+ }
+ if (ormInheritanceType == null) {
+ throw new NullPointerException();
+ }
+ this.javaInheritanceType = javaInheritanceType;
+ this.ormInheritanceType = ormInheritanceType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.InheritanceType getJavaInheritanceType() {
+ return this.javaInheritanceType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.InheritanceType getOrmInheritanceType() {
+ return this.ormInheritanceType;
+ }
+
+
+ // ********** static methods **********
+
+ public static InheritanceType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType) {
+ return (javaInheritanceType == null) ? null : fromJavaResourceModel_(javaInheritanceType);
+ }
+
+ private static InheritanceType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType) {
+ for (InheritanceType inheritanceType : InheritanceType.values()) {
+ if (inheritanceType.getJavaInheritanceType() == javaInheritanceType) {
+ return inheritanceType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.java.InheritanceType toJavaResourceModel(InheritanceType inheritanceType) {
+ return (inheritanceType == null) ? null : inheritanceType.getJavaInheritanceType();
+ }
+
+ public static InheritanceType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType) {
+ return (ormInheritanceType == null) ? null : fromOrmResourceModel_(ormInheritanceType);
+ }
+
+ private static InheritanceType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType) {
+ for (InheritanceType inheritanceType : InheritanceType.values()) {
+ if (inheritanceType.getOrmInheritanceType() == ormInheritanceType) {
+ return inheritanceType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.InheritanceType toOrmResourceModel(InheritanceType inheritanceType) {
+ return (inheritanceType == null) ? null : inheritanceType.getOrmInheritanceType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java
new file mode 100644
index 0000000000..42d2edf02d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Specified join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JoinColumn
+ extends BaseJoinColumn, BaseColumn, ReadOnlyJoinColumn
+{
+ /**
+ * Initialize the join column from the specified old join column.
+ */
+ void initializeFrom(ReadOnlyJoinColumn oldJoinColumn);
+
+ /**
+ * Initialize the join column from the specified old virtual join column.
+ */
+ void initializeFromVirtual(ReadOnlyJoinColumn virtualJoinColumn);
+
+
+ /**
+ * interface allowing join columns to be used in multiple places
+ * (e.g. 1:1 mappings and join tables)
+ */
+ interface Owner
+ extends ReadOnlyJoinColumn.Owner, BaseJoinColumn.Owner, BaseColumn.Owner
+ {
+ // combine interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java
new file mode 100644
index 0000000000..4a80ae536c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Join column relationship<ul>
+ * <li>1:1
+ * <li>1:m
+ * <li>m:1
+ * <li>association override
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see Relationship
+ * @see JoinColumn
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JoinColumnRelationship
+ extends ReadOnlyJoinColumnRelationship, Relationship
+{
+ JoinColumnRelationshipStrategy getJoinColumnStrategy();
+
+ /**
+ * Set the relationship's strategy to the join column strategy.
+ */
+ void setStrategyToJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..a6338dfce5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Join column relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see AssociationOverride
+ * @see JoinColumnRelationship
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JoinColumnRelationshipStrategy
+ extends ReadOnlyJoinColumnRelationshipStrategy, RelationshipStrategy
+{
+ void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy);
+
+ void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy oldStrategy);
+
+
+ // ********** join columns **********
+
+ ListIterator<? extends JoinColumn> joinColumns();
+
+
+ // ********** specified join columns **********
+
+ ListIterator<? extends JoinColumn> specifiedJoinColumns();
+ JoinColumn getSpecifiedJoinColumn(int index);
+
+ /**
+ * Add a specified join column to the relationship.
+ */
+ JoinColumn addSpecifiedJoinColumn();
+
+ /**
+ * Add a specified join column to the relationship.
+ */
+ JoinColumn addSpecifiedJoinColumn(int index);
+
+ /**
+ * Remove the specified join column.
+ */
+ void removeSpecifiedJoinColumn(int index);
+
+ /**
+ * Remove the specified join column.
+ */
+ void removeSpecifiedJoinColumn(JoinColumn joinColumn);
+
+ /**
+ * Move the specified join column from the source index to the target index.
+ */
+ void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex);
+
+
+ // ********** default join column **********
+
+ JoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java
new file mode 100644
index 0000000000..7a95d1b11a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Used by many-to-many and one-to-many mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JoinTable
+ extends ReferenceTable, ReadOnlyJoinTable
+{
+ JoinTableRelationshipStrategy getParent();
+
+ void initializeFrom(ReadOnlyJoinTable oldJoinTable);
+
+ void initializeFromVirtual(ReadOnlyJoinTable virtualJoinTable);
+
+
+ // ********** inverse join columns **********
+
+ /**
+ * Convert the join table's default inverse join column to a specified
+ * inverse join column.
+ */
+ void convertDefaultToSpecifiedInverseJoinColumn();
+
+ ListIterator<? extends JoinColumn> inverseJoinColumns();
+
+ ListIterator<? extends JoinColumn> specifiedInverseJoinColumns();
+
+ JoinColumn getSpecifiedInverseJoinColumn(int index);
+
+ /**
+ * Add a specified inverse join column to the join table.
+ * Return the newly-created join column.
+ */
+ JoinColumn addSpecifiedInverseJoinColumn();
+
+ /**
+ * Add a specified inverse join column to the join table.
+ * Return the newly-created join column.
+ */
+ JoinColumn addSpecifiedInverseJoinColumn(int index);
+
+ /**
+ * Remove the inverse join column at the specified index from the join table.
+ */
+ void removeSpecifiedInverseJoinColumn(int index);
+
+ /**
+ * Remove the specified inverse join column from the join table.
+ */
+ void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn);
+
+ /**
+ * Move an inverse join column from the specified source index to the
+ * specified target index.
+ */
+ void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex);
+
+ /**
+ * Remove all the join table's inverse join columns.
+ */
+ void clearSpecifiedInverseJoinColumns();
+
+ JoinColumn getDefaultInverseJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java
new file mode 100644
index 0000000000..45b60aaf47
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Join table relationship<ul>
+ * <li>1:1 (JPA 2.0)
+ * <li>1:m
+ * <li>m:1 (JPA 2.0)
+ * <li>m:m
+ * <li>association override (JPA 2.0)
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JoinTableRelationship
+ extends ReadOnlyJoinTableRelationship, Relationship
+{
+ JoinTableRelationshipStrategy getJoinTableStrategy();
+
+ /**
+ * Set the relationship's strategy to the join table strategy.
+ */
+ void setStrategyToJoinTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..74bf5f21b9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+
+/**
+ * Join table relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see AssociationOverride
+ * @see JoinTableRelationship
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JoinTableRelationshipStrategy
+ extends ReadOnlyJoinTableRelationshipStrategy, RelationshipStrategy
+{
+ void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy);
+
+ void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy);
+
+ JoinTable getJoinTable();
+
+ boolean validatesAgainstDatabase();
+
+ JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java
new file mode 100644
index 0000000000..3de89e27bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.jpa.core.JpaNode;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * Common protocol for JPA objects that have a context, as opposed to
+ * resource objects.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JpaContextNode
+ extends JpaNode
+{
+ /**
+ * Return the resource type of the context node's resource.
+ */
+ JptResourceType getResourceType();
+
+ /**
+ * Return the persistence unit if the context node is within a
+ * persistence unit. Otherwise throw an exception.
+ */
+ PersistenceUnit getPersistenceUnit();
+
+ /**
+ * Return the mapping file root if the context node is within a
+ * mapping file. Otherwise throw an exception.
+ */
+ MappingFileRoot getMappingFileRoot();
+
+
+ // ********** database stuff **********
+
+ SchemaContainer getContextDefaultDbSchemaContainer();
+
+ Catalog getContextDefaultDbCatalog();
+
+ Schema getContextDefaultDbSchema();
+
+
+ // ********** synchronize/update **********
+
+ /**
+ * The resource model has changed; synchronize the context model with it.
+ * This will probably trigger a call to {@link #update()}.
+ */
+ void synchronizeWithResourceModel();
+
+ /**
+ * Some non-trivial state in the JPA project has changed; update the
+ * parts of the context node that are dependent on yet other parts of the
+ * node's JPA project.
+ * If the dependent state changes also, yet another <em>update</em> will be
+ * triggered, possibly followed by yet more <em>updates</em>; until the JPA
+ * project's state quiesces.
+ */
+ void update();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java
new file mode 100644
index 0000000000..2ba2391fba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Named context node that may have collisions with or override other nodes
+ * with the same name defined elsewhere in the persistence unit
+ * (e.g. sequence generators).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JpaNamedContextNode<T>
+ extends JpaContextNode
+{
+ // ********** name **********
+
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+ void setName(String name);
+
+
+ // ********** validation **********
+
+ /**
+ * Return whether the node "overrides" the specified node
+ * within the nodes' persistence unit.
+ * (e.g. a query defined in <code>orm.xml</code>
+ * "overrides" one defined in a Java annotation).
+ *
+ * @see #duplicates(Object)
+ */
+ boolean overrides(T other);
+
+ /**
+ * Return whether the node is a "duplicate" of the specified node.
+ * Two nodes are duplicates if they both have the same,
+ * non-null name and neither node "overrides" the other.
+ *
+ * @see #overrides(Object)
+ */
+ boolean duplicates(T other);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java
new file mode 100644
index 0000000000..72f17ddf63
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.List;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Root of the Dali JPA context model.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JpaRootContextNode
+ extends JpaContextNode
+{
+
+ // ********** persistence.xml **********
+
+ /**
+ * String constant associated with changes to the persistence XML property
+ * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener)
+ */
+ public final static String PERSISTENCE_XML_PROPERTY = "persistenceXml"; //$NON-NLS-1$
+
+ /**
+ * Return the content represented by the <code>persistence.xml</code>
+ * file associated with the root context node's JPA project.
+ * This may be null.
+ */
+ PersistenceXml getPersistenceXml();
+
+
+ // ********** validation **********
+
+ /**
+ * Add validation messages to the specified list.
+ */
+ public void validate(List<IMessage> messages, IReporter reporter);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java
new file mode 100644
index 0000000000..61066cf693
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA LOB converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface LobConverter
+ extends Converter
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java
new file mode 100644
index 0000000000..3b98a83d02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011s Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA m:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface ManyToManyMapping
+ extends MultiRelationshipMapping
+{
+ ManyToManyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java
new file mode 100644
index 0000000000..2ec18c5fa8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * m:m relationship reference
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface ManyToManyRelationship
+ extends MappedByRelationship,
+ JoinTableRelationship,
+ MappingRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java
new file mode 100644
index 0000000000..41617e286f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA m:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface ManyToOneMapping
+ extends SingleRelationshipMapping
+{
+ ManyToOneRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java
new file mode 100644
index 0000000000..712f296a33
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * m:1 relationship (join column)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface ManyToOneRelationship
+ extends JoinColumnRelationship, MappingRelationship
+{
+ // nothing
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java
new file mode 100644
index 0000000000..09f610b7a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * "Mapped by" relationship<ul>
+ * <li>1:1
+ * <li>1:m
+ * <li>m:m
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface MappedByRelationship
+ extends Relationship
+{
+ /**
+ * Return the (never <code>null</code>) strategy used to configure
+ * the relationship's "mapped by" strategy.
+ */
+ MappedByRelationshipStrategy getMappedByStrategy();
+
+ /**
+ * Return whether the "mapped by" strategy is the
+ * relationship's current strategy.
+ */
+ boolean strategyIsMappedBy();
+
+ /**
+ * Set the relationship's strategy to the "mapped by" strategy.
+ */
+ void setStrategyToMappedBy();
+
+ /**
+ * Return whether the specified mapping may own the relationship.
+ */
+ boolean mayBeMappedBy(AttributeMapping mapping);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java
new file mode 100644
index 0000000000..525cece96b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+
+/**
+ * "Mapped by" relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see MappedByRelationship
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface MappedByRelationshipStrategy
+ extends RelationshipStrategy
+{
+ void initializeFrom(MappedByRelationshipStrategy oldStrategy);
+
+ /**
+ * String associated with changes to the attribute property of this object
+ */
+ String MAPPED_BY_ATTRIBUTE_PROPERTY = "mappedByAttribute"; //$NON-NLS-1$
+
+ /**
+ * Return the name of the attribute that maps the relationship.
+ */
+ String getMappedByAttribute();
+
+ /**
+ * Set the name of the attribute that maps the relationship.
+ */
+ void setMappedByAttribute(String attribute);
+
+ /**
+ * Return the possible attribute names the strategy might use.
+ */
+ Iterator<String> candidateMappedByAttributeNames();
+
+ /**
+ * Return whether this strategy's relationship is owned by the given other
+ * relationship mapping
+ */
+ boolean relationshipIsOwnedBy(RelationshipMapping otherMapping);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java
new file mode 100644
index 0000000000..6a60964bef
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * mapped superclass
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface MappedSuperclass
+ extends TypeMapping
+{
+ IdClassReference getIdClassReference();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java
new file mode 100644
index 0000000000..9d7ca2b09f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * JPA mapping file (typically <code>orm.xml</code>).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.1
+ */
+public interface MappingFile
+ extends XmlFile, PersistentTypeContainer
+{
+ /**
+ * Covariant override.
+ */
+ MappingFileRef getParent();
+
+ /**
+ * Return the mapping file's root.
+ * This can be null.
+ */
+ MappingFileRoot getRoot();
+
+ /**
+ * Return the specified persistent type if it is listed in the mapping file;
+ * otherwise return null.
+ */
+ PersistentType getPersistentType(String name);
+
+ /**
+ * Return true if this mapping file exists in the given folder
+ */
+ boolean isIn(IFolder folder);
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create DeleteEdits for deleting references (if any) to the type about to be deleted.
+ * Return an EmptyIterable if there are not any references to the given type.
+ */
+ Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java
new file mode 100644
index 0000000000..f32ec18b8d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Persistence unit defaults held by a mapping file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface MappingFilePersistenceUnitDefaults
+ extends XmlContextNode
+{
+ /**
+ * Covariant override.
+ */
+ MappingFilePersistenceUnitMetadata getParent();
+
+ /**
+ * Return the access type for all managed classes in the persistence unit,
+ * unless overridden by a local annotation or XML setting.
+ */
+ AccessType getAccess();
+
+ /**
+ * Return the catalog for all database objects referenced in the
+ * persistence unit, unless overridden by a local annotation or XML setting.
+ * <p>
+ * Return the specified catalog if present, otherwise return the
+ * default catalog as determined by the database connection.
+ */
+ String getCatalog();
+
+ /**
+ * Return the schema for all database objects referenced in the
+ * persistence unit, unless overridden by a local annotation or XML setting.
+ * <p>
+ * Return the specified schema if present, otherwise return the
+ * default schema as determined by the database connection.
+ */
+ String getSchema();
+
+ /**
+ * Return all the relationhips in the persistence unit are to be cascade
+ * persist, unless overridden by a local annotation or XML setting.
+ */
+ boolean isCascadePersist();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java
new file mode 100644
index 0000000000..1313b66fbe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Persistence unit metadata held by a mapping file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface MappingFilePersistenceUnitMetadata
+ extends XmlContextNode
+{
+ /**
+ * Covariant override.
+ */
+ MappingFileRoot getParent();
+
+ /**
+ * Return whether any annotations on the persistent types associated with
+ * the mapping file's persistence unit are to be ignored.
+ */
+ boolean isXmlMappingMetadataComplete();
+
+ /**
+ * Return the persistence unit defaults held by the mapping file.
+ */
+ MappingFilePersistenceUnitDefaults getPersistenceUnitDefaults();
+
+ /**
+ * Return whether the mapping file's underlying resource exists.
+ * If there is a node in the <code>orm.xml</code> file for the
+ * {@code <persistence-unit-metadata>} element,
+ * return <code>true</code>; otherwise <code>false</code>.
+ */
+ boolean resourceExists();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java
new file mode 100644
index 0000000000..657c618834
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+
+/**
+ * The root of a JPA mapping file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface MappingFileRoot
+ extends XmlContextNode, JpaStructureNode
+{
+ /**
+ * covariant override
+ */
+ MappingFile getParent();
+
+ /**
+ * Return the specified access if present, otherwise return the default
+ * access.
+ */
+ AccessType getAccess();
+
+ /**
+ * Return the specified catalog if present, otherwise return the default
+ * catalog.
+ */
+ String getCatalog();
+
+ /**
+ * Return the specified schema if present, otherwise return the default
+ * schema.
+ */
+ String getSchema();
+
+ /**
+ * Return the metadata defined within the mapping file
+ * <em>for the persistence unit</em>.
+ * Return <code>null</code> if none exists.
+ *
+ * @see MappingFilePersistenceUnitMetadata#resourceExists()
+ */
+ MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java
new file mode 100644
index 0000000000..b3000326b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Mapping relationship<ul>
+ * <li>1:1
+ * <li>1:m
+ * <li>m:1
+ * <li>m:m
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface MappingRelationship
+ extends Relationship
+{
+ /**
+ * Return whether the relationship's mapping is the relationship owner.
+ * @see RelationshipMapping#isRelationshipOwner()
+ */
+ boolean isOwner();
+
+ /**
+ * Return whether the specified mapping owns the relationship.
+ * @see RelationshipMapping#isOwnedBy(AttributeMapping)
+ */
+ boolean isOwnedBy(RelationshipMapping mapping);
+
+ /**
+ * Return whether the relationship's mapping is a target foreign key
+ * relationship.
+ * A one-to-many mapping with a join column will have the foreign key
+ * in the target table.
+ */
+ boolean isTargetForeignKey();
+
+ /**
+ * Return whether the relationship's mapping can be overridden with an
+ * association override.
+ */
+ boolean isOverridable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java
new file mode 100644
index 0000000000..a7351fc176
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Multi-valued (1:m, m:m) relationship mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface MultiRelationshipMapping
+ extends RelationshipMapping, CollectionMapping
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java
new file mode 100644
index 0000000000..ffeef1b9c4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Specified
+ * <ul>
+ * <li>column
+ * <li>join column
+ * <li>primary key join column
+ * <li>discriminator column
+ * <li>order column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface NamedColumn
+ extends ReadOnlyNamedColumn
+{
+ void setSpecifiedName(String name);
+
+ void setColumnDefinition(String columnDefinition);
+
+
+ // ********** database stuff **********
+
+ /**
+ * Return the wrapper for the datasource table
+ */
+ Table getDbTable();
+
+ /**
+ * Return whether the column is found on the datasource.
+ */
+ boolean isResolved();
+
+
+ // ********** owner **********
+
+ /**
+ * Interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides).
+ */
+ interface Owner
+ extends ReadOnlyNamedColumn.Owner
+ {
+ /**
+ * Return the database table for the specified table name.
+ */
+ Table resolveDbTable(String tableName);
+
+ JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java
new file mode 100644
index 0000000000..beba80ec44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * named native query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface NamedNativeQuery
+ extends Query
+{
+ // ********** result class **********
+
+ String getResultClass();
+ void setResultClass(String value);
+ String RESULT_CLASS_PROPERTY = "resultClass"; //$NON-NLS-1$
+
+ /**
+ * Return the character to be used for browsing or
+ * creating the result class {@link org.eclipse.jdt.core.IType IType}.
+ * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
+ */
+ char getResultClassEnclosingTypeSeparator();
+
+
+ // ********** result set mapping **********
+
+ String getResultSetMapping();
+ void setResultSetMapping(String value);
+ String RESULT_SET_MAPPING_PROPERTY = "resultSetMapping"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java
new file mode 100644
index 0000000000..92ac55e44f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * named query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface NamedQuery
+ extends Query
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java
new file mode 100644
index 0000000000..b68338b4bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA 1:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OneToManyMapping
+ extends MultiRelationshipMapping
+{
+ OneToManyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java
new file mode 100644
index 0000000000..3d7d40dc43
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * 1:m relationship (mapped by, join table)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OneToManyRelationship
+ extends MappedByRelationship,
+ JoinTableRelationship,
+ MappingRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java
new file mode 100644
index 0000000000..a6595c346c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA 1:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OneToOneMapping
+ extends SingleRelationshipMapping
+{
+ OneToOneRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java
new file mode 100644
index 0000000000..a3c5019619
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * 1:1 relationship (mapped by, join column, primary key join column)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OneToOneRelationship
+ extends MappedByRelationship,
+ JoinColumnRelationship,
+ PrimaryKeyJoinColumnRelationship,
+ MappingRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java
new file mode 100644
index 0000000000..0707763858
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA attribute mapping that is optional (e.g. basic, single relationship).
+ * From the JPA spec:
+ * <pre>
+ * 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.
+ * </pre>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OptionalMapping
+ extends AttributeMapping
+{
+ boolean isOptional();
+
+ boolean isDefaultOptional();
+ String DEFAULT_OPTIONAL_PROPERTY = "defaultOptional"; //$NON-NLS-1$
+ boolean DEFAULT_OPTIONAL = true;
+
+ Boolean getSpecifiedOptional();
+ void setSpecifiedOptional(Boolean newSpecifiedOptional);
+ String SPECIFIED_OPTIONAL_PROPERTY = "specifiedOptional"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java
new file mode 100644
index 0000000000..8f2ab3c07f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Multi-valued (1:m, m:m) relationship mappings support ordering.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface Orderable
+ extends JpaContextNode
+{
+ AttributeMapping getParent();
+
+ String getSpecifiedOrderBy();
+ void setSpecifiedOrderBy(String orderBy);
+ String SPECIFIED_ORDER_BY_PROPERTY = "specifiedOrderBy"; //$NON-NLS-1$
+
+ boolean isNoOrdering();
+ void setNoOrdering(boolean noOrdering);
+ String NO_ORDERING_PROPERTY = "noOrdering"; //$NON-NLS-1$
+
+ boolean isPkOrdering();
+ void setPkOrdering(boolean pkOrdering);
+ String PK_ORDERING_PROPERTY = "pkOrdering"; //$NON-NLS-1$
+
+ boolean isCustomOrdering();
+ void setCustomOrdering(boolean customOrdering);
+ String CUSTOM_ORDERING_PROPERTY = "customOrdering"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java
new file mode 100644
index 0000000000..d01155645d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * attribute or association override container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.3
+ */
+public interface OverrideContainer
+ extends JpaContextNode
+{
+ /**
+ * Return the type mapping that this override is contained in
+ */
+ TypeMapping getTypeMapping();
+
+ /**
+ * Return the type mapping that contains the attributes/associations to
+ * be overridden. (Though the type mapping may not <em>directly</em>
+ * own them (i.e. they may be on a supertype mapping).
+ * (For example: for an entity, this would be the supertype mapping of
+ * that entity; for an embedded, this would be the target type mapping
+ * of the embedded.)
+ */
+ TypeMapping getOverridableTypeMapping();
+
+ /**
+ * Return the names of all attributes that can be overridden
+ */
+ Iterator<String> allOverridableNames();
+
+ /**
+ * Convert the specified specified override to <em>virtual</em>.
+ * Return the new override.
+ */
+ VirtualOverride convertOverrideToVirtual(Override_ specifiedOverride);
+
+ /**
+ * Convert the specified virtual override to <em>specified</em>.
+ * Return the new override.
+ */
+ Override_ convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+ /**
+ * return whether the given table cannot be explicitly specified
+ * in the column or join column's 'table' element
+ */
+ boolean tableNameIsInvalid(String tableName);
+
+ /**
+ * Return the names of tables that are valid for the overrides column or join columns.
+ */
+ Iterator<String> candidateTableNames();
+
+ /**
+ * Return the database table for the specified table name
+ */
+ Table resolveDbTable(String tableName);
+
+ /**
+ * Return the name of the table which the column belongs to by default
+ */
+ String getDefaultTableName();
+
+ JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildValidator(Override_ override, OverrideTextRangeResolver textRangeResolver);
+
+
+ // ********** overrides **********
+
+ /**
+ * Return the overrides, both specified and virtual.
+ */
+ // TODO bjv change to a collection?
+ ListIterator<? extends ReadOnlyOverride> overrides();
+
+ /**
+ * Return the number of overrides, both specified and default.
+ */
+ int overridesSize();
+
+ /**
+ * Return the override with the specified name,
+ * whether specified or virtual.
+ */
+ // TODO look into getting rid of this;
+ // we should probably use #getSpecifiedOverrideNamed(String)
+ ReadOnlyOverride getOverrideNamed(String name);
+
+
+ // ********** specified overrides **********
+
+ /**
+ * Return the specified overrides.
+ * No add/remove for specified overrides, the
+ * virtual overrides will be populated from the owner, then use
+ * {@link VirtualOverride#convertToSpecified()} to add/remove the
+ * override from the container.
+ */
+ ListIterator<? extends Override_> specifiedOverrides();
+ String SPECIFIED_OVERRIDES_LIST = "specifiedOverrides"; //$NON-NLS-1$
+
+ /**
+ * Return the number of specified overrides.
+ */
+ int specifiedOverridesSize();
+
+ /**
+ * Return the specified override at the specified index.
+ */
+ Override_ getSpecifiedOverride(int index);
+
+ /**
+ * Move the specified override from the source index to the target index.
+ */
+ void moveSpecifiedOverride(int targetIndex, int sourceIndex);
+
+ Override_ getSpecifiedOverrideNamed(String name);
+
+
+ // ********** virtual overrides **********
+
+ /**
+ * Return the virtual overrides, those not specified.
+ */
+ // TODO change to a collection?
+ ListIterator<? extends VirtualOverride> virtualOverrides();
+ String VIRTUAL_OVERRIDES_LIST = "virtualOverrides"; //$NON-NLS-1$
+
+ /**
+ * Return the number of virtual overrides.
+ */
+ int virtualOverridesSize();
+
+
+ // ********** owner **********
+
+ interface Owner
+ {
+ /**
+ * Return the mapping of the persistent type where the container is defined.
+ * (For example: for an entity, this would be the entity; for an embedded,
+ * this would be the type mapping where the embedded is defined.)
+ */
+ TypeMapping getTypeMapping();
+
+ /**
+ * Return the type mapping that contains the attributes/associations to
+ * be overridden. (Though the type mapping may not <em>directly</em>
+ * own them (i.e. they may be on a supertype mapping).
+ * (For example: for an entity, this would be the supertype mapping of
+ * that entity; for an embedded, this would be the target type mapping
+ * of the embedded.)
+ */
+ TypeMapping getOverridableTypeMapping();
+
+ /**
+ * Return all the names of the attributes/associations to be overridden.
+ * This is usually just all of the overridable names of the overridable
+ * type mapping.
+ * @see #getOverridableTypeMapping()
+ */
+ Iterator<String> allOverridableNames();
+
+ /**
+ * Return the name of an override column's/join column's default table.
+ */
+ String getDefaultTableName();
+
+ /**
+ * Return whether the specified table cannot be explicitly specified
+ * by a column/join column.
+ */
+ boolean tableNameIsInvalid(String tableName);
+
+ /**
+ * Return the database table for the specified table name.
+ */
+ org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName);
+
+ /**
+ * Return the table names that are valid for the override's column
+ * or join columns
+ */
+ Iterator<String> candidateTableNames();
+
+ JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver);
+
+ JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java
new file mode 100644
index 0000000000..f826819245
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see AssociationOverride
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OverrideRelationship
+ extends ReadOnlyOverrideRelationship,
+ JoinColumnRelationship
+{
+ AssociationOverride getAssociationOverride();
+
+ void initializeFromVirtual(ReadOnlyOverrideRelationship virtualRelationship);
+
+ void initializeFromVirtualJoinColumnRelationship(ReadOnlyJoinColumnRelationship virtualRelationship);
+
+ void initializeFromVirtualJoinTableRelationship(ReadOnlyJoinTableRelationship virtualRelationship);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java
new file mode 100644
index 0000000000..d4da2d94d6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * <ul>
+ * <li>attribute override
+ * <li>association override
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+// the class name "Override" is sorta taken: java.lang.Override
+// maybe if it weren't in the java.lang package we would take it on, but... :)
+public interface Override_
+ extends ReadOnlyOverride
+{
+ void setName(String value);
+
+ /**
+ * Convert the override to a virtual override.
+ * Return the new override.
+ * @see #isVirtual()
+ */
+ VirtualOverride convertToVirtual();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java
new file mode 100644
index 0000000000..930aa0142f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Context persistent <em>attribute</em> (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface PersistentAttribute
+ extends ReadOnlyPersistentAttribute, AccessHolder
+{
+ /**
+ * Set the attribute's mapping.
+ * If the specified key is <code>null</code>, clear the specified mapping,
+ * allowing the attribute's mapping to default (if appropriate).
+ * Return the new mapping (which may be a <em>null</em> mapping).
+ */
+ AttributeMapping setMappingKey(String key);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java
new file mode 100644
index 0000000000..a77d422449
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Context persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface PersistentType
+ extends JpaContextNode, JpaStructureNode, AccessHolder
+{
+ // ********** name **********
+
+ /**
+ * Return the persistent type's [fully-qualified] name.
+ * The enclosing type separator is <code>'.'</code>,
+ * as opposed to <code>'$'</code>.
+ * @see #getSimpleName()
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Return the persistent type's simple name.
+ * @see #getName()
+ */
+ String getSimpleName();
+
+
+ // ********** mapping **********
+
+ /**
+ * Return the persistent type's mapping.
+ * Set the mapping via {@link #setMappingKey(String)}.
+ */
+ TypeMapping getMapping();
+ String MAPPING_PROPERTY = "mapping"; //$NON-NLS-1$
+
+ String getMappingKey();
+
+ void setMappingKey(String key);
+
+ boolean isMapped();
+
+
+ // ********** attributes **********
+
+ /**
+ * Return the persistent type's persistent attributes.
+ */
+ <T extends ReadOnlyPersistentAttribute> ListIterator<T> attributes();
+
+ /**
+ * Return the number of the persistent type's persistent attributes.
+ */
+ int attributesSize();
+
+ /**
+ * Return the names of the persistent type's persistent attributes.
+ */
+ Iterator<String> attributeNames();
+
+ /**
+ * Return all the persistent attributes in the persistent type's
+ * inheritance hierarchy.
+ */
+ Iterator<ReadOnlyPersistentAttribute> allAttributes();
+
+ /**
+ * Return the names of all the persistent attributes in the
+ * persistent type's hierarchy.
+ */
+ Iterator<String> allAttributeNames();
+
+ /**
+ * Return the persistent attribute with the specified name,
+ * if it exists locally on the persistent type (as opposed to in its
+ * inheritance hierarchy).
+ */
+ ReadOnlyPersistentAttribute getAttributeNamed(String attributeName);
+
+ /**
+ * Resolve and return the persistent attribute with the specified name, if it
+ * is distinct and exists within the context of the persistent type.
+ */
+ ReadOnlyPersistentAttribute resolveAttribute(String attributeName);
+
+
+ // ********** inheritance **********
+
+ /**
+ * Return the "super" {@link PersistentType} from the "persistence"
+ * inheritance hierarchy.
+ * If the Java inheritance parent is not a {@link PersistentType}, then continue
+ * up the hierarchy (the JPA spec allows non-persistent types to be part of the hierarchy.)
+ * Return <code>null</code> if the persistent type is the root persistent type.
+ * <p>
+ * Example:
+ * <pre>
+ * &#64;Entity
+ * public abstract class Model {}
+ *
+ * public abstract class Animal extends Model {}
+ *
+ * &#64;Entity
+ * public class Cat extends Animal {}
+ * </pre>
+ * The "super" persistent type of the <code>Cat</code> persistent type is
+ * the <code>Model</code> persistent type. The "super" persistent type can
+ * be either a Java annotated class or declared in the XML files.
+ */
+ PersistentType getSuperPersistentType();
+ String SUPER_PERSISTENT_TYPE_PROPERTY = "superPersistentType"; //$NON-NLS-1$
+
+ /**
+ * Return the persistent type's "persistence" inheritance hierarchy,
+ * <em>including</em> the persistent type itself.
+ * The returned iterator will return elements infinitely if the hierarchy
+ * has a loop.
+ */
+ Iterator<PersistentType> inheritanceHierarchy();
+
+ /**
+ * Return the persistent type's "persistence" inheritance hierarchy,
+ * <em>excluding</em> the persistent type itself.
+ * The returned iterator will return elements infinitely if the hierarchy
+ * has a loop.
+ */
+ Iterator<PersistentType> ancestors();
+
+
+ // ********** validation **********
+
+ /**
+ * Add to the list of current validation messages
+ */
+ void validate(List<IMessage> messages, IReporter reporter);
+
+
+ // ********** misc **********
+
+ /**
+ * Return whether the persistent type applies to the
+ * specified type name qualified with '.'.
+ */
+ boolean isFor(String typeName);
+
+ /**
+ * Return true if persistent type resolves to a java class in the given package fragment
+ */
+ boolean isIn(IPackageFragment packageFragment);
+
+
+ // ********** owner **********
+
+ /**
+ * Return the access type that overrides the client persistent type's
+ * access type; <code>null</code> if there is no such access override.
+ */
+ AccessType getOwnerOverrideAccess();
+
+ /**
+ * Return the client persistent type's default access type;
+ * <code>null</code> if there is no such access default.
+ */
+ AccessType getOwnerDefaultAccess();
+
+
+ // ********** owner interface **********
+
+ interface Owner
+ extends JpaContextNode
+ {
+ /**
+ * Return the access type that overrides the client persistent type's
+ * access type; <code>null</code> if there is no such access override
+ */
+ AccessType getOverridePersistentTypeAccess();
+
+ /**
+ * Return the client persistent type's default access type;
+ * <code>null</code> if there is no such access default.
+ */
+ AccessType getDefaultPersistentTypeAccess();
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..a573c26ee5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface PrimaryKeyJoinColumn
+ extends BaseJoinColumn, ReadOnlyPrimaryKeyJoinColumn
+{
+ // combine interfaces
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java
new file mode 100644
index 0000000000..5fbedec03c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Primary key join column relationship<ul>
+ * <li>1:1
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface PrimaryKeyJoinColumnRelationship
+ extends Relationship
+{
+ /**
+ * Return the (never <code>null</code>) strategy used to configure
+ * the relationship's primary key join column strategy.
+ */
+ PrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy();
+
+ /**
+ * Return whether the primary key join column strategy is the
+ * relationship's current strategy.
+ */
+ boolean strategyIsPrimaryKeyJoinColumn();
+
+ /**
+ * Set the relationship's strategy to the primary key join column strategy.
+ */
+ void setStrategyToPrimaryKeyJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..0fe8328ec8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Primary key join column relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see PrimaryKeyJoinColumnRelationship
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface PrimaryKeyJoinColumnRelationshipStrategy
+ extends RelationshipStrategy
+{
+ /**
+ * Change notification identifier for "primaryKeyJoinColumns" list
+ */
+ String PRIMARY_KEY_JOIN_COLUMNS_LIST = "primaryKeyJoinColumns"; //$NON-NLS-1$
+
+ /**
+ * Return the strategy's primary key join columns.
+ */
+ ListIterator<? extends PrimaryKeyJoinColumn> primaryKeyJoinColumns();
+
+ /**
+ * Return the number of primary key join columns.
+ */
+ int primaryKeyJoinColumnsSize();
+
+ /**
+ * Return whether the relationship has any primary key join columns.
+ * (Equivalent to {@link #primaryKeyJoinColumnsSize()} == 0.)
+ */
+ boolean hasPrimaryKeyJoinColumns();
+
+ /**
+ * Return the primary key join column at the specified index.
+ */
+ PrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index);
+
+ /**
+ * Add a primary key join column.
+ */
+ PrimaryKeyJoinColumn addPrimaryKeyJoinColumn();
+
+ /**
+ * Add a primary key join column.
+ */
+ PrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index);
+
+ /**
+ * Remove the specified primary key join column.
+ */
+ void removePrimaryKeyJoinColumn(int index);
+
+ /**
+ * Remove the specified primary key join column.
+ */
+ void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn);
+
+ /**
+ * Remove the specified primary key join column.
+ */
+ void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java
new file mode 100644
index 0000000000..cbf49207e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Arrays;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
+
+/**
+ * named and named native queries
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface Query
+ extends JpaNamedContextNode<Query>
+{
+ /**
+ * TODO use this precedence until adopters protest...
+ * then move to JpaPlatform
+ */
+ @SuppressWarnings("unchecked")
+ Iterable<Class<? extends Query>> PRECEDENCE_TYPE_LIST = Arrays.asList(
+ OrmQuery.class,
+ JavaQuery.class
+ );
+
+
+ // ********** query **********
+
+ String QUERY_PROPERTY = "query"; //$NON-NLS-1$
+
+ String getQuery();
+
+ void setQuery(String query);
+
+
+ // ********** hints **********
+
+ String HINTS_LIST = "hints"; //$NON-NLS-1$
+
+ /**
+ * Return the query's hints.
+ */
+ <T extends QueryHint> ListIterable<T> getHints();
+
+ /**
+ * Return the number of hints.
+ */
+ int getHintsSize();
+
+ /**
+ * Add a hint to the query and return the object representing it.
+ */
+ QueryHint addHint();
+
+ /**
+ * Add a hint to the query and return the object representing it.
+ */
+ QueryHint addHint(int index);
+
+ /**
+ * Remove the hint at the index from the query.
+ */
+ void removeHint(QueryHint queryHint);
+
+ /**
+ * Remove the hint from the query.
+ */
+ void removeHint(int index);
+
+ /**
+ * Move the hint from the source index to the target index.
+ */
+ void moveHint(int targetIndex, int sourceIndex);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java
new file mode 100644
index 0000000000..681b93fa9c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Container for named queries and/or named native queries.
+ * Used by entities and the <code>orm.xml</code>
+ * </code>entity-mappings</code> element.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface QueryContainer
+ extends JpaContextNode
+{
+ // ********** named queries **********
+
+ /**
+ * Return the container's named queries.
+ */
+ <T extends NamedQuery> ListIterator<T> namedQueries();
+
+ String NAMED_QUERIES_LIST = "namedQueries"; //$NON-NLS-1$
+
+ /**
+ * Return the number of named queries.
+ */
+ int namedQueriesSize();
+
+ /**
+ * Add a new named query to the container and return it.
+ */
+ NamedQuery addNamedQuery();
+
+ /**
+ * Add a new named query to the container at the specified index
+ * and return it.
+ */
+ NamedQuery addNamedQuery(int index);
+
+ /**
+ * Remove from the container the named query at the specified index.
+ */
+ void removeNamedQuery(int index);
+
+ /**
+ * Remove the specified named query from the container.
+ */
+ void removeNamedQuery(NamedQuery namedQuery);
+
+ /**
+ * Move a named query as specified.
+ */
+ void moveNamedQuery(int targetIndex, int sourceIndex);
+
+
+ // ********** named native queries **********
+
+ /**
+ * Return the container's named native queries.
+ */
+ <T extends NamedNativeQuery> ListIterator<T> namedNativeQueries();
+
+ String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueries"; //$NON-NLS-1$
+
+ /**
+ * Return the number of named native queries.
+ */
+ int namedNativeQueriesSize();
+
+ /**
+ * Add a new named native query to the container and return it.
+ */
+ NamedNativeQuery addNamedNativeQuery();
+
+ /**
+ * Add a new named native query to the container at the specified index
+ * and return it.
+ */
+ NamedNativeQuery addNamedNativeQuery(int index);
+
+ /**
+ * Remove from the container the named native query at the specified index.
+ */
+ void removeNamedNativeQuery(int index);
+
+ /**
+ * Remove the specified named native query from the container.
+ */
+ void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery);
+
+ /**
+ * Move a named native query as specified.
+ */
+ void moveNamedNativeQuery(int targetIndex, int sourceIndex);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java
new file mode 100644
index 0000000000..6deee9ec1b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * query hint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface QueryHint
+ extends JpaContextNode
+{
+ String getName();
+ void setName(String name);
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ String getValue();
+ void setValue(String value);
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java
new file mode 100644
index 0000000000..3cc216ecad
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.common.utility.model.Model;
+
+/**
+ * Common interface that can be used by clients interested only in a type
+ * or attribute's access setting (e.g. a UI composite).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface ReadOnlyAccessHolder
+ extends Model
+{
+ /**
+ * Return the access type, whether specified or defaulted.
+ * This should never return <code>null</code> since at least the default
+ * will be set.
+ */
+ AccessType getAccess();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java
new file mode 100644
index 0000000000..a2956964d5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyAssociationOverride
+ extends ReadOnlyOverride
+{
+ AssociationOverrideContainer getContainer();
+
+ RelationshipMapping getMapping();
+
+ ReadOnlyOverrideRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java
new file mode 100644
index 0000000000..c82fa690fd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only attribute override.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyAttributeOverride
+ extends ReadOnlyOverride
+{
+ AttributeOverrideContainer getContainer();
+
+ ReadOnlyColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java
new file mode 100644
index 0000000000..c4bf083c72
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+
+/**
+ * Read-only
+ * <ul>
+ * <li>column
+ * <li>join column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyBaseColumn
+ extends ReadOnlyNamedColumn
+{
+ // ********** table **********
+
+ String getSpecifiedTable();
+ String SPECIFIED_TABLE_PROPERTY = "specifiedTable"; //$NON-NLS-1$
+ String getDefaultTable();
+ String DEFAULT_TABLE_PROPERTY = "defaultTable"; //$NON-NLS-1$
+
+
+ // ********** unique **********
+
+ /**
+ * Return the specified unique setting if present, otherwise return the
+ * default unique setting.
+ */
+ boolean isUnique();
+ Boolean getSpecifiedUnique();
+ String SPECIFIED_UNIQUE_PROPERTY = "specifiedUnique"; //$NON-NLS-1$
+ boolean isDefaultUnique();
+ String DEFAULT_UNIQUE_PROPERTY = "defaultUnique"; //$NON-NLS-1$
+ boolean DEFAULT_UNIQUE = false;
+
+
+ // ********** nullable **********
+
+ /**
+ * Return the specified nullable setting if present, otherwise return the
+ * default nullable setting.
+ */
+ boolean isNullable();
+ Boolean getSpecifiedNullable();
+ String SPECIFIED_NULLABLE_PROPERTY = "specifiedNullable"; //$NON-NLS-1$
+ boolean isDefaultNullable();
+ String DEFAULT_NULLABLE_PROPERTY = "defaultNullable"; //$NON-NLS-1$
+ boolean DEFAULT_NULLABLE = true;
+
+
+ // ********** insertable **********
+
+ /**
+ * Return the specified insertable setting if present, otherwise return the
+ * default insertable setting.
+ */
+ boolean isInsertable();
+ Boolean getSpecifiedInsertable();
+ String SPECIFIED_INSERTABLE_PROPERTY = "specifiedInsertable"; //$NON-NLS-1$
+ boolean isDefaultInsertable();
+ String DEFAULT_INSERTABLE_PROPERTY = "defaultInsertable"; //$NON-NLS-1$
+ boolean DEFAULT_INSERTABLE = true;
+
+
+ // ********** updatable **********
+
+ /**
+ * Return the specified updatable setting if present, otherwise return the
+ * default updatable setting.
+ */
+ boolean isUpdatable();
+ Boolean getSpecifiedUpdatable();
+ String SPECIFIED_UPDATABLE_PROPERTY = "specifiedUpdatable"; //$NON-NLS-1$
+ boolean isDefaultUpdatable();
+ String DEFAULT_UPDATABLE_PROPERTY = "defaultUpdatable"; //$NON-NLS-1$
+ boolean DEFAULT_UPDATABLE = true;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java
new file mode 100644
index 0000000000..41608b1a68
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only
+ * <ul>
+ * <li>join column
+ * <li>primary key join column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyBaseJoinColumn
+ extends ReadOnlyNamedColumn
+{
+ // ********** referenced column name **********
+
+ /**
+ * Return the specified referenced column name if present,
+ * otherwise return the default referenced column name.
+ */
+ String getReferencedColumnName();
+ String getSpecifiedReferencedColumnName();
+ String SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY = "specifiedReferencedColumnName"; //$NON-NLS-1$
+ String getDefaultReferencedColumnName();
+ String DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY = "defaultReferencedColumnName"; //$NON-NLS-1$
+
+
+ // ********** misc **********
+
+ boolean isDefault();
+
+
+ // ********** owner **********
+
+ /**
+ * Interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides).
+ */
+ interface Owner
+ extends ReadOnlyNamedColumn.Owner
+ {
+ boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn);
+
+ /**
+ * Return the number of join columns in the owner's list the join
+ * column belongs to.
+ */
+ int joinColumnsSize();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java
new file mode 100644
index 0000000000..1ea60e1b64
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyColumn
+ extends ReadOnlyBaseColumn
+{
+ // ********** length **********
+
+ /**
+ * Return the specified length if present, otherwise return the default length.
+ */
+ int getLength();
+ Integer getSpecifiedLength();
+ String SPECIFIED_LENGTH_PROPERTY = "specifiedLength"; //$NON-NLS-1$
+ int getDefaultLength();
+ String DEFAULT_LENGTH_PROPERTY = "defaultLength"; //$NON-NLS-1$
+ int DEFAULT_LENGTH = 255;
+
+
+ // ********** precision **********
+
+ /**
+ * Return the specified precision if present, otherwise return the default precision.
+ */
+ int getPrecision();
+ Integer getSpecifiedPrecision();
+ String SPECIFIED_PRECISION_PROPERTY = "specifiedPrecision"; //$NON-NLS-1$
+ int getDefaultPrecision();
+ String DEFAULT_PRECISION_PROPERTY = "defaultPrecision"; //$NON-NLS-1$
+ int DEFAULT_PRECISION = 0;
+
+
+ // ********** scale **********
+
+ /**
+ * Return the specified scale if present, otherwise return the default scale.
+ */
+ int getScale();
+ Integer getSpecifiedScale();
+ String SPECIFIED_SCALE_PROPERTY = "specifiedScale"; //$NON-NLS-1$
+ int getDefaultScale();
+ String DEFAULT_SCALE_PROPERTY = "defaultScale"; //$NON-NLS-1$
+ int DEFAULT_SCALE = 0;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java
new file mode 100644
index 0000000000..170cffca0f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyJoinColumn
+ extends ReadOnlyBaseJoinColumn, ReadOnlyBaseColumn
+{
+ /**
+ * Interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides).
+ */
+ interface Owner
+ extends ReadOnlyBaseJoinColumn.Owner
+ // ReadOnlyBaseColumn does not define an Owner
+ {
+ /**
+ * The target of the relationship will usually be the target entity.
+ * In the case of a target foreign key relationship the source and target
+ * are swapped.
+ */
+ Entity getRelationshipTarget();
+
+ /**
+ * return the join column's attribute name
+ */
+ String getAttributeName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java
new file mode 100644
index 0000000000..bce23660f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Join column relationship<ul>
+ * <li>1:1
+ * <li>1:m
+ * <li>m:1
+ * <li>association override
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see Relationship
+ * @see JoinColumn
+ */
+public interface ReadOnlyJoinColumnRelationship
+ extends ReadOnlyRelationship
+{
+ /**
+ * Return the (never <code>null</code>) strategy used to configure
+ * the relationship's join column strategy.
+ */
+ ReadOnlyJoinColumnRelationshipStrategy getJoinColumnStrategy();
+
+ /**
+ * Return whether the join column strategy is the
+ * relationship's current strategy.
+ */
+ boolean strategyIsJoinColumn();
+
+ /**
+ * Return whether this relationship may potentially have a default join
+ * column. For example, a 1-1 mapping may have a default join column
+ * if it does not specify a "mapped by" attribute or a join table;
+ * but a 1-M mapping does not support a default join column in any
+ * situation.
+ */
+ boolean mayHaveDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..287e821fab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+
+/**
+ * Read-only join column relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see ReadOnlyAssociationOverride
+ * @see JoinColumnRelationship
+ */
+public interface ReadOnlyJoinColumnRelationshipStrategy
+ extends ReadOnlyRelationshipStrategy
+{
+ /**
+ * The source of the relationship is usually the owning type mapping.
+ * In the case of a target foreign key relationship the source and target
+ * are swapped.
+ * @see #isTargetForeignKey()
+ */
+ TypeMapping getRelationshipSource();
+
+ /**
+ * The target of the relationship usually is the target entity.
+ * In the case of a target foreign key relationship the source and target
+ * are swapped.
+ * @see #isTargetForeignKey()
+ */
+ TypeMapping getRelationshipTarget();
+
+ /**
+ * Return whether this relationship is a target foreign key relationship.
+ * A one-to-many mapping with a join column will have the foreign key
+ * in the target table.
+ */
+ boolean isTargetForeignKey();
+
+
+ // ********** join columns **********
+
+ /**
+ * Return the join columns whether specified or default.
+ */
+ ListIterator<? extends ReadOnlyJoinColumn> joinColumns();
+
+ /**
+ * Return the number of join columns, whether specified and default.
+ */
+ int joinColumnsSize();
+
+
+ // ********** specified join columns **********
+
+ /**
+ * Change notification identifier for "specifiedJoinColumns" list
+ */
+ String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumns"; //$NON-NLS-1$
+
+ /**
+ * Return the specified join columns.
+ */
+ ListIterator<? extends ReadOnlyJoinColumn> specifiedJoinColumns();
+
+ /**
+ * Return the number of specified join columns.
+ */
+ int specifiedJoinColumnsSize();
+
+ /**
+ * Return whether the strategy has any specified join columns.
+ * (Equivalent to {@link #specifiedJoinColumnsSize()} != 0.)
+ */
+ boolean hasSpecifiedJoinColumns();
+
+ /**
+ * Return the specified join column at the specified index.
+ */
+ ReadOnlyJoinColumn getSpecifiedJoinColumn(int index);
+
+
+ // ********** default join column **********
+
+ /**
+ * Change notification identifier for "defaultJoinColumn" property
+ */
+ String DEFAULT_JOIN_COLUMN_PROPERTY = "defaultJoinColumn"; //$NON-NLS-1$
+
+ /**
+ * Return the default join column. If there are specified join
+ * columns, there is no default join column. There are also
+ * times that there may be no default join column even if there are no
+ * specified join columns.
+ */
+ ReadOnlyJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java
new file mode 100644
index 0000000000..838d16c904
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Used by association overrides.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyJoinTable
+ extends ReadOnlyReferenceTable
+{
+ ReadOnlyJoinTableRelationshipStrategy getParent();
+
+ RelationshipMapping getRelationshipMapping();
+
+
+ // ********** inverse join columns **********
+
+ /**
+ * Return the join table's inverse join columns, whether specified or default.
+ */
+ ListIterator<? extends ReadOnlyJoinColumn> inverseJoinColumns();
+
+ /**
+ * Return the number of inverse join columns, whether specified or default.
+ */
+ int inverseJoinColumnsSize();
+
+ /**
+ * Return the specified inverse join columns.
+ */
+ ListIterator<? extends ReadOnlyJoinColumn> specifiedInverseJoinColumns();
+ String SPECIFIED_INVERSE_JOIN_COLUMNS_LIST = "specifiedInverseJoinColumns"; //$NON-NLS-1$
+
+ /**
+ * Return the number of specified inverse join columns.
+ */
+ int specifiedInverseJoinColumnsSize();
+
+ /**
+ * Return whether the join table has specified inverse join columns.
+ */
+ boolean hasSpecifiedInverseJoinColumns();
+
+ /**
+ * Return the specified inverse join column at the specified index.
+ */
+ ReadOnlyJoinColumn getSpecifiedInverseJoinColumn(int index);
+
+ /**
+ * Return the default inverse join column or null. A default inverse join column
+ * only exists if there are no specified inverse join columns.
+ */
+ ReadOnlyJoinColumn getDefaultInverseJoinColumn();
+ String DEFAULT_INVERSE_JOIN_COLUMN = "defaultInverseJoinColumn"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java
new file mode 100644
index 0000000000..5e09f3e852
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Join table relationship<ul>
+ * <li>1:1 (JPA 2.0)
+ * <li>1:m
+ * <li>m:1 (JPA 2.0)
+ * <li>m:m
+ * <li>association override (JPA 2.0)
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyJoinTableRelationship
+ extends ReadOnlyRelationship
+{
+ /**
+ * Return the (never <code>null</code>) strategy used to configure
+ * the relationship's join table strategy.
+ */
+ ReadOnlyJoinTableRelationshipStrategy getJoinTableStrategy();
+
+ /**
+ * Return whether the join table strategy is the
+ * relationship's current strategy.
+ */
+ boolean strategyIsJoinTable();
+
+ /**
+ * Return whether this relationship may potentially have a default join
+ * table. For example, a M-M mapping may have a default join table
+ * if it does not specify a "mapped by" attribute or a join table;
+ * but a M-1 mapping does not support a default join table in any
+ * situation.
+ */
+ boolean mayHaveDefaultJoinTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..7727e9eab2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only join table relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see ReadOnlyAssociationOverride
+ * @see JoinTableRelationship
+ */
+public interface ReadOnlyJoinTableRelationshipStrategy
+ extends ReadOnlyRelationshipStrategy
+{
+ /**
+ * Change notification identifier for "joinTable" property
+ */
+ String JOIN_TABLE_PROPERTY = "joinTable"; //$NON-NLS-1$
+
+ /**
+ * Return the strategy's join table. This will be the
+ * specified or default join table if one is specified or a default
+ * join table applies, otherwise <code>null</code>.
+ */
+ ReadOnlyJoinTable getJoinTable();
+
+ /**
+ * Return the default name of the strategy's join table
+ */
+ String getJoinTableDefaultName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java
new file mode 100644
index 0000000000..09afa25b07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only
+ * <ul>
+ * <li>column
+ * <li>join column
+ * <li>primary key join column
+ * <li>discriminator column
+ * <li>order column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyNamedColumn
+ extends JpaContextNode
+{
+ // ********** name **********
+
+ /**
+ * Return the specified name if present, otherwise return the default
+ * name.
+ */
+ String getName();
+ String getSpecifiedName();
+ String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$
+ String getDefaultName();
+ String DEFAULT_NAME_PROPERTY = "defaultName"; //$NON-NLS-1$
+
+
+ // ********** table **********
+
+ /**
+ * Return the name of the column's table. A column that does not have a
+ * <em>specified</em> table still has a table (as determined by
+ * the column's owner).
+ */
+ String getTable();
+
+
+ // ********** column definition **********
+
+ String getColumnDefinition();
+ String COLUMN_DEFINITION_PROPERTY = "columnDefinition"; //$NON-NLS-1$
+
+
+ // ********** owner **********
+
+ /**
+ * Interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides).
+ */
+ interface Owner
+ {
+ /**
+ * Return the type mapping containing the column.
+ */
+ TypeMapping getTypeMapping();
+
+ /**
+ * Return the name of the table which the column belongs to by default.
+ */
+ String getDefaultTableName();
+
+ /**
+ * Return the default column name.
+ */
+ String getDefaultColumnName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java
new file mode 100644
index 0000000000..f1481d7ede
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only<ul>
+ * <li>attribute override
+ * <li>association override
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyOverride
+ extends JpaContextNode
+{
+ OverrideContainer getContainer();
+
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Return <code>true</code> if the override is not explicitly specified on
+ * the owning object (i.e. it occurs by default); return <code>false</code>
+ * if the override is explicitly specified on the owning object.
+ *
+ * @see Override_#convertToVirtual()
+ * @see VirtualOverride#convertToSpecified()
+ */
+ boolean isVirtual();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java
new file mode 100644
index 0000000000..82d9a2e076
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see AssociationOverride
+ */
+public interface ReadOnlyOverrideRelationship
+ extends ReadOnlyJoinColumnRelationship
+{
+ ReadOnlyAssociationOverride getAssociationOverride();
+
+ void initializeOnSpecified(OverrideRelationship specifiedRelationship);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java
new file mode 100644
index 0000000000..2ea0af3151
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+
+/**
+ * Read-only context persistent <em>attribute</em> (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyPersistentAttribute
+ extends JpaContextNode, JpaStructureNode, ReadOnlyAccessHolder
+{
+ // ********** name **********
+
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+
+ // ********** mapping **********
+
+ /**
+ * Return the attribute's mapping. This is never <code>null</code>
+ * (although, it may be a <em>null</em> mapping).
+ * Set the mapping via {@link PersistentAttribute#setMappingKey(String)}.
+ */
+ AttributeMapping getMapping();
+ String MAPPING_PROPERTY = "mapping"; //$NON-NLS-1$
+
+ /**
+ * Return the attribute's mapping key.
+ */
+ String getMappingKey();
+
+ /**
+ * Return the key for the attribute's default mapping.
+ * This can be <code>null</code> (e.g. for <em>specified</em>
+ * <code>orm.xml</code> attributes).
+ * @see AttributeMapping#isDefault()
+ */
+ String getDefaultMappingKey();
+ String DEFAULT_MAPPING_KEY_PROPERTY = "defaultMappingKey"; //$NON-NLS-1$
+
+
+ // ********** misc **********
+
+ /**
+ * Return the persistent type that owns (declares) the attribute.
+ */
+ PersistentType getOwningPersistentType();
+
+ /**
+ * Return the attribute's owning persistent type's mapping (as opposed to
+ * the attribute's target type's mapping).
+ */
+ TypeMapping getOwningTypeMapping();
+
+ /**
+ * Return the resolved, qualified name of the attribute's type
+ * (e.g. <code>"java.util.Collection"</code> or <code>"byte</code>[]").
+ * Return <code>null</code> if the attribute's type can not be resolved.
+ * If the type is an array, this name will include the appropriate number
+ * of bracket pairs.
+ * This name will not include the type's generic type arguments
+ * (e.g. <code>"java.util.Collection<java.lang.String>"</code> will only return
+ * <code>"java.util.Collection"</code>).
+ */
+ String getTypeName();
+
+ /**
+ * If the attribute is mapped to a primary key column, return the
+ * column's name, otherwise return <code>null</code>.
+ */
+ String getPrimaryKeyColumnName();
+
+ /**
+ * Return whether the attribute has a textual representation
+ * in its underlying resource.
+ */
+ boolean isVirtual();
+
+ JavaPersistentAttribute getJavaPersistentAttribute();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..4f41aa63b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyPrimaryKeyJoinColumn
+ extends ReadOnlyBaseJoinColumn
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java
new file mode 100644
index 0000000000..ed2fba7080
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Read-only reference table (i.e. a table that joins with one other table,
+ * as opposed to a "join table" that joins with two other tables)<ul>
+ * <li>join table
+ * <li>collection table
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyReferenceTable
+ extends ReadOnlyTable
+{
+ // TODO is this method necessary?
+ PersistentAttribute getPersistentAttribute();
+
+
+ // ********** join columns **********
+
+ /**
+ * Return the reference table's join columns, whether specified or default.
+ */
+ ListIterator<? extends ReadOnlyJoinColumn> joinColumns();
+
+ /**
+ * Return the number of join columns, whether specified or default.
+ */
+ int joinColumnsSize();
+
+ /**
+ * Return the reference table's specified join columns.
+ */
+ ListIterator<? extends ReadOnlyJoinColumn> specifiedJoinColumns();
+ String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumns"; //$NON-NLS-1$
+
+ /**
+ * Return the number of specified join columns.
+ */
+ int specifiedJoinColumnsSize();
+
+ /**
+ * Return whether the reference table has specified join columns.
+ */
+ boolean hasSpecifiedJoinColumns();
+
+ /**
+ * Return the specified join column at the specified index.
+ */
+ ReadOnlyJoinColumn getSpecifiedJoinColumn(int index);
+
+ /**
+ * Return the default join column or <code>null</code>.
+ * A default join column only exists if there are no specified join columns.
+ */
+ ReadOnlyJoinColumn getDefaultJoinColumn();
+ String DEFAULT_JOIN_COLUMN_PROPERTY = "defaultJoinColumn"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java
new file mode 100644
index 0000000000..aa7b27f25b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * A relationship contains the settings describing how entities are related
+ * in a {@link RelationshipMapping} or {@link AssociationOverride}:<ul>
+ * <li>join column
+ * <li>join table
+ * <li>"mapped by"
+ * <li>primary key join column
+ * </ul>
+ * Supported mappings:<ul>
+ * <li>1:1
+ * <li>1:m
+ * <li>m:1
+ * <li>m:m
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see AssociationOverride
+ */
+public interface ReadOnlyRelationship
+ extends JpaContextNode
+{
+ /**
+ * Return the relationship's mapping; which for a mapping relationship is
+ * the relationship's parent, but in the case of an override is the
+ * overridden mapping (from a superclass or embeddable type).
+ */
+ RelationshipMapping getMapping();
+
+ /**
+ * Return the type mapping that contains the relationship's mapping or
+ * override.
+ */
+ TypeMapping getTypeMapping();
+
+ /**
+ * Return the entity that contains the relationship's mapping or override.
+ * This is just a convenience method that calls {@link #getTypeMapping()}
+ * and returns <code>null</code> if the result is not an {@link Entity}.
+ */
+ Entity getEntity();
+
+ /**
+ * String associated with changes to the predominant strategy property
+ */
+ final static String STRATEGY_PROPERTY = "strategy"; //$NON-NLS-1$
+
+ /**
+ * Return the current strategy, this is never <code>null</code>.
+ */
+ ReadOnlyRelationshipStrategy getStrategy();
+
+ /**
+ * Return whether the the relationship is virtual.
+ */
+ boolean isVirtual();
+
+ void initializeOn(Relationship newRelationship);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java
new file mode 100644
index 0000000000..39b22c7e01
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Strategy describing how two entities are related, either for a
+ * {@link RelationshipMapping} or an {@link AssociationOverride}:<ul>
+ * <li>join column
+ * <li>join table
+ * <li>"mapped by"
+ * <li>primary key join column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see ReadOnlyAssociationOverride
+ * @see ReadOnlyRelationship
+ */
+public interface ReadOnlyRelationshipStrategy
+ extends JpaContextNode
+{
+ /**
+ * Return the strategy's relationship.
+ */
+ ReadOnlyRelationship getRelationship();
+
+ /**
+ * Return the table name associated with the strategy's columns.
+ * The join table name, for instance, or in the case of a bi-directional
+ * relationship, the table of the owning relationship.
+ */
+ String getTableName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java
new file mode 100644
index 0000000000..90cd0ada13
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Read-only entity secondary table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlySecondaryTable
+ extends ReadOnlyTable
+{
+ public Entity getParent();
+
+ /**
+ * Return whether the secondary table is part of an <code>orm.xml</code>
+ * entity but is specified only in the entity's Java annotations (as
+ * opposed to explicitly in the <code>orm.xml</code>).
+ */
+ boolean isVirtual();
+
+
+ // ********** primary key join columns **********
+
+ /**
+ * Return the secondary table's primary key join columns,
+ * whether specified or default.
+ */
+ ListIterator<? extends ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+
+ /**
+ * Return the number of primary key join columns,
+ * whether specified or default.
+ */
+ int primaryKeyJoinColumnsSize();
+
+
+ // ********** specified primary key join columns **********
+
+ /**
+ * Return the specified primary key join columns.
+ */
+ ListIterator<? extends ReadOnlyPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumns"; //$NON-NLS-1$
+
+ /**
+ * Return the number of specified primary key join columns.
+ */
+ int specifiedPrimaryKeyJoinColumnsSize();
+
+
+ // ********** default primary key join columns **********
+
+ /**
+ * Return the default primary key join column or null. A default primary
+ * key join column only exists if there are no specified primary key join
+ * columns.
+ */
+ ReadOnlyPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
+ String DEFAULT_PRIMARY_KEY_JOIN_COLUMN = "defaultPrimaryKeyJoinColumn"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java
new file mode 100644
index 0000000000..82e86fc3ee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * Read-only table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyTable
+ extends JpaContextNode
+{
+ // ********** name **********
+
+ /**
+ * Return the specified name if present, otherwise return the default
+ * name.
+ */
+ String getName();
+ String getSpecifiedName();
+ String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$
+ String getDefaultName();
+ String DEFAULT_NAME_PROPERTY = "defaultName"; //$NON-NLS-1$
+
+
+ // ********** schema **********
+
+ /**
+ * Return the specified schema if present, otherwise return the default
+ * schema.
+ */
+ String getSchema();
+ String getSpecifiedSchema();
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$
+
+
+ // ********** catalog **********
+
+ /**
+ * Return the specified catalog if present, otherwise return the default
+ * catalog.
+ */
+ String getCatalog();
+ String getSpecifiedCatalog();
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$
+
+
+ // ********** unique constraints **********
+
+ ListIterator<? extends ReadOnlyUniqueConstraint> uniqueConstraints();
+ String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$
+ int uniqueConstraintsSize();
+ ReadOnlyUniqueConstraint getUniqueConstraint(int index);
+
+
+ // ********** database **********
+
+ /**
+ * Return the corresponding database table.
+ */
+ org.eclipse.jpt.jpa.db.Table getDbTable();
+
+ /**
+ * Return the corresponding database schema.
+ */
+ Schema getDbSchema();
+
+ /**
+ * Return the corresponding database catalog.
+ */
+ Catalog getDbCatalog();
+
+ /**
+ * Return the corresponding database schema container (catalog or database).
+ */
+ SchemaContainer getDbSchemaContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java
new file mode 100644
index 0000000000..e98d8b0317
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Read-only database unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyUniqueConstraint
+ extends JpaContextNode
+{
+ /**
+ * Return the unique constraint's column names.
+ */
+ Iterable<String> getColumnNames();
+ String COLUMN_NAMES_LIST = "columnNames"; //$NON-NLS-1$
+
+ /**
+ * Return the number of column names in the unique constraint.
+ */
+ int getColumnNamesSize();
+
+ /**
+ * Return the column name at the specified index.
+ */
+ String getColumnName(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java
new file mode 100644
index 0000000000..7a210e7036
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Reference table (i.e. a table that joins with one other table,
+ * as opposed to a "join table" that joins with two other tables)<ul>
+ * <li>join table
+ * <li>collection table
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ReferenceTable
+ extends Table, ReadOnlyReferenceTable
+{
+ // ********** join columns **********
+
+ /**
+ * Convert the reference table's default join column to a specified join column.
+ */
+ void convertDefaultToSpecifiedJoinColumn();
+
+ ListIterator<? extends JoinColumn> joinColumns();
+
+ ListIterator<? extends JoinColumn> specifiedJoinColumns();
+
+ JoinColumn getSpecifiedJoinColumn(int index);
+
+ /**
+ * Add and return a specified join column to the reference table.
+ */
+ JoinColumn addSpecifiedJoinColumn();
+
+ /**
+ * Add and return a specified join column to the reference table.
+ */
+ JoinColumn addSpecifiedJoinColumn(int index);
+
+ /**
+ * Remove the join column at the specified index from the reference table.
+ */
+ void removeSpecifiedJoinColumn(int index);
+
+ /**
+ * Remove the specified join column from the reference table.
+ */
+ void removeSpecifiedJoinColumn(JoinColumn joinColumn);
+
+ /**
+ * Move the join column at the specified source index to the
+ * specified target index.
+ */
+ void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex);
+
+ JoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java
new file mode 100644
index 0000000000..53b2c5b4d9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see AssociationOverride
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface Relationship
+ extends ReadOnlyRelationship
+{
+ RelationshipStrategy getStrategy();
+
+
+ // ********** conversions **********
+
+ void initializeFrom(ReadOnlyRelationship oldRelationship);
+
+ void initializeFromMappedByRelationship(MappedByRelationship oldRelationship);
+
+ void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship);
+
+ void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship);
+
+ // we only have a single "client" of the primary key relationship (1:1 mapping)
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java
new file mode 100644
index 0000000000..5bfecd7f7e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+
+/**
+ * JPA relationship (1:1, 1:m, m:1, m:m) mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface RelationshipMapping
+ extends FetchableMapping
+{
+ /**
+ * Return the meta-information used to populate the entities of the
+ * relationship
+ */
+ MappingRelationship getRelationship();
+
+ /**
+ * Return the relationship owner or null if this is the owning side
+ * or it is a unidirectional mapping.
+ */
+ RelationshipMapping getRelationshipOwner();
+
+
+ // **************** target entity **************************************
+
+ String getTargetEntity();
+
+ String getSpecifiedTargetEntity();
+ void setSpecifiedTargetEntity(String value);
+ String SPECIFIED_TARGET_ENTITY_PROPERTY = "specifiedTargetEntity"; //$NON-NLS-1$
+
+ String getDefaultTargetEntity();
+ String DEFAULT_TARGET_ENTITY_PROPERTY = "defaultTargetEntity"; //$NON-NLS-1$
+
+ Entity getResolvedTargetEntity();
+
+ /**
+ * Return all attribute names on the target entity, provided target entity
+ * resolves
+ */
+ Iterator<String> allTargetEntityAttributeNames();
+
+ /**
+ * Return the char to be used for browsing or creating the target entity IType.
+ * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
+ */
+ char getTargetEntityEnclosingTypeSeparator();
+
+ // **************** cascade **************************************
+
+ Cascade getCascade();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java
new file mode 100644
index 0000000000..de6411800c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Strategy describing how two entities are joined, either for a
+ * {@link RelationshipMapping} or an {@link AssociationOverride}:<ul>
+ * <li>join column
+ * <li>join table
+ * <li>"mapped by"
+ * <li>primary key join column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see RelationshipMapping
+ * @see AssociationOverride
+ * @see Relationship
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface RelationshipStrategy
+ extends ReadOnlyRelationshipStrategy
+{
+ Relationship getRelationship();
+
+ /**
+ * Add this strategy to the relationship.
+ */
+ void addStrategy();
+
+ /**
+ * Remove this strategy from the relationship.
+ */
+ void removeStrategy();
+
+ /**
+ * Return whether the relationship's mapping can be overridden with an
+ * association override.
+ */
+ boolean isOverridable();
+
+ /**
+ * Return the database table for the specified table name.
+ */
+ Table resolveDbTable(String tableName);
+
+ /**
+ * Return whether the specified table cannot be explicitly specified
+ * in the column's <code>table</code> element.
+ */
+ boolean tableNameIsInvalid(String tableName);
+
+ /**
+ * Return a message description used when the column's table is not valid
+ * in this context. This will be passed in as a parameter to a validation
+ * message. Here is an example where the description is what is returned
+ * by the implementation:
+ * <p>location:
+ * Table "table name" for map key column "column name"
+ * <p>description:
+ * does not match join table
+ */
+ String getColumnTableNotValidDescription();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java
new file mode 100644
index 0000000000..bdcdac8846
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * entity secondary table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface SecondaryTable
+ extends Table, ReadOnlySecondaryTable
+{
+ ListIterator<? extends PrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterator<? extends PrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ PrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
+
+ /**
+ * Add a specified primary key join column to the secondary table.
+ * Return the newly-created primary key join column.
+ */
+ PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
+
+ /**
+ * Add a specified primary key join column to the secondary table.
+ * Return the newly-created primary key join column.
+ */
+ PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+
+ /**
+ * Remove the specified primary key join column at the specified index from
+ * the secondary table.
+ */
+ void removeSpecifiedPrimaryKeyJoinColumn(int index);
+
+ /**
+ * Remove the specified primary key join column from the secondary table.
+ */
+ void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn pkJoinColumn);
+
+ /**
+ * Move the specified primary key join column from the specified source
+ * index to the specified target index.
+ */
+ void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java
new file mode 100644
index 0000000000..fd164b1e86
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * sequence generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface SequenceGenerator
+ extends Generator
+{
+ int DEFAULT_INITIAL_VALUE = 1;
+
+
+ // ********** sequence name **********
+
+ /**
+ * Return the specified sequence name if present, otherwise return the
+ * default sequence name.
+ */
+ String getSequenceName();
+ String getSpecifiedSequenceName();
+ void setSpecifiedSequenceName(String value);
+ String SPECIFIED_SEQUENCE_NAME_PROPERTY = "specifiedSequenceName"; //$NON-NLS-1$
+ String getDefaultSequenceName();
+ String DEFAULT_SEQUENCE_NAME_PROPERTY = "defaultSequenceName"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java
new file mode 100644
index 0000000000..8a448c464c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA single (m:1, 1:2) mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface SingleRelationshipMapping
+ extends RelationshipMapping, OptionalMapping
+{
+ FetchType DEFAULT_FETCH_TYPE = FetchType.EAGER;
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java
new file mode 100644
index 0000000000..c475063105
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+
+/**
+ * <ul>
+ * <li>table
+ * <li>secondary table
+ * <li>join table
+ * <li>collection table
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface Table
+ extends ReadOnlyTable
+{
+ void setSpecifiedName(String value);
+
+ void setSpecifiedSchema(String value);
+
+ void setSpecifiedCatalog(String value);
+
+ ListIterator<? extends UniqueConstraint> uniqueConstraints();
+ UniqueConstraint getUniqueConstraint(int index);
+ UniqueConstraint addUniqueConstraint();
+ UniqueConstraint addUniqueConstraint(int index);
+ void removeUniqueConstraint(int index);
+ void removeUniqueConstraint(UniqueConstraint uniqueConstraint);
+ void moveUniqueConstraint(int targetIndex, int sourceIndex);
+
+
+ // ********** misc **********
+
+ /**
+ * Return whether the table is specified in the
+ * (Java or XML) resource.
+ */
+ boolean isSpecifiedInResource();
+
+ /**
+ * Return whether the table can be resolved to a table on the database.
+ */
+ boolean isResolved();
+
+ /**
+ * Return whether the table's schema can be resolved to a schema on the
+ * database.
+ */
+ boolean schemaIsResolved();
+
+ /**
+ * Return whether the table has a catalog and it can be resolved to a
+ * catalog on the database.
+ */
+ boolean catalogIsResolved();
+
+ /**
+ * Return whether the table is validated against a live database connection.
+ */
+ boolean validatesAgainstDatabase();
+
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner
+ {
+ JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java
new file mode 100644
index 0000000000..13a2fad455
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * table generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface TableGenerator
+ extends Generator
+{
+ int DEFAULT_INITIAL_VALUE = 0;
+
+
+ // ********** table **********
+
+ /**
+ * Return the specified table if present, otherwise return the default
+ * table.
+ */
+ String getTable();
+ String getSpecifiedTable();
+ void setSpecifiedTable(String value);
+ String SPECIFIED_TABLE_PROPERTY = "specifiedTable"; //$NON-NLS-1$
+ String getDefaultTable();
+ String DEFAULT_TABLE_PROPERTY = "defaultTable"; //$NON-NLS-1$
+
+
+ // ********** schema **********
+
+ /**
+ * Return the specified schema if present, otherwise return the default
+ * schema.
+ */
+ String getSchema();
+ String getSpecifiedSchema();
+ void setSpecifiedSchema(String value);
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$
+
+
+ // ********** catalog **********
+
+ /**
+ * Return the specified catalog if present, otherwise return the default
+ * catalog.
+ */
+ String getCatalog();
+ String getSpecifiedCatalog();
+ void setSpecifiedCatalog(String value);
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$
+
+
+ // ********** primary key column name **********
+
+ /**
+ * Return the specified primary key colum name if present, otherwise return
+ * the default primary key colum name.
+ */
+ String getPkColumnName();
+ String getSpecifiedPkColumnName();
+ void setSpecifiedPkColumnName(String value);
+ String SPECIFIED_PK_COLUMN_NAME_PROPERTY = "specifiedPkColumnName"; //$NON-NLS-1$
+ String getDefaultPkColumnName();
+ String DEFAULT_PK_COLUMN_NAME_PROPERTY = "defaultPkColumnName"; //$NON-NLS-1$
+
+
+ // ********** value column name **********
+
+ /**
+ * Return the specified value colum name if present, otherwise return
+ * the default value colum name.
+ */
+ String getValueColumnName();
+ String getSpecifiedValueColumnName();
+ void setSpecifiedValueColumnName(String value);
+ String SPECIFIED_VALUE_COLUMN_NAME_PROPERTY = "specifiedValueColumnName"; //$NON-NLS-1$
+ String getDefaultValueColumnName();
+ String DEFAULT_VALUE_COLUMN_NAME_PROPERTY = "defaultValueColumnName"; //$NON-NLS-1$
+
+
+ // ********** primary key column value **********
+
+ /**
+ * Return the specified primary key colum value if present, otherwise return
+ * the default primary key colum value.
+ */
+ String getPkColumnValue();
+ String getSpecifiedPkColumnValue();
+ void setSpecifiedPkColumnValue(String value);
+ String SPECIFIED_PK_COLUMN_VALUE_PROPERTY = "specifiedPkColummValue"; //$NON-NLS-1$
+ String getDefaultPkColumnValue();
+ String DEFAULT_PK_COLUMN_VALUE_PROPERTY = "defaultPkColummValue"; //$NON-NLS-1$
+
+
+ // ********** unique constraints **********
+
+ <T extends UniqueConstraint> Iterable<T> getUniqueConstraints();
+ int getUniqueConstraintsSize();
+ UniqueConstraint addUniqueConstraint();
+ UniqueConstraint addUniqueConstraint(int index);
+ void removeUniqueConstraint(int index);
+ void removeUniqueConstraint(UniqueConstraint uniqueConstraint);
+ void moveUniqueConstraint(int targetIndex, int sourceIndex);
+ String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$
+
+
+ // ********** database stuff **********
+
+ /**
+ * Return the generator's database table.
+ * Return null if the generator's table (name) is invalid.
+ */
+ Table getDbTable();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java
new file mode 100644
index 0000000000..7a651dc6fa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA temporal converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface TemporalConverter
+ extends Converter
+{
+ TemporalType getTemporalType();
+ void setTemporalType(TemporalType temporalType);
+ String TEMPORAL_TYPE_PROPERTY = "temporalType"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java
new file mode 100644
index 0000000000..63b0fd27a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Temporal Type
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum TemporalType {
+
+ DATE(
+ org.eclipse.jpt.jpa.core.resource.java.TemporalType.DATE,
+ org.eclipse.jpt.jpa.core.resource.orm.TemporalType.DATE
+ ),
+ TIME(
+ org.eclipse.jpt.jpa.core.resource.java.TemporalType.TIME,
+ org.eclipse.jpt.jpa.core.resource.orm.TemporalType.TIME
+ ),
+ TIMESTAMP(
+ org.eclipse.jpt.jpa.core.resource.java.TemporalType.TIMESTAMP,
+ org.eclipse.jpt.jpa.core.resource.orm.TemporalType.TIMESTAMP
+ );
+
+
+ private org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType;
+ private org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType;
+
+ TemporalType(org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType, org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType) {
+ if (javaTemporalType == null) {
+ throw new NullPointerException();
+ }
+ if (ormTemporalType == null) {
+ throw new NullPointerException();
+ }
+ this.javaTemporalType = javaTemporalType;
+ this.ormTemporalType = ormTemporalType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.TemporalType getJavaTemporalType() {
+ return this.javaTemporalType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.TemporalType getOrmTemporalType() {
+ return this.ormTemporalType;
+ }
+
+
+ // ********** static methods **********
+
+ public static TemporalType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType) {
+ return (javaTemporalType == null) ? null : fromJavaResourceModel_(javaTemporalType);
+ }
+
+ private static TemporalType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType) {
+ for (TemporalType temporalType : TemporalType.values()) {
+ if (temporalType.getJavaTemporalType() == javaTemporalType) {
+ return temporalType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.java.TemporalType toJavaResourceModel(TemporalType temporalType) {
+ return (temporalType == null) ? null : temporalType.getJavaTemporalType();
+ }
+
+ public static TemporalType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType) {
+ return (ormTemporalType == null) ? null : fromOrmResourceModel_(ormTemporalType);
+ }
+
+ private static TemporalType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType) {
+ for (TemporalType temporalType : TemporalType.values()) {
+ if (temporalType.getOrmTemporalType() == ormTemporalType) {
+ return temporalType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.TemporalType toOrmResourceModel(TemporalType temporalType) {
+ return (temporalType == null) ? null : temporalType.getOrmTemporalType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java
new file mode 100644
index 0000000000..b6d759493d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA transient "mapping". Because of default mappings, attributes must be
+ * explicitly marked "transient" if they are not to be mapped to the database.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface TransientMapping
+ extends AttributeMapping
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java
new file mode 100644
index 0000000000..7786bc9bdb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.db.Schema;
+
+/**
+ * type mapping:<ul>
+ * <li>entity
+ * <li>mapped superclass
+ * <li>embeddable
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still under
+ * development and expected to change significantly before reaching stability.
+ * It is available at this early stage to solicit feedback from pioneering
+ * adopters on the understanding that any code that uses this API will almost
+ * certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface TypeMapping
+ extends JpaContextNode
+{
+ PersistentType getPersistentType();
+
+ /**
+ * Return a unique key for the type mapping. If this is defined in an
+ * extension they should be equal.
+ */
+ String getKey();
+
+ /**
+ * Return the name, specified or default if not specified.
+ */
+ String getName();
+
+ boolean isMapped();
+
+ /**
+ * Return the resolved id class specified on this type mapping, null otherwise
+ */
+ JavaPersistentType getIdClass();
+
+
+ // ********** inheritance **********
+
+ /**
+ * Return the type mapping of this type mapping's super type.
+ * Return null if this is the root.
+ */
+ TypeMapping getSuperTypeMapping();
+
+ /**
+ * Return the type mapping's "persistence" inheritance hierarchy,
+ * <em>including</em> the type mapping itself.
+ * The returned iterator will return elements infinitely if the hierarchy
+ * has a loop.
+ */
+ Iterator<TypeMapping> inheritanceHierarchy();
+
+
+ // ********** tables **********
+
+ /**
+ * Return the type mapping's primary table name.
+ * Return null if a primary table is not applicable.
+ */
+ String getPrimaryTableName();
+
+ /**
+ * Return the type mapping's primary database table.
+ * Return null if a primary table is not applicable.
+ */
+ org.eclipse.jpt.jpa.db.Table getPrimaryDbTable();
+
+ Schema getDbSchema();
+
+ /**
+ * Return the type mapping's "associated" tables, which includes the primary
+ * table and the collection of secondary tables.
+ */
+ Iterator<ReadOnlyTable> associatedTables();
+
+ /**
+ * Return the type mapping's "associated" tables, which includes the primary
+ * table and the collection of secondary tables, as well as all inherited
+ * "associated" tables.
+ */
+ Iterator<ReadOnlyTable> allAssociatedTables();
+
+ /**
+ * Return the names of the type mapping's "associated" tables, which
+ * includes the primary table and the collection of secondary tables, as
+ * well as all the inherited "associated" tables.
+ */
+ Iterator<String> allAssociatedTableNames();
+
+ /**
+ * Return the resolved associated db table with the specified name.
+ */
+ org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName);
+
+ /**
+ * Return whether the specified table is invalid for any annotations
+ * associated with the type mapping.
+ */
+ boolean tableNameIsInvalid(String tableName);
+
+
+ // ********** mappings **********
+
+ /**
+ * A convenience method for getting the attribute mappings from PersistentType.attributes()
+ */
+ <T extends AttributeMapping> Iterator<T> attributeMappings();
+
+ /**
+ * Return attribute mappings of a particular mapping type that are declared on this type mapping
+ */
+ <T extends AttributeMapping> Iterable<T> getAttributeMappings(String mappingKey);
+
+ /**
+ * Return all the attribute mappings in the type mapping's
+ * inheritance hierarchy.
+ */
+ Iterator<AttributeMapping> allAttributeMappings();
+
+ /**
+ * Return attribute mappings of a particular mapping type that are declared anywhere on this
+ * type mapping's hierarchy
+ */
+ <T extends AttributeMapping> Iterable<T> getAllAttributeMappings(String mappingKey);
+
+ /**
+ * Return whether the given attribute mapping key is valid for this
+ * particular type mapping (for example, id's are not valid for an
+ * embeddable type mapping)
+ */
+ boolean attributeMappingKeyAllowed(String attributeMappingKey);
+
+
+ // ********** attribute overrides **********
+
+ /**
+ * Return an Iterator of attribute names that can be overridden by a
+ * sub type mapping.
+ */
+ Iterator<String> overridableAttributeNames();
+
+ /**
+ * Return an Iterator of all attribute names that can be overridden in this
+ * type mapping.
+ */
+ Iterator<String> allOverridableAttributeNames();
+
+ /**
+ * Return the column of the overridable attribute mapping (or attribute
+ * override) with the specified attribute name.
+ * <p>
+ * In JPA 2.0 this name can use dot-notation to designate nested attributes
+ * in embedded attribute mapping's embeddable type mapping.
+ */
+ Column resolveOverriddenColumn(String attributeName);
+
+
+ // ********** association overrides **********
+
+ /**
+ * Return an Iterator of associations names that can be overridden in this
+ * type mapping.
+ */
+ Iterator<String> overridableAssociationNames();
+
+ /**
+ * Return an Iterator of all associations names that can be overridden in this
+ * type mapping.
+ */
+ Iterator<String> allOverridableAssociationNames();
+
+ Relationship resolveOverriddenRelationship(String attributeName);
+
+
+ // ********** validation **********
+
+ /**
+ * Return whether any database metadata specific validation should occur.
+ * (For instance, if the connection is not active, then it should not.)
+ */
+ boolean validatesAgainstDatabase();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java
new file mode 100644
index 0000000000..3b6fa6241b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.Iterator;
+
+/**
+ * database unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface UniqueConstraint
+ extends ReadOnlyUniqueConstraint
+{
+ void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint);
+
+
+ // ********** column names **********
+
+ /**
+ * Add the specified column name to the end of the
+ * unique constraint's list of column names.
+ */
+ void addColumnName(String columnName);
+
+ /**
+ * Add the specified column name to the
+ * unique constraint's list of column names
+ * at the specified index.
+ */
+ void addColumnName(int index, String columnName);
+
+ /**
+ * Remove the specified column name from the
+ * unique constraint's list of column names.
+ */
+ void removeColumnName(String columnName);
+
+ /**
+ * Remove the column name at the specified index from the
+ * unique constraint's list of column names.
+ */
+ void removeColumnName(int index);
+
+ /**
+ * Move the column name at the specified source index
+ * to the specified target index in the
+ * unique constraint's list of column names.
+ */
+ void moveColumnName(int targetIndex, int sourceIndex);
+
+
+ // ********** owner **********
+
+ /**
+ * All containers must implement this interface.
+ */
+ interface Owner {
+ Iterator<String> candidateUniqueConstraintColumnNames();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java
new file mode 100644
index 0000000000..7f6bf33c43
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * JPA version mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface VersionMapping
+ extends ColumnMapping, ConvertibleMapping
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java
new file mode 100644
index 0000000000..32aefc25da
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualAssociationOverride
+ extends VirtualOverride, ReadOnlyAssociationOverride
+{
+ AssociationOverride convertToSpecified();
+
+ VirtualOverrideRelationship getRelationship();
+
+ Relationship resolveOverriddenRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java
new file mode 100644
index 0000000000..ba2787c54f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual attribute override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualAttributeOverride
+ extends VirtualOverride, ReadOnlyAttributeOverride
+{
+ AttributeOverride convertToSpecified();
+
+ VirtualColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java
new file mode 100644
index 0000000000..7d956dc5fc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual
+ * <ul>
+ * <li>column
+ * <li>join column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualBaseColumn
+ extends VirtualNamedColumn, ReadOnlyBaseColumn
+{
+ BaseColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java
new file mode 100644
index 0000000000..2eabed2eb4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual join column (no virtual primary key join columns yet)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualBaseJoinColumn
+ extends VirtualNamedColumn, ReadOnlyBaseJoinColumn
+{
+ BaseJoinColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java
new file mode 100644
index 0000000000..43486daa38
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualColumn
+ extends VirtualBaseColumn, ReadOnlyColumn
+{
+ Column getOverriddenColumn();
+
+
+ // ********** owner **********
+
+ /**
+ * Interface allowing the virtual column to be get the column it overrides.
+ */
+ interface Owner
+ extends ReadOnlyColumn.Owner
+ {
+ /**
+ * Return the column overridden by the virtual column.
+ */
+ Column resolveOverriddenColumn();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java
new file mode 100644
index 0000000000..a49d3ef972
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualJoinColumn
+ extends VirtualBaseJoinColumn, VirtualBaseColumn, ReadOnlyJoinColumn
+{
+ JoinColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java
new file mode 100644
index 0000000000..eb9019d98c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual join column relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualJoinColumnRelationship
+ extends ReadOnlyJoinColumnRelationship,
+ VirtualRelationship
+{
+ VirtualJoinColumnRelationshipStrategy getJoinColumnStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..985be639ce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Virtual join column relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualJoinColumnRelationshipStrategy
+ extends ReadOnlyJoinColumnRelationshipStrategy, VirtualRelationshipStrategy
+{
+ ListIterator<? extends VirtualJoinColumn> joinColumns();
+ ListIterator<? extends VirtualJoinColumn> specifiedJoinColumns();
+ VirtualJoinColumn getSpecifiedJoinColumn(int index);
+ VirtualJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java
new file mode 100644
index 0000000000..16b9f1dc39
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Used by association overrides.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualJoinTable
+ extends VirtualReferenceTable, ReadOnlyJoinTable
+{
+ VirtualJoinTableRelationshipStrategy getParent();
+
+ ListIterator<? extends VirtualJoinColumn> inverseJoinColumns();
+ ListIterator<? extends VirtualJoinColumn> specifiedInverseJoinColumns();
+ VirtualJoinColumn getSpecifiedInverseJoinColumn(int index);
+ VirtualJoinColumn getDefaultInverseJoinColumn();
+
+ JoinTable getOverriddenTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java
new file mode 100644
index 0000000000..8f322197d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual join table relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualJoinTableRelationship
+ extends ReadOnlyJoinTableRelationship,
+ VirtualRelationship
+{
+ VirtualJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..94c9901b64
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual join table relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualJoinTableRelationshipStrategy
+ extends ReadOnlyJoinTableRelationshipStrategy, VirtualRelationshipStrategy
+{
+ VirtualJoinTable getJoinTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java
new file mode 100644
index 0000000000..175e487a12
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual
+ * <ul>
+ * <li>column
+ * <li>join column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualNamedColumn
+ extends ReadOnlyNamedColumn
+{
+ /**
+ * Return the virtual column's wrapped column.
+ */
+ NamedColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java
new file mode 100644
index 0000000000..791c6aac1a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual<ul>
+ * <li>attribute override
+ * <li>association override
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualOverride
+ extends ReadOnlyOverride
+{
+ /**
+ * Convert the virtual override to a specified override.
+ * Return the new override.
+ * @see #isVirtual()
+ */
+ Override_ convertToSpecified();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java
new file mode 100644
index 0000000000..728eed9a15
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see AssociationOverride
+ */
+public interface VirtualOverrideRelationship
+ extends ReadOnlyOverrideRelationship,
+ VirtualJoinColumnRelationship
+{
+ VirtualAssociationOverride getAssociationOverride();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..4a2ef7c118
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualPrimaryKeyJoinColumn
+ extends VirtualBaseJoinColumn, ReadOnlyPrimaryKeyJoinColumn
+{
+ PrimaryKeyJoinColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java
new file mode 100644
index 0000000000..1d14fdbadf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Virtual reference table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualReferenceTable
+ extends VirtualTable, ReadOnlyReferenceTable
+{
+ ListIterator<? extends VirtualJoinColumn> joinColumns();
+ ListIterator<? extends VirtualJoinColumn> specifiedJoinColumns();
+ VirtualJoinColumn getSpecifiedJoinColumn(int index);
+ VirtualJoinColumn getDefaultJoinColumn();
+
+ ReferenceTable getOverriddenTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java
new file mode 100644
index 0000000000..bc64dc7c0e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualRelationship
+ extends ReadOnlyRelationship
+{
+ VirtualRelationshipStrategy getStrategy();
+
+ Relationship resolveOverriddenRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java
new file mode 100644
index 0000000000..0d9570d197
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualRelationshipStrategy
+ extends ReadOnlyRelationshipStrategy
+{
+ VirtualRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java
new file mode 100644
index 0000000000..2251a30bce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Virtual secondary table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualSecondaryTable
+ extends VirtualTable, ReadOnlySecondaryTable
+{
+ ListIterator<? extends VirtualPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterator<? extends VirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ VirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
+
+ SecondaryTable getOverriddenTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java
new file mode 100644
index 0000000000..e168fa3985
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.ListIterator;
+
+/**
+ * Virtual table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualTable
+ extends ReadOnlyTable
+{
+ ListIterator<? extends VirtualUniqueConstraint> uniqueConstraints();
+ VirtualUniqueConstraint getUniqueConstraint(int index);
+
+ Table getOverriddenTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java
new file mode 100644
index 0000000000..32b9128a1d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+/**
+ * Virtual database unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualUniqueConstraint
+ extends ReadOnlyUniqueConstraint
+{
+ /**
+ * Return the wrapped unique constraint.
+ */
+ UniqueConstraint getOverriddenUniqueConstraint();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java
new file mode 100644
index 0000000000..5ff9c36b37
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import java.util.List;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * XML JPA context node
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.1
+ */
+public interface XmlContextNode
+ extends JpaContextNode
+{
+// TODO bjv rename to XmlJpaContextNode
+ /**
+ * Add to the list of current validation messages
+ */
+ void validate(List<IMessage> messages, IReporter reporter);
+
+ TextRange getValidationTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
new file mode 100644
index 0000000000..f413d9d170
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context;
+
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * Context representation of any JPA XML file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface XmlFile
+ extends XmlContextNode, JpaStructureNode
+{
+ /**
+ * Return the resource model object
+ */
+ JpaXmlResource getXmlResource();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java
new file mode 100644
index 0000000000..94676c16d0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+public interface DefaultJavaAttributeMappingDefinition
+ extends JavaAttributeMappingDefinition
+{
+ /**
+ * Return whether the definition's mapping is the "default" mapping for the
+ * specified persistent attribute.
+ */
+ boolean isDefault(JavaPersistentAttribute persistentAttribute);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java
new file mode 100644
index 0000000000..fb16f1d95f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * A JAR file identified by a <code>persistence.xml</code> <code>jar-file</code> element.
+ * This holds persistent types corresponding to all the "persistable" types
+ * discovered in the JAR.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JarFile
+ extends JpaContextNode, JpaStructureNode, PersistentTypeContainer
+{
+ JavaResourcePackageFragmentRoot getJarResourcePackageFragmentRoot();
+
+
+ // ********** Java persistent types **********
+
+ /**
+ * Return the JAR file's Java persistent types.
+ * Return only the types that are annotated with JPA annotations.
+ */
+ Iterator<JavaPersistentType> javaPersistentTypes();
+ String JAVA_PERSISTENT_TYPES_COLLECTION = "javaPersistentTypes"; //$NON-NLS-1$
+
+ /**
+ * Return the size of the JAR file's Java persistent types.
+ */
+ int javaPersistentTypesSize();
+
+ /**
+ * Return the persistent type with the specified name.
+ * Return null if the persistent type is not found.
+ */
+ PersistentType getPersistentType(String typeName);
+
+
+ // ********** validation **********
+
+ /**
+ * Add to the list of current validation messages
+ */
+ void validate(List<IMessage> messages, IReporter reporter);
+
+ /**
+ * Return true if this jar file exists in the given folder
+ */
+ boolean isIn(IFolder folder);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java
new file mode 100644
index 0000000000..1ceb4e962a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+
+/**
+ * Java association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaAssociationOverride
+ extends JavaReadOnlyAssociationOverride, AssociationOverride, JavaOverride
+{
+ JavaVirtualAssociationOverride convertToVirtual();
+
+ AssociationOverrideAnnotation getOverrideAnnotation();
+
+ JavaOverrideRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java
new file mode 100644
index 0000000000..b43e2ee1de
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+
+/**
+ * Java association override container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaAssociationOverrideContainer
+ extends AssociationOverrideContainer, JavaOverrideContainer
+{
+ ListIterator<JavaReadOnlyAssociationOverride> overrides();
+ JavaReadOnlyAssociationOverride getOverrideNamed(String name);
+ ListIterator<JavaAssociationOverride> specifiedOverrides();
+ JavaAssociationOverride getSpecifiedOverride(int index);
+ JavaAssociationOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<JavaVirtualAssociationOverride> virtualOverrides();
+ JavaVirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ JavaAssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends AssociationOverrideContainer.Owner, JavaOverrideContainer.Owner
+ {
+ // combine two interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java
new file mode 100644
index 0000000000..0a438ef690
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * Java attribute mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaAttributeMapping
+ extends AttributeMapping, JavaJpaContextNode
+{
+ JavaPersistentAttribute getParent();
+
+ JavaPersistentAttribute getPersistentAttribute();
+
+ JavaResourcePersistentAttribute getResourcePersistentAttribute();
+
+ Annotation getMappingAnnotation();
+
+ Annotation getAnnotationForUpdate();
+
+ void updateDefault();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java
new file mode 100644
index 0000000000..887a8d2d89
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.JpaFactory;
+
+/**
+ * Map a string key to an attribute mapping and its corresponding
+ * Java annotations.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaAttributeMappingDefinition
+{
+ /**
+ * Return the attribute mapping's key.
+ */
+ String getKey();
+
+ /**
+ * Return the name of the attribute mapping's annotation.
+ */
+ String getAnnotationName();
+
+ /**
+ * Return the names of the attribute mapping's "supporting" annotations.
+ */
+ Iterable<String> getSupportingAnnotationNames();
+
+ /**
+ * Return whether the definition's mapping is
+ * the "specified" mapping for the specified persistent attribute.
+ * <p>
+ * <strong>NB:</strong> A mapping is not necessarily "specified" if its
+ * annotation is present
+ * (see {@link org.eclipse.jpt.jpa.core.internal.jpa2.context.java.AbstractJavaIdMappingDefinition2_0#isSpecified(JavaPersistentAttribute)})
+ */
+ boolean isSpecified(JavaPersistentAttribute persistentAttribute);
+
+ /**
+ * Build a Java attribute mapping for the specified persistent attribute.
+ * Use the specified factory for creation so extenders can simply override
+ * the appropriate factory method instead of building a definition for the
+ * same key.
+ */
+ JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java
new file mode 100644
index 0000000000..093e0e8eca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+
+/**
+ * Java attribute override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaAttributeOverride
+ extends JavaReadOnlyAttributeOverride, AttributeOverride, JavaOverride
+{
+ JavaVirtualAttributeOverride convertToVirtual();
+
+ AttributeOverrideAnnotation getOverrideAnnotation();
+
+ JavaColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java
new file mode 100644
index 0000000000..48bd48d7d5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+
+/**
+ * Java attribute override container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaAttributeOverrideContainer
+ extends AttributeOverrideContainer, JavaOverrideContainer
+{
+ ListIterator<JavaReadOnlyAttributeOverride> overrides();
+ JavaReadOnlyAttributeOverride getOverrideNamed(String name);
+ ListIterator<JavaAttributeOverride> specifiedOverrides();
+ JavaAttributeOverride getSpecifiedOverride(int index);
+ JavaAttributeOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<JavaVirtualAttributeOverride> virtualOverrides();
+ JavaVirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ JavaAttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+
+ // ********** Java owner **********
+
+ interface Owner
+ extends AttributeOverrideContainer.Owner, JavaOverrideContainer.Owner
+ {
+ // combine two interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java
new file mode 100644
index 0000000000..3e92a1890e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
+
+/**
+ * Java column or join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaBaseColumn
+ extends BaseColumn, JavaNamedColumn
+{
+ BaseColumnAnnotation getColumnAnnotation();
+
+ /**
+ * Return the (best guess) text location of the column's table.
+ */
+ TextRange getTableTextRange(CompilationUnit astRoot);
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner
+ extends JavaNamedColumn.Owner, BaseColumn.Owner
+ {
+ // combine two interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java
new file mode 100644
index 0000000000..ab5405f5d5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.BaseEmbeddedMapping;
+
+/**
+ * Behavior common to Java embedded and embedded ID mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaBaseEmbeddedMapping
+ extends BaseEmbeddedMapping, JavaAttributeMapping
+{
+ JavaAttributeOverrideContainer getAttributeOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java
new file mode 100644
index 0000000000..9a54c73cce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+
+/**
+ * Java join column or primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaBaseJoinColumn
+ extends BaseJoinColumn, JavaNamedColumn
+{
+ /**
+ * Return the (best guess) text location of the join column's
+ * referenced column name.
+ */
+ TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot);
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing join columns to be used in multiple places
+ * (e.g. 1:1 mappings and join tables)
+ */
+ interface Owner
+ extends BaseJoinColumn.Owner, JavaNamedColumn.Owner
+ {
+ // combine interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java
new file mode 100644
index 0000000000..b5d8038928
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.BasicMapping;
+import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
+
+/**
+ * Java basic mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaBasicMapping
+ extends BasicMapping, JavaColumnMapping, JavaConvertibleMapping
+{
+ BasicAnnotation getMappingAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java
new file mode 100644
index 0000000000..9f0562919b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Cascade;
+
+/**
+ * Java cascade (persist, merge, remove, refresh)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaCascade
+ extends Cascade, JavaJpaContextNode
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java
new file mode 100644
index 0000000000..3c0a4fb3eb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.CollectionMapping;
+
+/**
+ * JPA Java collection mapping (e.g. 1:m, m:m, element collection)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaCollectionMapping
+ extends CollectionMapping, JavaAttributeMapping
+{
+ JavaOrderable getOrderable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java
new file mode 100644
index 0000000000..f2117d070e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
+
+/**
+ * Java column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaColumn
+ extends Column, JavaBaseColumn
+{
+ CompleteColumnAnnotation getColumnAnnotation();
+
+ // ********** owner **********
+
+ interface Owner
+ extends JavaBaseColumn.Owner
+ {
+ CompleteColumnAnnotation getColumnAnnotation();
+ void removeColumnAnnotation();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java
new file mode 100644
index 0000000000..1d4f3fd5fa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ColumnMapping;
+
+/**
+ * Java column mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaColumnMapping
+ extends ColumnMapping, JavaAttributeMapping, JavaColumn.Owner
+{
+ JavaColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java
new file mode 100644
index 0000000000..60df112508
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * Java converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface JavaConverter
+ extends Converter, JavaJpaContextNode
+{
+ JavaAttributeMapping getParent();
+
+ Annotation getConverterAnnotation();
+
+ /**
+ * Allow the converter to clean up any related annotations before it is
+ * removed itself.
+ */
+ void dispose();
+
+
+ // ********** adapter **********
+
+ /**
+ * This interface allows a convertible mapping to interact with various
+ * Java converters via the same protocol.
+ */
+ public interface Adapter
+ {
+ /**
+ * Return the type of converter handled by the adapter.
+ */
+ Class<? extends Converter> getConverterType();
+
+ /**
+ * Build a converter corresponding to the specified mapping
+ * if the mapping's resource attribute is modified by the adapter's
+ * converter annotation. Return <code>null</code> otherwise.
+ * This is used to build a converter during construction of the
+ * converter's mapping.
+ */
+ JavaConverter buildConverter(JavaAttributeMapping parent, JpaFactory factory);
+
+ /**
+ * Return the adapter's converter annotation for the specified Java
+ * resource persistent member.
+ * Return <code>null</code> if the adapter's converter annotation is
+ * missing.
+ * The returned converter annotation is compared to the parent's
+ * converter's converter annotation while the context model is synchronized
+ * with the resource model. If it has changed, the parent will build
+ * a new converter (via the adapter).
+ *
+ * @see #buildConverter(Annotation, JavaAttributeMapping, JpaFactory)
+ */
+ Annotation getConverterAnnotation(JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+
+ /**
+ * Build a converter using the specified converter annotation.
+ * This is used when the context model is synchronized with the
+ * resource model (and the resource model has changed).
+ *
+ * @see #getConverterAnnotation(JavaResourcePersistentAttribute)
+ */
+ JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory);
+
+ /**
+ * Build a new converter and, if necessary, its corresponding converter
+ * annotation.
+ */
+ JavaConverter buildNewConverter(JavaAttributeMapping parent, JpaFactory factory);
+
+ /**
+ * Remove the adapter's converter annotation from the specified
+ * Java resource persistent member.
+ */
+ void removeConverterAnnotation(JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+ }
+
+
+ // ********** abstract adapter **********
+
+ public abstract static class AbstractAdapter
+ implements JavaConverter.Adapter
+ {
+ public JavaConverter buildConverter(JavaAttributeMapping parent, JpaFactory factory) {
+ Annotation annotation = this.getConverterAnnotation(parent.getResourcePersistentAttribute());
+ return (annotation == null) ? null : this.buildConverter(annotation, parent, factory);
+ }
+
+ public Annotation getConverterAnnotation(JavaResourcePersistentAttribute attribute) {
+ return attribute.getAnnotation(this.getAnnotationName());
+ }
+
+ protected abstract String getAnnotationName();
+
+ public JavaConverter buildNewConverter(JavaAttributeMapping parent, JpaFactory factory) {
+ return this.buildConverter(this.buildConverterAnnotationIfNecessary(parent.getResourcePersistentAttribute()), parent, factory);
+ }
+
+ protected Annotation buildConverterAnnotationIfNecessary(JavaResourcePersistentAttribute attribute) {
+ // the annotation may already be present, after we remove the other converter annotations
+ Annotation annotation = this.getConverterAnnotation(attribute);
+ return (annotation != null) ? annotation : this.buildConverterAnnotation(attribute);
+ }
+
+ protected Annotation buildConverterAnnotation(JavaResourcePersistentAttribute attribute) {
+ return attribute.addAnnotation(this.getAnnotationName());
+ }
+
+ public void removeConverterAnnotation(JavaResourcePersistentAttribute attribute) {
+ attribute.removeAnnotation(this.getAnnotationName());
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, ClassName.getSimpleName(this.getAnnotationName()));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java
new file mode 100644
index 0000000000..a6f9bd607f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ConvertibleMapping;
+
+/**
+ * Java attribute mapping that has a converter (e.g. basic, ID, version).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaConvertibleMapping
+ extends ConvertibleMapping, JavaAttributeMapping
+{
+ JavaConverter getConverter();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java
new file mode 100644
index 0000000000..18ca8a5820
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
+
+/**
+ * Java discriminator column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaDiscriminatorColumn
+ extends DiscriminatorColumn, JavaNamedColumn
+{
+ DiscriminatorColumnAnnotation getColumnAnnotation();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing columns to be used in multiple places
+ */
+ interface Owner
+ extends JavaNamedColumn.Owner, DiscriminatorColumn.Owner
+ {
+ // combine two interfaces
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java
new file mode 100644
index 0000000000..f00fca6d49
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+
+/**
+ * Java embeddable type mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaEmbeddable
+ extends Embeddable, JavaTypeMapping
+{
+ EmbeddableAnnotation getMappingAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java
new file mode 100644
index 0000000000..8f066b4392
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
+
+/**
+ * Java embedded ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaEmbeddedIdMapping
+ extends EmbeddedIdMapping, JavaBaseEmbeddedMapping
+{
+ EmbeddedIdAnnotation getMappingAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java
new file mode 100644
index 0000000000..ff6631c380
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.EmbeddedMapping;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
+
+/**
+ * Java embedded mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaEmbeddedMapping
+ extends EmbeddedMapping, JavaBaseEmbeddedMapping
+{
+ EmbeddedAnnotation getMappingAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java
new file mode 100644
index 0000000000..ea466ee4e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+
+/**
+ * Java entity
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaEntity
+ extends Entity, JavaTypeMapping
+{
+ EntityAnnotation getMappingAnnotation();
+
+ JavaTable getTable();
+
+ JavaIdClassReference getIdClassReference();
+
+ JavaDiscriminatorColumn getDiscriminatorColumn();
+
+
+ // ********** secondary tables **********
+
+ ListIterator<JavaSecondaryTable> secondaryTables();
+ ListIterator<JavaSecondaryTable> specifiedSecondaryTables();
+ JavaSecondaryTable addSpecifiedSecondaryTable();
+ JavaSecondaryTable addSpecifiedSecondaryTable(int index);
+
+
+ // ********** primary key join columns **********
+
+ ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+
+ JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
+ String DEFAULT_PRIMARY_KEY_JOIN_COLUMN_PROPERTY = "defaultPrimaryKeyJoinColumn"; //$NON-NLS-1$
+
+
+ // ********** containers **********
+
+ JavaAttributeOverrideContainer getAttributeOverrideContainer();
+ JavaAssociationOverrideContainer getAssociationOverrideContainer();
+ JavaQueryContainer getQueryContainer();
+ JavaGeneratorContainer getGeneratorContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java
new file mode 100644
index 0000000000..ec8671ad3c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+
+/**
+ * Java enumerated converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaEnumeratedConverter
+ extends EnumeratedConverter, JavaConverter
+{
+ // ********** adapter **********
+
+ public static class Adapter
+ extends JavaConverter.AbstractAdapter
+ {
+ private static final Adapter INSTANCE = new Adapter();
+ public static Adapter instance() {
+ return INSTANCE;
+ }
+
+ private Adapter() {
+ super();
+ }
+
+ public Class<? extends Converter> getConverterType() {
+ return EnumeratedConverter.class;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return EnumeratedAnnotation.ANNOTATION_NAME;
+ }
+
+ public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) {
+ return factory.buildJavaEnumeratedConverter(parent, (EnumeratedAnnotation) converterAnnotation);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java
new file mode 100644
index 0000000000..d93495dd04
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.GeneratedValue;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+
+/**
+ * Java generated value
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface JavaGeneratedValue
+ extends GeneratedValue, JavaJpaContextNode
+{
+ GeneratedValueAnnotation getGeneratedValueAnnotation();
+
+ /**
+ * Return the (best guess) text location of the generator.
+ */
+ TextRange getGeneratorTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java
new file mode 100644
index 0000000000..25395aff31
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
+
+/**
+ * Java sequence and table generators
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface JavaGenerator
+ extends Generator, JavaJpaContextNode
+{
+ GeneratorAnnotation getGeneratorAnnotation();
+
+ TextRange getNameTextRange(CompilationUnit astRoot);
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java
new file mode 100644
index 0000000000..8592c86715
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.GeneratorContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+
+/**
+ * Java generator container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaGeneratorContainer
+ extends GeneratorContainer, JavaJpaContextNode
+{
+ // ********** sequence generator **********
+
+ JavaSequenceGenerator getSequenceGenerator();
+
+ JavaSequenceGenerator addSequenceGenerator();
+
+
+ // ********** table generator **********
+
+ JavaTableGenerator getTableGenerator();
+
+ JavaTableGenerator addTableGenerator();
+
+ interface Owner
+ {
+ JavaResourceAnnotatedElement getResourceAnnotatedElement();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java
new file mode 100644
index 0000000000..e21214ca35
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.IdClassReference;
+
+/**
+ * Java ID class reference
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaIdClassReference
+ extends IdClassReference, JavaJpaContextNode
+{
+ /**
+ * Return the fully qualified name of the id class, taking into consideration the default value if applicable
+ */
+ String getFullyQualifiedIdClassName();
+ String FULLY_QUALIFIED_ID_CLASS_PROPERTY = "fullyQualifiedIdClass"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java
new file mode 100644
index 0000000000..7fe82f003d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.IdMapping;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+
+/**
+ * Java ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaIdMapping
+ extends IdMapping, JavaColumnMapping, JavaConvertibleMapping, JavaGeneratorContainer.Owner
+{
+ IdAnnotation getMappingAnnotation();
+
+ JavaGeneratorContainer getGeneratorContainer();
+
+ JavaGeneratedValue getGeneratedValue();
+ JavaGeneratedValue addGeneratedValue();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java
new file mode 100644
index 0000000000..b8510b1d5a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+
+/**
+ * Java join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaJoinColumn
+ extends JoinColumn, JavaBaseJoinColumn, JavaBaseColumn
+{
+ JoinColumnAnnotation getColumnAnnotation();
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends JoinColumn.Owner, JavaBaseJoinColumn.Owner, JavaBaseColumn.Owner
+ {
+ // combine interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java
new file mode 100644
index 0000000000..b42bc14b39
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship;
+
+/**
+ * Java join column relationship (1:1, 1:m, m:1, and association override)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaJoinColumnRelationship
+ extends JoinColumnRelationship, JavaRelationship
+{
+ JavaJoinColumnRelationshipStrategy getJoinColumnStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..cba596937c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
+
+/**
+ * Java join column relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaJoinColumnRelationshipStrategy
+ extends JoinColumnRelationshipStrategy, JavaRelationshipStrategy
+{
+ ListIterator<JavaJoinColumn> joinColumns();
+
+ ListIterator<JavaJoinColumn> specifiedJoinColumns();
+ JavaJoinColumn getSpecifiedJoinColumn(int index);
+ JavaJoinColumn addSpecifiedJoinColumn();
+ JavaJoinColumn addSpecifiedJoinColumn(int index);
+
+ JavaJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java
new file mode 100644
index 0000000000..7d1ac7c54f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * Java join table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaJoinTable
+ extends JoinTable, JavaReferenceTable
+{
+ JavaJoinTableRelationshipStrategy getParent();
+
+ JoinTableAnnotation getTableAnnotation();
+
+
+ // ********** inverse join columns **********
+
+ ListIterator<JavaJoinColumn> inverseJoinColumns();
+
+ ListIterator<JavaJoinColumn> specifiedInverseJoinColumns();
+ JavaJoinColumn getSpecifiedInverseJoinColumn(int index);
+ JavaJoinColumn addSpecifiedInverseJoinColumn();
+ JavaJoinColumn addSpecifiedInverseJoinColumn(int index);
+
+ JavaJoinColumn getDefaultInverseJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java
new file mode 100644
index 0000000000..2418a7d02e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
+
+/**
+ * Java join table relationship (1:1, 1:m, m:1, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaJoinTableRelationship
+ extends JoinTableRelationship, JavaRelationship
+{
+ JavaJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..c6c912fa07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * Java join table relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JavaJoinTableRelationshipStrategy
+ extends JoinTableRelationshipStrategy, JavaRelationshipStrategy
+{
+ JavaJoinTable getJoinTable();
+
+ /**
+ * Return the join table annotation, use a null object instead of returning null
+ * if the join table annotation does not exist.
+ */
+ JoinTableAnnotation getJoinTableAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java
new file mode 100644
index 0000000000..ff33b25ef8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java JPA context node.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JavaJpaContextNode
+ extends JpaContextNode
+{
+ /**
+ * Return the Java code-completion proposals for the specified position
+ * in the source code.
+ */
+ Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot);
+
+
+ // ********** validation **********
+
+ /**
+ * Adds to the list of current validation messages
+ */
+ void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot);
+
+ TextRange getValidationTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java
new file mode 100644
index 0000000000..2158df7c79
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.LobConverter;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+
+/**
+ * Java LOB converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaLobConverter
+ extends LobConverter, JavaConverter
+{
+ // ********** adapter **********
+
+ public static class Adapter
+ extends JavaConverter.AbstractAdapter
+ {
+ private static final Adapter INSTANCE = new Adapter();
+ public static Adapter instance() {
+ return INSTANCE;
+ }
+
+ private Adapter() {
+ super();
+ }
+
+ public Class<? extends Converter> getConverterType() {
+ return LobConverter.class;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return LobAnnotation.ANNOTATION_NAME;
+ }
+
+ public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) {
+ return factory.buildJavaLobConverter(parent, (LobAnnotation) converterAnnotation);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java
new file mode 100644
index 0000000000..9e2544dc8f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ManyToManyMapping;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
+
+/**
+ * Java m:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JavaManyToManyMapping
+ extends ManyToManyMapping, JavaMultiRelationshipMapping
+{
+ ManyToManyAnnotation getMappingAnnotation();
+
+ ManyToManyAnnotation getAnnotationForUpdate();
+
+ JavaManyToManyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java
new file mode 100644
index 0000000000..0ecaef922d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship;
+
+/**
+ * Java m:m relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaManyToManyRelationship
+ extends ManyToManyRelationship,
+ JavaMappedByRelationship,
+ JavaMappingJoinTableRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java
new file mode 100644
index 0000000000..6c7db3b15d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ManyToOneMapping;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
+
+/**
+ * Java m:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JavaManyToOneMapping
+ extends ManyToOneMapping, JavaSingleRelationshipMapping
+{
+ ManyToOneAnnotation getMappingAnnotation();
+
+ JavaManyToOneRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java
new file mode 100644
index 0000000000..c146adb25a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ManyToOneRelationship;
+
+/**
+ * Java m:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaManyToOneRelationship
+ extends ManyToOneRelationship,
+ JavaMappingJoinColumnRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java
new file mode 100644
index 0000000000..4a7fec62be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation;
+
+/**
+ * Java "mapped by" relationship (1:1, 1:m, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaMappedByRelationship
+ extends MappedByRelationship, JavaRelationship
+{
+ JavaMappedByRelationshipStrategy getMappedByStrategy();
+
+ OwnableRelationshipMappingAnnotation getMappingAnnotation();
+
+ OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java
new file mode 100644
index 0000000000..77b3356adb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy;
+
+/**
+ * Java "mapped by" relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaMappedByRelationshipStrategy
+ extends JavaRelationshipStrategy, MappedByRelationshipStrategy
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java
new file mode 100644
index 0000000000..1ccd402c93
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+
+/**
+ * Java mapped superclass
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaMappedSuperclass
+ extends MappedSuperclass, JavaTypeMapping
+{
+ MappedSuperclassAnnotation getMappingAnnotation();
+
+ JavaIdClassReference getIdClassReference();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java
new file mode 100644
index 0000000000..20cd4e734d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+/**
+ * Java mapping join column relationship (1:1, 1:m, m:1)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaMappingJoinColumnRelationship
+ extends JavaJoinColumnRelationship,
+ JavaMappingRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java
new file mode 100644
index 0000000000..027552a3c5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+/**
+ * Java mapping join table relationship (1:1, 1:m, m:1, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaMappingJoinTableRelationship
+ extends JavaJoinTableRelationship,
+ JavaMappingRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java
new file mode 100644
index 0000000000..e47c8299b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.MappingRelationship;
+
+/**
+ * Java mapping relationship (1:1, 1:m, m:1, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaMappingRelationship
+ extends MappingRelationship, JavaRelationship
+{
+ JavaRelationshipMapping getMapping();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java
new file mode 100644
index 0000000000..595c23129a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.MultiRelationshipMapping;
+
+/**
+ * Java multi-valued (1:m, m:m) relationship mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaMultiRelationshipMapping
+ extends MultiRelationshipMapping, JavaRelationshipMapping, JavaCollectionMapping
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java
new file mode 100644
index 0000000000..7607bad56f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
+
+/**
+ * Java
+ * <ul>
+ * <li>column
+ * <li>join column
+ * <li>primary key join column
+ * <li>discriminator column
+ * <li>order column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaNamedColumn
+ extends NamedColumn, JavaJpaContextNode
+{
+ NamedColumnAnnotation getColumnAnnotation();
+
+ /**
+ * Return the (best guess) text location of the column's name.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner
+ extends NamedColumn.Owner
+ {
+ /**
+ * Return the column owner's text range. This can be returned by the
+ * column when its annotation is not present.
+ */
+ TextRange getValidationTextRange(CompilationUnit astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java
new file mode 100644
index 0000000000..0d915857af
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+
+/**
+ * Java named native query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface JavaNamedNativeQuery
+ extends NamedNativeQuery, JavaQuery
+{
+ NamedNativeQueryAnnotation getQueryAnnotation();
+
+ // required to resolve ambiguity
+ ListIterable<JavaQueryHint> getHints();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java
new file mode 100644
index 0000000000..bf742d7a87
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+
+/**
+ * Java named query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface JavaNamedQuery
+ extends NamedQuery, JavaQuery
+{
+ NamedQueryAnnotation getQueryAnnotation();
+
+ // required to resolve ambiguity
+ ListIterable<JavaQueryHint> getHints();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java
new file mode 100644
index 0000000000..dc6461010b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.OneToManyMapping;
+import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
+
+/**
+ * Java 1:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JavaOneToManyMapping
+ extends OneToManyMapping, JavaMultiRelationshipMapping
+{
+ OneToManyAnnotation getMappingAnnotation();
+
+ OneToManyAnnotation getAnnotationForUpdate();
+
+ JavaOneToManyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java
new file mode 100644
index 0000000000..dab064d031
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.OneToManyRelationship;
+
+/**
+ * Java 1:m relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaOneToManyRelationship
+ extends OneToManyRelationship,
+ JavaMappedByRelationship,
+ JavaMappingJoinTableRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java
new file mode 100644
index 0000000000..b98d965be9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.OneToOneMapping;
+import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
+
+/**
+ * Java 1:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JavaOneToOneMapping
+ extends OneToOneMapping, JavaSingleRelationshipMapping
+{
+ OneToOneAnnotation getMappingAnnotation();
+
+ OneToOneAnnotation getAnnotationForUpdate();
+
+ JavaOneToOneRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java
new file mode 100644
index 0000000000..3715ccf9e2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.OneToOneRelationship;
+
+/**
+ * Java 1:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaOneToOneRelationship
+ extends OneToOneRelationship,
+ JavaMappedByRelationship,
+ JavaPrimaryKeyJoinColumnRelationship,
+ JavaMappingJoinColumnRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java
new file mode 100644
index 0000000000..2a5c042baf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Orderable;
+
+/**
+ * Multi-valued (1:m, m:m) relationship mappings support ordering.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOrderable
+ extends Orderable, JavaJpaContextNode
+{
+ JavaAttributeMapping getParent();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java
new file mode 100644
index 0000000000..a7d3f41694
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
+
+/**
+ * Java override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.3
+ */
+public interface JavaOverride
+ extends Override_, JavaReadOnlyOverride
+{
+ JavaVirtualOverride convertToVirtual();
+
+ OverrideAnnotation getOverrideAnnotation();
+
+ /**
+ * Return the (best guess) text location of the override's name.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java
new file mode 100644
index 0000000000..90a62ee8ba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * Java attribute or association override container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOverrideContainer
+ extends OverrideContainer, JavaJpaContextNode
+{
+ ListIterator<? extends JavaReadOnlyOverride> overrides();
+ JavaReadOnlyOverride getOverrideNamed(String name);
+ ListIterator<? extends JavaOverride> specifiedOverrides();
+ JavaOverride getSpecifiedOverride(int index);
+ JavaOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<? extends JavaVirtualOverride> virtualOverrides();
+ JavaVirtualOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ JavaOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+ /**
+ * JPA 2.0
+ * <p>
+ * Return a prefix (<em>without</em> the following <code>'.'</code>)
+ * that may be prepended to the override name.
+ * Return <code>null</code> if no prefix is supported.
+ */
+ String getPossiblePrefix();
+ String getWritePrefix();
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends OverrideContainer.Owner
+ {
+ JavaResourcePersistentMember getResourcePersistentMember();
+
+ TextRange getValidationTextRange(CompilationUnit astRoot);
+
+ /**
+ * JPA 2.0
+ * <p>
+ * Return the prefix (<em>without</em> the following <code>'.'</code>)
+ * to be prepended to the override name.
+ */
+ String getWritePrefix();
+
+ /**
+ * JPA 2.0
+ * <p>
+ * Return a prefix (<em>without</em> the following <code>'.'</code>)
+ * that may be prepended to the override name.
+ * Return <code>null</code> if no prefix is supported.
+ * <p>
+ * JPA 2.0 supports the prefixes <code>"map"</code> and <code>"key"</code>.
+ */
+ String getPossiblePrefix();
+
+ /**
+ * JPA 2.0
+ * <p>
+ * This is necessary for JPA 2.0 because an override annotation for an
+ * element collection can have a name with a prefix that indicates
+ * whether the override applies to element collection's embedded key or
+ * value. Return whether the specified override name, which may have a
+ * prefix, is relevant to the override container.
+ * <p>
+ * JPA 2.0 supports the prefixes <code>"map"</code> and <code>"key"</code>.
+ */
+ boolean isRelevant(String overrideName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java
new file mode 100644
index 0000000000..bd7bfedc49
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
+
+/**
+ * Java association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOverrideRelationship
+ extends OverrideRelationship,
+ JavaJoinColumnRelationship
+{
+ JavaAssociationOverride getAssociationOverride();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java
new file mode 100644
index 0000000000..27b1653476
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jpa.core.context.CollectionMapping;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * Context Java persistent <em>attribute</em> (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaPersistentAttribute
+ extends PersistentAttribute, JavaJpaContextNode
+{
+ // ********** mapping **********
+
+ JavaAttributeMapping getMapping();
+
+ JavaAttributeMapping setMappingKey(String key);
+
+
+ // ********** misc **********
+
+ /**
+ * Return the "resource" persistent attribute.
+ */
+ JavaResourcePersistentAttribute getResourcePersistentAttribute();
+
+ /**
+ * Return whether the attribute contains the given offset into the text file.
+ */
+ boolean contains(int offset, CompilationUnit astRoot);
+
+ /**
+ * Return the embeddable (type mapping) corresponding to the persistent
+ * attribute's type. Return <code>null</code> if it is not found.
+ */
+ Embeddable getEmbeddable();
+
+ /**
+ * Return whether the attribute is a field (as opposed to a property).
+ */
+ boolean isField();
+
+ /**
+ * Return whether the attribute is a property (as opposed to a field).
+ */
+ boolean isProperty();
+
+ /**
+ * Return whether the attribute is 'public', which is problematic for fields.
+ */
+ boolean isPublic();
+
+ /**
+ * Return whether the attribute is 'final', which is problematic.
+ */
+ boolean isFinal();
+
+
+ // ********** type **********
+
+ /**
+ * Return whether the attribute's type is valid for a default basic mapping.
+ */
+ boolean typeIsBasic();
+
+ /**
+ * Return the attribute's type name if it is valid as a target type
+ * (i.e. the type is neither an array nor a "container").
+ */
+ String getSingleReferenceTargetTypeName();
+
+ /**
+ * If the attribute's type is an appropriate "container" type,
+ * return the type parameter that can be used as a target type.
+ * Return null if the attribute is not a container or if the type
+ * parameter is not valid as a target type (i.e. it is either
+ * an array or a "container").
+ */
+ String getMultiReferenceTargetTypeName();
+
+ /**
+ * If the attribute's type is a map type,
+ * return the type parameter that can be used as a key type.
+ * Return null if the attribute is not a map or if the type
+ * parameter is not valid as a key type (i.e. it is either
+ * an array or a "container").
+ */
+ String getMultiReferenceMapKeyTypeName();
+
+ /**
+ * Return the JpaContainer that corresponds to this attribute's type.
+ * Return a null implementation if the type is not a container (map or collection)
+ */
+ JpaContainerDefinition getJpaContainerDefinition();
+
+
+ // ********** JPA container **********
+
+ /**
+ * JPA container definition interface (and null implementation)
+ */
+ interface JpaContainerDefinition {
+ String getTypeName();
+ boolean isContainer();
+ boolean isMap();
+ String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute);
+ String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute);
+ String getMetamodelContainerFieldTypeName();
+ String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping);
+
+ final class Null implements JpaContainerDefinition {
+ public static final JpaContainerDefinition INSTANCE = new Null();
+ public static JpaContainerDefinition instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public String getTypeName() {
+ return null;
+ }
+ public boolean isContainer() {
+ return false;
+ }
+ public boolean isMap() {
+ return false;
+ }
+ public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ return null;
+ }
+ public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ return null;
+ }
+ public String getMetamodelContainerFieldTypeName() {
+ return JPA2_0.COLLECTION_ATTRIBUTE;
+ }
+ public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) {
+ return null;
+ }
+ @Override
+ public String toString() {
+ return JpaContainerDefinition.class.getSimpleName() + ".Null"; //$NON-NLS-1$
+ }
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java
new file mode 100644
index 0000000000..0ab09a0dc5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Context Java persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaPersistentType
+ extends PersistentType, JavaJpaContextNode
+{
+ // ********** covariant overrides **********
+
+ JavaTypeMapping getMapping();
+
+ @SuppressWarnings("unchecked")
+ ListIterator<JavaPersistentAttribute> attributes();
+ String ATTRIBUTES_LIST = "attributes"; //$NON-NLS-1$
+
+ JavaPersistentAttribute getAttributeNamed(String attributeName);
+
+
+ // ********** Java **********
+
+ /**
+ * Return whether any attribute in this persistent type is annotated
+ */
+ boolean hasAnyAnnotatedAttributes();
+
+ /**
+ * Return the Java resource persistent type.
+ */
+ JavaResourcePersistentType getResourcePersistentType();
+
+ JavaPersistentAttribute getAttributeFor(JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..6c047186b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+
+/**
+ * Java primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface JavaPrimaryKeyJoinColumn
+ extends PrimaryKeyJoinColumn, JavaBaseJoinColumn
+{
+ PrimaryKeyJoinColumnAnnotation getColumnAnnotation();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java
new file mode 100644
index 0000000000..6c47161927
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationship;
+
+/**
+ * Java primary key join column relationship (1:1)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaPrimaryKeyJoinColumnRelationship
+ extends PrimaryKeyJoinColumnRelationship,
+ JavaMappingRelationship
+{
+ JavaPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..16158a0615
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy;
+
+/**
+ * Java primary key join column relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaPrimaryKeyJoinColumnRelationshipStrategy
+ extends JavaRelationshipStrategy, PrimaryKeyJoinColumnRelationshipStrategy
+{
+ ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ JavaPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index);
+ JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn();
+ JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java
new file mode 100644
index 0000000000..9dbea1e546
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
+
+/**
+ * Java named and named native queries
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface JavaQuery
+ extends Query, JavaJpaContextNode
+{
+ QueryAnnotation getQueryAnnotation();
+
+
+ // ********** hints **********
+
+ @SuppressWarnings("unchecked")
+ ListIterable<JavaQueryHint> getHints();
+
+ JavaQueryHint addHint();
+
+ JavaQueryHint addHint(int index);
+
+
+ // ********** validation **********
+
+ TextRange getNameTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java
new file mode 100644
index 0000000000..6f7afe6241
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.QueryContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+
+/**
+ * Java query container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaQueryContainer
+ extends QueryContainer, JavaJpaContextNode
+{
+ // ********** named queries **********
+
+ @SuppressWarnings("unchecked")
+ ListIterator<JavaNamedQuery> namedQueries();
+
+ JavaNamedQuery addNamedQuery();
+
+ JavaNamedQuery addNamedQuery(int index);
+
+
+ // ********** named native queries **********
+
+ @SuppressWarnings("unchecked")
+ ListIterator<JavaNamedNativeQuery> namedNativeQueries();
+
+ JavaNamedNativeQuery addNamedNativeQuery();
+
+ JavaNamedNativeQuery addNamedNativeQuery(int index);
+
+ interface Owner
+ {
+ JavaResourceAnnotatedElement getResourceAnnotatedElement();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java
new file mode 100644
index 0000000000..859b893437
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.QueryHint;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+
+/**
+ * Java query hint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface JavaQueryHint
+ extends QueryHint, JavaJpaContextNode
+{
+ QueryHintAnnotation getQueryHintAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java
new file mode 100644
index 0000000000..69afbc01ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
+
+/**
+ * Java read-only association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaReadOnlyAssociationOverride
+ extends ReadOnlyAssociationOverride, JavaReadOnlyOverride
+{
+ JavaAssociationOverrideContainer getContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java
new file mode 100644
index 0000000000..1f552eeaee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
+
+/**
+ * Read-only Java attribute override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaReadOnlyAttributeOverride
+ extends ReadOnlyAttributeOverride, JavaReadOnlyOverride
+{
+ JavaAttributeOverrideContainer getContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java
new file mode 100644
index 0000000000..530c455545
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
+
+/**
+ * Read-only Java override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaReadOnlyOverride
+ extends ReadOnlyOverride, JavaJpaContextNode
+{
+ JavaOverrideContainer getContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java
new file mode 100644
index 0000000000..59aae9e166
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
+
+/**
+ * Java relationship (join column, join table, mapped by, primary key join
+ * column, mapping)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaReadOnlyRelationship
+ extends ReadOnlyRelationship, JavaJpaContextNode
+{
+ JavaReadOnlyRelationshipStrategy getStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java
new file mode 100644
index 0000000000..196563f5ce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
+
+/**
+ * Java read-only relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaReadOnlyRelationshipStrategy
+ extends ReadOnlyRelationshipStrategy, JavaJpaContextNode
+{
+ JavaReadOnlyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java
new file mode 100644
index 0000000000..f0d2546f07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
+
+/**
+ * Java read-only unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaReadOnlyUniqueConstraint
+ extends ReadOnlyUniqueConstraint, JavaJpaContextNode
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java
new file mode 100644
index 0000000000..d65d9fe62e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.ReferenceTable;
+import org.eclipse.jpt.jpa.core.resource.java.ReferenceTableAnnotation;
+
+/**
+ * Java reference table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaReferenceTable
+ extends ReferenceTable, JavaTable
+{
+ ReferenceTableAnnotation getTableAnnotation();
+
+
+ // ********** join columns **********
+
+ ListIterator<JavaJoinColumn> joinColumns();
+
+ ListIterator<JavaJoinColumn> specifiedJoinColumns();
+ JavaJoinColumn getSpecifiedJoinColumn(int index);
+ JavaJoinColumn addSpecifiedJoinColumn();
+ JavaJoinColumn addSpecifiedJoinColumn(int index);
+
+ JavaJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java
new file mode 100644
index 0000000000..088cd7bd3a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Relationship;
+
+/**
+ * Java relationship (join column, join table, mapped by, primary key join
+ * column, mapping)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaRelationship
+ extends Relationship, JavaReadOnlyRelationship
+{
+ JavaRelationshipStrategy getStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java
new file mode 100644
index 0000000000..7636c3885d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
+
+/**
+ * Java relationship (1:1, 1:m, m:1, m:m) mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaRelationshipMapping
+ extends RelationshipMapping, JavaAttributeMapping
+{
+ RelationshipMappingAnnotation getMappingAnnotation();
+
+ RelationshipMappingAnnotation getAnnotationForUpdate();
+
+ JavaCascade getCascade();
+
+ JavaMappingRelationship getRelationship();
+
+ /**
+ * If the target entity is specified, this will return it fully qualified.
+ * If not specified, it returns the default target entity, which is always
+ * fully qualified
+ */
+ String getFullyQualifiedTargetEntity();
+ String FULLY_QUALIFIED_TARGET_ENTITY_PROPERTY = "fullyQualifiedTargetEntity"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java
new file mode 100644
index 0000000000..f658507620
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
+
+/**
+ * Java relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JavaRelationshipStrategy
+ extends RelationshipStrategy, JavaReadOnlyRelationshipStrategy
+{
+ JavaRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java
new file mode 100644
index 0000000000..27b74cab7c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.SecondaryTable;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+
+/**
+ * Java secondary table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface JavaSecondaryTable
+ extends SecondaryTable, JavaTable
+{
+ JavaEntity getParent();
+
+ SecondaryTableAnnotation getTableAnnotation();
+
+
+ // ********** primary key join columns **********
+
+ ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
+ JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+ JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java
new file mode 100644
index 0000000000..f00727d412
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+
+/**
+ * Java sequence generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface JavaSequenceGenerator
+ extends JavaGenerator, SequenceGenerator
+{
+ SequenceGeneratorAnnotation getGeneratorAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java
new file mode 100644
index 0000000000..fc688ddfff
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.SingleRelationshipMapping;
+import org.eclipse.jpt.jpa.core.resource.java.SingleRelationshipMappingAnnotation;
+
+/**
+ * Java single (m:1, 1:1) mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JavaSingleRelationshipMapping
+ extends SingleRelationshipMapping, JavaRelationshipMapping
+{
+ SingleRelationshipMappingAnnotation getMappingAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java
new file mode 100644
index 0000000000..e95b3def50
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface JavaStructureNodes
+{
+ String COMPILATION_UNIT_ID =
+ JptJpaCorePlugin.PLUGIN_ID + ".java.compilationUnit"; //$NON-NLS-1$
+
+ String PERSISTENT_TYPE_ID =
+ JptJpaCorePlugin.PLUGIN_ID + ".java.persistentType"; //$NON-NLS-1$
+
+ String PERSISTENT_ATTRIBUTE_ID =
+ JptJpaCorePlugin.PLUGIN_ID + ".java.persistentAttribute"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java
new file mode 100644
index 0000000000..e270eee2f1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
+
+/**
+ * Java table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface JavaTable
+ extends Table, JavaJpaContextNode
+{
+ BaseTableAnnotation getTableAnnotation();
+
+ TextRange getNameTextRange(CompilationUnit astRoot);
+ TextRange getSchemaTextRange(CompilationUnit astRoot);
+ TextRange getCatalogTextRange(CompilationUnit astRoot);
+
+ ListIterator<JavaUniqueConstraint> uniqueConstraints();
+ JavaUniqueConstraint getUniqueConstraint(int index);
+ JavaUniqueConstraint addUniqueConstraint();
+ JavaUniqueConstraint addUniqueConstraint(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java
new file mode 100644
index 0000000000..ee8dba64e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.TableGenerator;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+
+/**
+ * Java table generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface JavaTableGenerator
+ extends JavaGenerator, TableGenerator
+{
+ TableGeneratorAnnotation getGeneratorAnnotation();
+
+ @SuppressWarnings("unchecked")
+ Iterable<JavaUniqueConstraint> getUniqueConstraints();
+
+ JavaUniqueConstraint addUniqueConstraint(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java
new file mode 100644
index 0000000000..a05540642d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.TemporalConverter;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+/**
+ * Java temporal converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaTemporalConverter
+ extends TemporalConverter, JavaConverter
+{
+ // ********** adapter **********
+
+ public static class Adapter
+ extends JavaConverter.AbstractAdapter
+ {
+ private static final Adapter INSTANCE = new Adapter();
+ public static Adapter instance() {
+ return INSTANCE;
+ }
+
+ private Adapter() {
+ super();
+ }
+
+ public Class<? extends Converter> getConverterType() {
+ return TemporalConverter.class;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return TemporalAnnotation.ANNOTATION_NAME;
+ }
+
+ public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) {
+ return factory.buildJavaTemporalConverter(parent, (TemporalAnnotation) converterAnnotation);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java
new file mode 100644
index 0000000000..eed007e2aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.TransientMapping;
+import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
+
+/**
+ * Java transient "mapping"
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface JavaTransientMapping
+ extends JavaAttributeMapping, TransientMapping
+{
+ TransientAnnotation getMappingAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java
new file mode 100644
index 0000000000..034db01fe9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.Iterator;
+
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java type mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaTypeMapping
+ extends TypeMapping, JavaJpaContextNode
+{
+ JavaResourcePersistentType getResourcePersistentType();
+
+ Annotation getMappingAnnotation();
+
+
+ // ********** covariant overrides **********
+
+ JavaPersistentType getPersistentType();
+
+ @SuppressWarnings("unchecked")
+ Iterator<JavaAttributeMapping> attributeMappings();
+
+ @SuppressWarnings("unchecked")
+ Iterable<JavaAttributeMapping> getAttributeMappings(String mappingKey);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java
new file mode 100644
index 0000000000..28dfa505e0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * Map a string key to a type mapping and its corresponding
+ * Java annotations.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaTypeMappingDefinition
+{
+ /**
+ * Return the type mapping's key.
+ */
+ String getKey();
+
+ /**
+ * Return the name of the type mapping's annotation.
+ */
+ String getAnnotationName();
+
+ /**
+ * Return the names of the type mapping's "supporting" annotations.
+ */
+ Iterable<String> getSupportingAnnotationNames();
+
+ /**
+ * Build a Java type mapping for the specified persistent type and
+ * annotation.
+ * Use the specified factory for creation so extenders can simply override
+ * the appropriate factory method instead of building a definition for the
+ * same key.
+ */
+ JavaTypeMapping buildMapping(JavaPersistentType persistentType, Annotation annotation, JpaFactory factory);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java
new file mode 100644
index 0000000000..9073653d88
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+/**
+ * Java unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface JavaUniqueConstraint
+ extends UniqueConstraint, JavaReadOnlyUniqueConstraint
+{
+ UniqueConstraintAnnotation getUniqueConstraintAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java
new file mode 100644
index 0000000000..d74d02a75b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VersionMapping;
+import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
+
+/**
+ * Java version mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaVersionMapping
+ extends VersionMapping, JavaColumnMapping, JavaConvertibleMapping
+{
+ VersionAnnotation getMappingAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java
new file mode 100644
index 0000000000..37ca150230
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualAssociationOverride;
+
+/**
+ * Java virtual association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualAssociationOverride
+ extends VirtualAssociationOverride,
+ JavaVirtualOverride,
+ JavaReadOnlyAssociationOverride
+{
+ JavaVirtualOverrideRelationship getRelationship();
+
+ JavaAssociationOverride convertToSpecified();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java
new file mode 100644
index 0000000000..8687426537
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualAttributeOverride;
+
+/**
+ * Java virtual attribute override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualAttributeOverride
+ extends VirtualAttributeOverride,
+ JavaVirtualOverride,
+ JavaReadOnlyAttributeOverride
+{
+ JavaAttributeOverride convertToSpecified();
+
+ JavaVirtualColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java
new file mode 100644
index 0000000000..6b5161bfa6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.VirtualColumn;
+
+/**
+ * Java virtual column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualColumn
+ extends VirtualColumn, JavaJpaContextNode
+{
+ /**
+ * The overridden column can be either a Java join column or an
+ * <code>orm.xml</code> join column; so we don't change the return type
+ * here.
+ */
+ Column getOverriddenColumn();
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends VirtualColumn.Owner
+ {
+ /**
+ * The overridden column can be either a Java column or an
+ * <code>orm.xml</code> column; so we don't change the return type here.
+ */
+ Column resolveOverriddenColumn();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java
new file mode 100644
index 0000000000..f3f4a2d24d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.VirtualJoinColumn;
+
+/**
+ * Java virtual join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualJoinColumn
+ extends VirtualJoinColumn, JavaJpaContextNode
+{
+ /**
+ * The overridden join column can be either a Java join column or an
+ * <code>orm.xml</code> join column; so we don't change the return type
+ * here.
+ */
+ JoinColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java
new file mode 100644
index 0000000000..dfb9d21642
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationship;
+
+/**
+ * Java virtual join column relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualJoinColumnRelationship
+ extends VirtualJoinColumnRelationship,
+ JavaVirtualRelationship
+{
+ JavaVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..b9b9bc4c10
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy;
+
+/**
+ * Java virtual join column relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualJoinColumnRelationshipStrategy
+ extends VirtualJoinColumnRelationshipStrategy, JavaVirtualRelationshipStrategy
+{
+ ListIterator<JavaVirtualJoinColumn> joinColumns();
+ ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns();
+ JavaVirtualJoinColumn getSpecifiedJoinColumn(int index);
+ JavaVirtualJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java
new file mode 100644
index 0000000000..c6da69c644
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.VirtualJoinTable;
+
+/**
+ * Java virtual join table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualJoinTable
+ extends VirtualJoinTable, JavaJpaContextNode
+{
+ JavaVirtualJoinTableRelationshipStrategy getParent();
+
+ ListIterator<JavaVirtualUniqueConstraint> uniqueConstraints();
+ JavaVirtualUniqueConstraint getUniqueConstraint(int index);
+
+ ListIterator<JavaVirtualJoinColumn> joinColumns();
+ ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns();
+ JavaVirtualJoinColumn getSpecifiedJoinColumn(int index);
+ JavaVirtualJoinColumn getDefaultJoinColumn();
+
+ ListIterator<JavaVirtualJoinColumn> inverseJoinColumns();
+ ListIterator<JavaVirtualJoinColumn> specifiedInverseJoinColumns();
+ JavaVirtualJoinColumn getSpecifiedInverseJoinColumn(int index);
+ JavaVirtualJoinColumn getDefaultInverseJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java
new file mode 100644
index 0000000000..5f2963c8b2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationship;
+
+/**
+ * Java virtual join table relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualJoinTableRelationship
+ extends VirtualJoinTableRelationship,
+ JavaVirtualRelationship
+{
+ JavaVirtualJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..7c8ea38e78
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationshipStrategy;
+
+/**
+ * Java virtual join table relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualJoinTableRelationshipStrategy
+ extends VirtualJoinTableRelationshipStrategy, JavaVirtualRelationshipStrategy
+{
+ JavaVirtualJoinTable getJoinTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java
new file mode 100644
index 0000000000..576234b13b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+
+/**
+ * Java virtual<ul>
+ * <li>attribute override
+ * <li>association override
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualOverride
+ extends VirtualOverride, JavaReadOnlyOverride
+{
+ JavaOverride convertToSpecified();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java
new file mode 100644
index 0000000000..970fb1ba45
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualOverrideRelationship;
+
+/**
+ * Java virtual association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualOverrideRelationship
+ extends VirtualOverrideRelationship,
+ JavaVirtualJoinColumnRelationship
+{
+ JavaVirtualAssociationOverride getAssociationOverride();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java
new file mode 100644
index 0000000000..fb03325c31
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualRelationship;
+
+/**
+ * Java virtual relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualRelationship
+ extends VirtualRelationship, JavaReadOnlyRelationship
+{
+ JavaVirtualRelationshipStrategy getStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java
new file mode 100644
index 0000000000..850754310e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.VirtualRelationshipStrategy;
+
+/**
+ * Java virtual strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualRelationshipStrategy
+ extends VirtualRelationshipStrategy, JavaReadOnlyRelationshipStrategy
+{
+ JavaVirtualRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java
new file mode 100644
index 0000000000..d2363e24e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.VirtualUniqueConstraint;
+
+/**
+ * Java virtual database unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualUniqueConstraint
+ extends VirtualUniqueConstraint, JavaReadOnlyUniqueConstraint
+{
+ /**
+ * The overridden unique constraint can be either a Java unique constraint
+ * or an <code>orm.xml</code> unique constraint; so we don't change the
+ * return type here.
+ */
+ UniqueConstraint getOverriddenUniqueConstraint();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
new file mode 100644
index 0000000000..ab518ac108
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Context model corresponding to the
+ * XML resource model {@link XmlEntityMappings},
+ * which corresponds to the <code>entity-mappings</code> element
+ * in the <code>orm.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+*/
+public interface EntityMappings
+ extends MappingFileRoot, PersistentType.Owner, PersistentTypeContainer
+{
+ /**
+ * Covariant override.
+ */
+ OrmXml getParent();
+
+ XmlEntityMappings getXmlEntityMappings();
+
+ String getVersion();
+
+ String getDescription();
+ void setDescription(String description);
+ String DESCRIPTION_PROPERTY = "description"; //$NON-NLS-1$
+
+ /**
+ * "The <code>package</code> subelement specifies the package of the
+ * classes listed within the subelements and attributes of the same mapping
+ * file only. The <code>package</code> subelement is overridden if the fully
+ * qualified class name is specified for a class and the two disagree."
+ * <p>
+ * <strong>NB:</strong> No mention of how to resolve duplicates in the
+ * "default" package or sub-packages:<ul>
+ * <li><code>Bar</code> (in "default" package) vs. <code>foo.Bar</code>
+ * <li><code>baz.Bar</code> vs. <code>foo.baz.Bar</code>
+ * </ul>
+ * when package is specified as <code>foo</code>.
+ */
+ String getPackage();
+ void setPackage(String package_);
+ String PACKAGE_PROPERTY = "package"; //$NON-NLS-1$
+
+ AccessType getSpecifiedAccess();
+ void setSpecifiedAccess(AccessType access);
+ String SPECIFIED_ACCESS_PROPERTY = "specifiedAccess"; //$NON-NLS-1$
+ AccessType getDefaultAccess();
+ String DEFAULT_ACCESS_PROPERTY = "defaultAccess"; //$NON-NLS-1$
+
+ /**
+ * Return the database schema container, which can be either a catalog or,
+ * if the database does not support catalogs, the database itself.
+ */
+ SchemaContainer getDbSchemaContainer();
+
+ String getSpecifiedCatalog();
+ void setSpecifiedCatalog(String catalog);
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$
+ Catalog getDbCatalog();
+
+ String getSpecifiedSchema();
+ void setSpecifiedSchema(String schema);
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$
+ Schema getDbSchema();
+
+ /**
+ * Covariant override.
+ */
+ OrmPersistenceUnitMetadata getPersistenceUnitMetadata();
+
+ /**
+ * Covariant override.
+ */
+ ListIterable<OrmPersistentType> getPersistentTypes();
+ int getPersistentTypesSize();
+ OrmPersistentType addPersistentType(String mappingKey, String className);
+ void removePersistentType(int index);
+ void removePersistentType(OrmPersistentType persistentType);
+ //void movePersistentType(int targetIndex, int sourceIndex);
+ boolean containsPersistentType(String className);
+ /**
+ * Return the persistent type listed in the mapping file
+ * with the specified type name. Return null if none exists.
+ */
+ OrmPersistentType getPersistentType(String className);
+ String PERSISTENT_TYPES_LIST = "persistentTypes"; //$NON-NLS-1$
+
+ ListIterable<OrmSequenceGenerator> getSequenceGenerators();
+ int getSequenceGeneratorsSize();
+ OrmSequenceGenerator addSequenceGenerator();
+ OrmSequenceGenerator addSequenceGenerator(int index);
+ void removeSequenceGenerator(int index);
+ void removeSequenceGenerator(OrmSequenceGenerator sequenceGenerator);
+ void moveSequenceGenerator(int targetIndex, int sourceIndex);
+ String SEQUENCE_GENERATORS_LIST = "sequenceGenerators"; //$NON-NLS-1$
+
+ ListIterable<OrmTableGenerator> getTableGenerators();
+ int getTableGeneratorsSize();
+ OrmTableGenerator addTableGenerator();
+ OrmTableGenerator addTableGenerator(int index);
+ void removeTableGenerator(int index);
+ void removeTableGenerator(OrmTableGenerator tableGenerator);
+ void moveTableGenerator(int targetIndex, int sourceIndex);
+ String TABLE_GENERATORS_LIST = "tableGenerators"; //$NON-NLS-1$
+
+ OrmQueryContainer getQueryContainer();
+
+ /**
+ * Return the default package to be used for persistent types in this
+ * context.
+ */
+ String getDefaultPersistentTypePackage();
+
+ void changeMapping(OrmPersistentType ormPersistentType, OrmTypeMapping oldMapping, OrmTypeMapping newMapping);
+
+ boolean containsOffset(int textOffset);
+
+ /**
+ * Return the Java resource persistent type for the specified class name
+ * found in the JPA project. First look for one with the specified
+ * name (since it might be fully qualified). If not found, prepend the
+ * default package name and try again.
+ *
+ * @see #getPackage()
+ */
+ JavaResourcePersistentType resolveJavaResourcePersistentType(String className);
+
+ /**
+ * Return the persistent type for the specified class name
+ * found in the persistence unit. First look for one with the specified
+ * name (since it might be fully qualified). If not found, prepend the
+ * default package name and try again.
+ *
+ * @see #getPackage()
+ */
+ PersistentType resolvePersistentType(String className);
+
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create DeleteEdits for deleting references (if any) to the type about to be deleted.
+ * Return an EmptyIterable if there are not any references to the given type.
+ */
+ Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java
new file mode 100644
index 0000000000..fa9ef11e5b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+
+/**
+ * A JPA platform can support multiple mapping files. Each will
+ * have a unique resource type and must be defined with a mapping file definition.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MappingFileDefinition
+ extends ResourceDefinition
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java
new file mode 100644
index 0000000000..fa21aa9a48
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public class NullOrmAttributeMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new NullOrmAttributeMappingDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private NullOrmAttributeMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ throw new UnsupportedOperationException();
+ }
+
+ public OrmAttributeMapping buildContextMapping(OrmPersistentAttribute parent, XmlAttributeMapping resourceMapping, OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmNullAttributeMapping(parent, (XmlNullAttributeMapping) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java
new file mode 100644
index 0000000000..697d5f397e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+
+/**
+ * <code>orm.xml</code> association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmAssociationOverride
+ extends OrmReadOnlyAssociationOverride, AssociationOverride, OrmOverride
+{
+ OrmVirtualAssociationOverride convertToVirtual();
+
+ XmlAssociationOverride getXmlOverride();
+
+ OrmOverrideRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java
new file mode 100644
index 0000000000..bf2956fa23
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+
+/**
+ * <code>orm.xml</code> association override container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmAssociationOverrideContainer
+ extends AssociationOverrideContainer, OrmOverrideContainer
+{
+ ListIterator<OrmReadOnlyAssociationOverride> overrides();
+ OrmReadOnlyAssociationOverride getOverrideNamed(String name);
+ ListIterator<OrmAssociationOverride> specifiedOverrides();
+ OrmAssociationOverride getSpecifiedOverride(int index);
+ OrmAssociationOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<OrmVirtualAssociationOverride> virtualOverrides();
+ OrmVirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ OrmAssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends AssociationOverrideContainer.Owner, OrmOverrideContainer.Owner
+ {
+ @SuppressWarnings("unchecked")
+ EList<XmlAssociationOverride> getXmlOverrides();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java
new file mode 100644
index 0000000000..9c298bf8fb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * <code>orm.xml</code> attribute mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.3
+ */
+public interface OrmAttributeMapping
+ extends AttributeMapping, XmlContextNode
+{
+ OrmPersistentAttribute getParent();
+
+ OrmPersistentAttribute getPersistentAttribute();
+
+ XmlAttributeMapping getXmlAttributeMapping();
+
+ OrmTypeMapping getTypeMapping();
+
+ void setName(String name);
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Attributes are a sequence in the <code>orm.xml</code> schema. We must keep
+ * the list of attributes in the appropriate order so the WTP XML
+ * translators will write them to the XML document in that order and they
+ * will adhere to the schema.
+ * <p>
+ * Each implementation must implement this
+ * method and return a number that matches its order in the schema.
+ */
+ int getXmlSequence();
+
+ void addXmlAttributeMappingTo(Attributes resourceAttributes);
+
+ void removeXmlAttributeMappingFrom(Attributes resourceAttributes);
+
+ boolean contains(int textOffset);
+
+ TextRange getSelectionTextRange();
+
+ TextRange getNameTextRange();
+
+
+ // ********** morphing mappings **********
+
+ void initializeOn(OrmAttributeMapping newMapping);
+
+ void initializeFromOrmAttributeMapping(OrmAttributeMapping oldMapping);
+
+ void initializeFromOrmBasicMapping(OrmBasicMapping oldMapping);
+
+ void initializeFromOrmIdMapping(OrmIdMapping oldMapping);
+
+ void initializeFromOrmTransientMapping(OrmTransientMapping oldMapping);
+
+ void initializeFromOrmEmbeddedMapping(OrmEmbeddedMapping oldMapping);
+
+ void initializeFromOrmEmbeddedIdMapping(OrmEmbeddedIdMapping oldMapping);
+
+ void initializeFromOrmVersionMapping(OrmVersionMapping oldMapping);
+
+ void initializeFromOrmOneToManyMapping(OrmOneToManyMapping oldMapping);
+
+ void initializeFromOrmManyToOneMapping(OrmManyToOneMapping oldMapping);
+
+ void initializeFromOrmOneToOneMapping(OrmOneToOneMapping oldMapping);
+
+ void initializeFromOrmManyToManyMapping(OrmManyToManyMapping oldMapping);
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java
new file mode 100644
index 0000000000..d6f5e55b84
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+
+/**
+ * Part of mechanism to extend the types of <code>orm.xml</code> attribute
+ * mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmAttributeMappingDefinition
+{
+ /**
+ * Return the definition's mapping key.
+ */
+ String getKey();
+
+ /**
+ * Build a resource mapping.
+ */
+ XmlAttributeMapping buildResourceMapping(EFactory factory);
+
+ /**
+ * Build a context mapping.
+ */
+ OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java
new file mode 100644
index 0000000000..1a3ea76ffe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+
+/**
+ * <code>orm.xml</code> attribute override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmAttributeOverride
+ extends OrmReadOnlyAttributeOverride, AttributeOverride, OrmOverride
+{
+ OrmVirtualAttributeOverride convertToVirtual();
+
+ XmlAttributeOverride getXmlOverride();
+
+ OrmColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java
new file mode 100644
index 0000000000..f74f7175ac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+
+/**
+ * <code>orm.xml</code> attribute override container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmAttributeOverrideContainer
+ extends AttributeOverrideContainer, OrmOverrideContainer
+{
+ ListIterator<OrmReadOnlyAttributeOverride> overrides();
+ OrmReadOnlyAttributeOverride getOverrideNamed(String name);
+ ListIterator<OrmAttributeOverride> specifiedOverrides();
+ OrmAttributeOverride getSpecifiedOverride(int index);
+ OrmAttributeOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<OrmVirtualAttributeOverride> virtualOverrides();
+ OrmVirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ OrmAttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+ void initializeFrom(OrmAttributeOverrideContainer oldContainer);
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends AttributeOverrideContainer.Owner, OrmOverrideContainer.Owner
+ {
+ @SuppressWarnings("unchecked")
+ EList<XmlAttributeOverride> getXmlOverrides();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java
new file mode 100644
index 0000000000..a25338f4a5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn;
+
+/**
+ * <code>orm.xml</code> column or join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmBaseColumn
+ extends BaseColumn, OrmNamedColumn
+{
+ AbstractXmlColumn getXmlColumn();
+
+ /**
+ * Return the (best guess) text location of the column's table.
+ */
+ TextRange getTableTextRange();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner
+ extends OrmNamedColumn.Owner, BaseColumn.Owner
+ {
+ // combine two interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java
new file mode 100644
index 0000000000..17d8d1d110
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.BaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded;
+
+/**
+ * Behavior common to <code>orm.xml</code> embedded and embedded ID mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmBaseEmbeddedMapping
+ extends BaseEmbeddedMapping, OrmAttributeMapping
+{
+ AbstractXmlEmbedded getXmlAttributeMapping();
+
+ OrmAttributeOverrideContainer getAttributeOverrideContainer();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java
new file mode 100644
index 0000000000..32600b6ec1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+
+/**
+ * <code>orm.xml</code> join column or primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmBaseJoinColumn
+ extends BaseJoinColumn, OrmNamedColumn
+{
+ /**
+ * Return the (best guess) text location of the column's
+ * referenced column name.
+ */
+ TextRange getReferencedColumnNameTextRange();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing join columns to be used in multiple places
+ * (e.g. 1:1 mappings and join tables)
+ */
+ interface Owner
+ extends BaseJoinColumn.Owner, OrmNamedColumn.Owner
+ {
+ // combine two interfaces
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java
new file mode 100644
index 0000000000..f691894c99
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.BasicMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
+
+/**
+ * <code>orm.xml</code> basic mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmBasicMapping
+ extends BasicMapping, OrmColumnMapping, OrmConvertibleMapping
+{
+ XmlBasic getXmlAttributeMapping();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java
new file mode 100644
index 0000000000..f8333ad944
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Cascade;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> cascade (persist, merge, remove, refresh)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmCascade
+ extends Cascade, XmlContextNode
+{
+ void initializeFrom(Cascade oldCascade);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java
new file mode 100644
index 0000000000..aae5833bcf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.CollectionMapping;
+
+/**
+ * JPA <code>orm.xml</code> collection mapping (e.g. 1:m, m:m, element collection)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmCollectionMapping
+ extends CollectionMapping, OrmAttributeMapping
+{
+ OrmOrderable getOrderable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java
new file mode 100644
index 0000000000..0d5cde88fa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+
+/**
+ * <code>orm.xml</code> column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmColumn
+ extends Column, OrmBaseColumn
+{
+ XmlColumn getXmlColumn();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner
+ extends OrmBaseColumn.Owner
+ {
+ XmlColumn getXmlColumn();
+
+ XmlColumn buildXmlColumn();
+
+ void removeXmlColumn();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java
new file mode 100644
index 0000000000..0f8f85695f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ColumnMapping;
+
+/**
+ * <code>orm.xml</code> column mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface OrmColumnMapping
+ extends ColumnMapping, OrmAttributeMapping, OrmColumn.Owner
+{
+ OrmColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java
new file mode 100644
index 0000000000..2e8001eb7e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * <code>orm.xml</code> converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.1
+ */
+public interface OrmConverter
+ extends Converter, XmlContextNode
+{
+ OrmAttributeMapping getParent();
+
+ /**
+ * We need this "hack" because we can't build the resource converter before
+ * we build the context converter. There is no resource "converter", just a
+ * simple setting on the mapping. (Maybe "converter" is not the best way to
+ * model what is going on here....)
+ */
+ void initialize();
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+
+ // ********** adapter **********
+
+ /**
+ * This interface allows a convertible mapping to interact with various
+ * <code>orm.xml</code> converters via the same protocol.
+ */
+ public interface Adapter
+ {
+ /**
+ * Return the type of converter handled by the adapter.
+ */
+ Class<? extends Converter> getConverterType();
+
+ /**
+ * Build a converter for specified mapping
+ * if the mapping's XML has the adapter's value set.
+ * Return <code>null</code> otherwise.
+ * This is used to build a converter during construction of the
+ * converter's mapping.
+ */
+ OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory);
+
+ /**
+ * Return whether the specified XML mapping has the
+ * adapter's value set. If the adapter is active and the context
+ * mapping's converter does not match the adapter, the mapping will
+ * build a new converter (via the adapter).
+ *
+ * @see #buildNewConverter(OrmAttributeMapping, OrmXmlContextNodeFactory)
+ */
+ boolean isActive(XmlConvertibleMapping xmlMapping);
+
+ /**
+ * Build a converter for specified mapping.
+ * This is used when the context model is synchronized with the
+ * resource model (and the resource model has changed) or when a client
+ * changes a mapping's converter.
+ * The appropriate setting in the XML mapping will be configured once
+ * the context converter has been added to the context model (see {@link
+ * OrmConverter#initialize()}.
+ *
+ * @see #isActive(XmlConvertibleMapping)
+ */
+ OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory);
+
+ /**
+ * Clear the adapter's XML value from the specified XML mapping.
+ */
+ void clearXmlValue(XmlConvertibleMapping xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java
new file mode 100644
index 0000000000..ebfdafbd42
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ConvertibleMapping;
+
+/**
+ * <code>orm.xml</code> attribute mapping that has a
+ * converter (e.g. basic, ID, version).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmConvertibleMapping
+ extends ConvertibleMapping, OrmAttributeMapping
+{
+ OrmConverter getConverter();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java
new file mode 100644
index 0000000000..246a6581db
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn;
+
+/**
+ * <code>orm.xml</code> discriminator column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OrmDiscriminatorColumn
+ extends DiscriminatorColumn, OrmNamedColumn
+{
+ XmlDiscriminatorColumn getXmlColumn();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing discriminator columns to be used in multiple places
+ */
+ interface Owner
+ extends OrmNamedColumn.Owner, DiscriminatorColumn.Owner
+ {
+ XmlDiscriminatorColumn getXmlColumn();
+
+ XmlDiscriminatorColumn buildXmlColumn();
+
+ void removeXmlColumn();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java
new file mode 100644
index 0000000000..03861f395b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+
+/**
+ * <code>orm.xml</code> embeddable type mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmEmbeddable
+ extends Embeddable, OrmTypeMapping
+{
+ XmlEmbeddable getXmlTypeMapping();
+
+ JavaEmbeddable getJavaTypeMapping();
+
+ JavaEmbeddable getJavaTypeMappingForDefaults();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java
new file mode 100644
index 0000000000..84ec06f7da
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
+
+/**
+ * <code>orm.xml</code> embedded ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmEmbeddedIdMapping
+ extends EmbeddedIdMapping, OrmBaseEmbeddedMapping
+{
+ XmlEmbeddedId getXmlAttributeMapping();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java
new file mode 100644
index 0000000000..4587e93bae
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.EmbeddedMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
+
+/**
+ * <code>orm.xml</code> embedded mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmEmbeddedMapping
+ extends EmbeddedMapping, OrmBaseEmbeddedMapping
+{
+ XmlEmbedded getXmlAttributeMapping();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java
new file mode 100644
index 0000000000..505e4d7ff5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+
+/**
+ * <code>orm.xml</code> entity
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmEntity
+ extends Entity, OrmTypeMapping
+{
+ XmlEntity getXmlTypeMapping();
+
+ JavaEntity getJavaTypeMapping();
+
+ JavaEntity getJavaTypeMappingForDefaults();
+
+ OrmTable getTable();
+
+ OrmIdClassReference getIdClassReference();
+
+ OrmDiscriminatorColumn getDiscriminatorColumn();
+
+
+ // ********** secondary tables **********
+
+ ListIterator<ReadOnlySecondaryTable> secondaryTables();
+ ListIterator<OrmSecondaryTable> specifiedSecondaryTables();
+ OrmSecondaryTable addSpecifiedSecondaryTable();
+ OrmSecondaryTable addSpecifiedSecondaryTable(int index);
+
+ /**
+ * Return the virtual (not specified) secondary tables.
+ */
+ ListIterator<OrmVirtualSecondaryTable> virtualSecondaryTables();
+ String VIRTUAL_SECONDARY_TABLES_LIST = "virtualSecondaryTables"; //$NON-NLS-1$
+
+ /**
+ * Return the number of virtual secondary tables.
+ */
+ int virtualSecondaryTablesSize();
+
+ /**
+ * Return true if there are no virtual secondary tables on the orm entity.
+ * This is used to determine whether you can add specified secondary tables.
+ * You must first make sure all virtual secondary tables have been specified
+ * in xml before adding more. This is because adding one secondary table to xml
+ * will override all the secondary tables specified in the java entity
+ */
+ boolean secondaryTablesAreDefinedInXml();
+
+ /**
+ * If true, then all virtual secondary tables are added in as specified secondary tables to the xml.
+ * If false, then all the specified secondary tables are remvoed from the xml.
+ */
+ void setSecondaryTablesAreDefinedInXml(boolean defineInXml);
+
+
+ // ********** primary key join columns **********
+
+ ListIterator<ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
+ OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+
+ ListIterator<ReadOnlyPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns();
+ String DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST = "defaultPrimaryKeyJoinColumns"; //$NON-NLS-1$
+
+
+ // ********** containers **********
+
+ OrmAttributeOverrideContainer getAttributeOverrideContainer();
+ OrmAssociationOverrideContainer getAssociationOverrideContainer();
+ OrmQueryContainer getQueryContainer();
+ OrmGeneratorContainer getGeneratorContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java
new file mode 100644
index 0000000000..859883f98b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
+
+/**
+ * <code>orm.xml</code> enumerated converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmEnumeratedConverter
+ extends EnumeratedConverter, OrmConverter
+{
+ // ********** adapter **********
+
+ public static class Adapter
+ implements OrmConverter.Adapter
+ {
+ private static final Adapter INSTANCE = new Adapter();
+ public static Adapter instance() {
+ return INSTANCE;
+ }
+
+ private Adapter() {
+ super();
+ }
+
+ public Class<? extends Converter> getConverterType() {
+ return EnumeratedConverter.class;
+ }
+
+ public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) {
+ XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping();
+ return (xmlMapping.getEnumerated() == null) ? null : factory.buildOrmEnumeratedConverter(parent);
+ }
+
+ public boolean isActive(XmlConvertibleMapping xmlMapping) {
+ return xmlMapping.getEnumerated() != null;
+ }
+
+ public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmEnumeratedConverter(parent);
+ }
+
+ public void clearXmlValue(XmlConvertibleMapping xmlMapping) {
+ xmlMapping.setEnumerated(null);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java
new file mode 100644
index 0000000000..f42e8c098b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.GeneratedValue;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
+
+/**
+ * <code>orm.xml</code> generated value
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmGeneratedValue
+ extends GeneratedValue, XmlContextNode
+{
+ XmlGeneratedValue getXmlGeneratedValue();
+
+ /**
+ * Return the (best guess) text location of the generator.
+ */
+ TextRange getGeneratorTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java
new file mode 100644
index 0000000000..cd1791fd1f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator;
+
+/**
+ * <code>orm.xml</code> sequence and table generators
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface OrmGenerator
+ extends Generator, XmlContextNode
+{
+ XmlGenerator getXmlGenerator();
+
+ TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java
new file mode 100644
index 0000000000..b858c265f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.GeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> generator container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmGeneratorContainer
+ extends GeneratorContainer, XmlContextNode
+{
+ // ********** sequence generator **********
+
+ OrmSequenceGenerator getSequenceGenerator();
+
+ OrmSequenceGenerator addSequenceGenerator();
+
+
+ // ********** table generator **********
+
+ OrmTableGenerator getTableGenerator();
+
+ OrmTableGenerator addTableGenerator();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java
new file mode 100644
index 0000000000..c27612bedc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.context.IdClassReference;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * <code>orm.xml</code> ID class reference
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.3
+ */
+public interface OrmIdClassReference
+ extends IdClassReference, XmlContextNode
+{
+ // ********** refactoring **********
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+
+ // ********** owner **********
+
+ interface Owner {
+ XmlIdClassContainer getXmlIdClassContainer();
+ JavaIdClassReference getJavaIdClassReferenceForDefaults();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java
new file mode 100644
index 0000000000..1b6be0b6dd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.IdMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
+
+/**
+ * <code>orm.xml</code> ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmIdMapping
+ extends IdMapping, OrmColumnMapping, OrmConvertibleMapping
+{
+ XmlId getXmlAttributeMapping();
+
+ OrmGeneratorContainer getGeneratorContainer();
+
+ OrmGeneratedValue getGeneratedValue();
+ OrmGeneratedValue addGeneratedValue();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java
new file mode 100644
index 0000000000..2699ae3a4a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+
+/**
+ * <code>orm.xml</code> join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmJoinColumn
+ extends JoinColumn, OrmBaseJoinColumn, OrmBaseColumn
+{
+ XmlJoinColumn getXmlColumn();
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends JoinColumn.Owner, OrmBaseJoinColumn.Owner, OrmBaseColumn.Owner
+ {
+ // combine interfaces
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java
new file mode 100644
index 0000000000..e99324dbd7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer;
+
+/**
+ * <code>orm.xml</code> join column relationship
+ * (1:1, 1:m, m:1, and association override)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmJoinColumnRelationship
+ extends JoinColumnRelationship, OrmRelationship
+{
+ XmlJoinColumnContainer getXmlContainer();
+
+ OrmJoinColumnRelationshipStrategy getJoinColumnStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..3f01842efa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
+
+/**
+ * <code>orm.xml</code> join column relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmJoinColumnRelationshipStrategy
+ extends JoinColumnRelationshipStrategy, OrmRelationshipStrategy
+{
+ ListIterator<OrmJoinColumn> joinColumns();
+
+ ListIterator<OrmJoinColumn> specifiedJoinColumns();
+ OrmJoinColumn getSpecifiedJoinColumn(int index);
+ OrmJoinColumn addSpecifiedJoinColumn();
+ OrmJoinColumn addSpecifiedJoinColumn(int index);
+
+ OrmJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java
new file mode 100644
index 0000000000..4d3d7a27bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+
+/**
+ * <code>orm.xml</code> join table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmJoinTable
+ extends JoinTable, OrmReferenceTable
+{
+ OrmJoinTableRelationshipStrategy getParent();
+
+ // ********** inverse join columns **********
+
+ ListIterator<OrmJoinColumn> inverseJoinColumns();
+
+ ListIterator<OrmJoinColumn> specifiedInverseJoinColumns();
+ OrmJoinColumn getSpecifiedInverseJoinColumn(int index);
+ OrmJoinColumn addSpecifiedInverseJoinColumn();
+ OrmJoinColumn addSpecifiedInverseJoinColumn(int index);
+
+ OrmJoinColumn getDefaultInverseJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java
new file mode 100644
index 0000000000..8d15df3467
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer;
+
+/**
+ * <code>orm.xml</code> join table relationship (1:1, 1:m, m:1, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmJoinTableRelationship
+ extends JoinTableRelationship, OrmRelationship
+{
+ XmlJoinTableContainer getXmlContainer();
+
+ OrmJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..f35384d08e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
+
+/**
+ * <code>orm.xml</code> join table relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmJoinTableRelationshipStrategy
+ extends JoinTableRelationshipStrategy, OrmRelationshipStrategy
+{
+ OrmJoinTable getJoinTable();
+
+ XmlJoinTable getXmlJoinTable();
+
+ XmlJoinTable buildXmlJoinTable();
+
+ void removeXmlJoinTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java
new file mode 100644
index 0000000000..f1a29164b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.LobConverter;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
+
+/**
+ * <code>orm.xml</code> LOB converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmLobConverter
+ extends LobConverter, OrmConverter
+{
+ // ********** adapter **********
+
+ public static class Adapter
+ implements OrmConverter.Adapter
+ {
+ private static final Adapter INSTANCE = new Adapter();
+ public static Adapter instance() {
+ return INSTANCE;
+ }
+
+ private Adapter() {
+ super();
+ }
+
+ public Class<? extends Converter> getConverterType() {
+ return LobConverter.class;
+ }
+
+ public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) {
+ XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping();
+ return xmlMapping.isLob() ? factory.buildOrmLobConverter(parent) : null;
+ }
+
+ public boolean isActive(XmlConvertibleMapping xmlMapping) {
+ return xmlMapping.isLob();
+ }
+
+ public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmLobConverter(parent);
+ }
+
+ public void clearXmlValue(XmlConvertibleMapping xmlMapping) {
+ xmlMapping.setLob(false);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java
new file mode 100644
index 0000000000..de5e5ecb0b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ManyToManyMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+
+/**
+ * <code>orm.xml</code> m:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OrmManyToManyMapping
+ extends ManyToManyMapping, OrmMultiRelationshipMapping
+{
+ XmlManyToMany getXmlAttributeMapping();
+
+ OrmManyToManyRelationship getRelationship();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java
new file mode 100644
index 0000000000..f2f2d7edc0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+
+/**
+ * <code>orm.xml</code> m:m relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmManyToManyRelationship
+ extends ManyToManyRelationship,
+ OrmMappedByRelationship,
+ OrmMappingJoinTableRelationship
+{
+ XmlManyToMany getXmlContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java
new file mode 100644
index 0000000000..1bd07cf10a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ManyToOneMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+
+/**
+ * <code>orm.xml</code> m:1 mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OrmManyToOneMapping
+ extends ManyToOneMapping, OrmSingleRelationshipMapping
+{
+ XmlManyToOne getXmlAttributeMapping();
+
+ OrmManyToOneRelationship getRelationship();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java
new file mode 100644
index 0000000000..c7b47fd010
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ManyToOneRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+
+/**
+ * <code>orm.xml</code> m:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmManyToOneRelationship
+ extends ManyToOneRelationship, OrmMappingJoinColumnRelationship
+{
+ XmlManyToOne getXmlContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java
new file mode 100644
index 0000000000..2ac19206a8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping;
+
+/**
+ * <code>orm.xml</code> "mapped by" relationship (1:1, 1:m, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmMappedByRelationship
+ extends MappedByRelationship, OrmRelationship
+{
+ XmlMappedByMapping getXmlContainer();
+
+ OrmMappedByRelationshipStrategy getMappedByStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java
new file mode 100644
index 0000000000..cc250f2d6c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy;
+
+/**
+ * <code>orm.xml</code> "mapped by" relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmMappedByRelationshipStrategy
+ extends OrmRelationshipStrategy, MappedByRelationshipStrategy
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java
new file mode 100644
index 0000000000..437675b778
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
+
+/**
+ * <code>orm.xml</code> mapped superclass
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmMappedSuperclass
+ extends MappedSuperclass, OrmTypeMapping
+{
+ XmlMappedSuperclass getXmlTypeMapping();
+
+ OrmIdClassReference getIdClassReference();
+
+ JavaMappedSuperclass getJavaTypeMapping();
+
+ JavaMappedSuperclass getJavaTypeMappingForDefaults();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java
new file mode 100644
index 0000000000..504846fb08
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+/**
+ * <code>orm.xml</code> mapping join column relationship (1:1, 1:m, m:1)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmMappingJoinColumnRelationship
+ extends OrmJoinColumnRelationship, OrmMappingRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java
new file mode 100644
index 0000000000..72403bbef2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+/**
+ * <code>orm.xml</code> mapping join table relationship (1:1, 1:m, m:1, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmMappingJoinTableRelationship
+ extends OrmJoinTableRelationship,
+ OrmMappingRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java
new file mode 100644
index 0000000000..d366671163
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.MappingRelationship;
+
+/**
+ * <code>orm.xml</code> mapping relationship (1:1, 1:m, m:1, m:m)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface OrmMappingRelationship
+ extends MappingRelationship, OrmRelationship
+{
+ OrmRelationshipMapping getMapping();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java
new file mode 100644
index 0000000000..6408e6f1a5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.MultiRelationshipMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping;
+
+/**
+ * <code>orm.xml</code> multi-valued (1:m, m:m) relationship mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmMultiRelationshipMapping
+ extends MultiRelationshipMapping, OrmRelationshipMapping, OrmCollectionMapping
+{
+ AbstractXmlMultiRelationshipMapping getXmlAttributeMapping();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java
new file mode 100644
index 0000000000..ff7236a4bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn;
+
+
+/**
+ * <code>orm.xml</code>
+ * <ul>
+ * <li>column
+ * <li>join column
+ * <li>primary key join column
+ * <li>discriminator column
+ * <li>order column
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmNamedColumn
+ extends NamedColumn, XmlContextNode
+{
+ AbstractXmlNamedColumn getXmlColumn();
+
+ /**
+ * Return the (best guess) text location of the column's name.
+ */
+ TextRange getNameTextRange();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner
+ extends NamedColumn.Owner
+ {
+ /**
+ * Return the column owner's text range. This can be returned by the
+ * column when its annotation is not present.
+ */
+ TextRange getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java
new file mode 100644
index 0000000000..bde37c1a12
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
+
+/**
+ * <code>orm.xml</code> named native query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmNamedNativeQuery
+ extends OrmQuery, NamedNativeQuery
+{
+ XmlNamedNativeQuery getXmlQuery();
+
+ // required to resolve ambiguity
+ ListIterable<OrmQueryHint> getHints();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java
new file mode 100644
index 0000000000..fc5aba360e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
+
+/**
+ * <code>orm.xml</code> named query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmNamedQuery
+ extends OrmQuery, NamedQuery
+{
+ XmlNamedQuery getXmlQuery();
+
+ // required to resolve ambiguity
+ ListIterable<OrmQueryHint> getHints();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java
new file mode 100644
index 0000000000..c984cb9004
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.OneToManyMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+
+/**
+ * <code>orm.xml</code> 1:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmOneToManyMapping
+ extends OneToManyMapping, OrmMultiRelationshipMapping
+{
+ XmlOneToMany getXmlAttributeMapping();
+
+ OrmOneToManyRelationship getRelationship();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java
new file mode 100644
index 0000000000..a37d64d5de
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.OneToManyRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+
+/**
+ * <code>orm.xml</code> 1:m relationship reference
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmOneToManyRelationship
+ extends OneToManyRelationship,
+ OrmMappedByRelationship,
+ OrmMappingJoinTableRelationship
+{
+ XmlOneToMany getXmlContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java
new file mode 100644
index 0000000000..51bfe95b55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.OneToOneMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+
+/**
+ * <code>orm.xml</code> 1:1 mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OrmOneToOneMapping
+ extends OneToOneMapping, OrmSingleRelationshipMapping
+{
+ XmlOneToOne getXmlAttributeMapping();
+
+ OrmOneToOneRelationship getRelationship();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java
new file mode 100644
index 0000000000..2947aadeb6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.OneToOneRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+
+/**
+ * <code>orm.xml</code> 1:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmOneToOneRelationship
+ extends OneToOneRelationship,
+ OrmMappedByRelationship,
+ OrmPrimaryKeyJoinColumnRelationship,
+ OrmMappingJoinColumnRelationship
+{
+ XmlOneToOne getXmlContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java
new file mode 100644
index 0000000000..96c78052cf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Orderable;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * Multi-valued (1:m, m:m) relationship mappings support ordering.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOrderable
+ extends Orderable, XmlContextNode
+{
+ OrmAttributeMapping getParent();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java
new file mode 100644
index 0000000000..2bd280da20
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
+
+/**
+ * <code>orm.xml</code> override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmOverride
+ extends Override_, OrmReadOnlyOverride
+{
+ OrmVirtualOverride convertToVirtual();
+
+ XmlOverride getXmlOverride();
+
+ /**
+ * Return the (best guess) text location of the override's name.
+ */
+ TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java
new file mode 100644
index 0000000000..fb15a1aadc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
+
+/**
+ * <code>orm.xml</code> attribute or association override container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOverrideContainer
+ extends OverrideContainer, XmlContextNode
+{
+ ListIterator<? extends OrmReadOnlyOverride> overrides();
+ OrmReadOnlyOverride getOverrideNamed(String name);
+ ListIterator<? extends OrmOverride> specifiedOverrides();
+ OrmOverride getSpecifiedOverride(int index);
+ OrmOverride getSpecifiedOverrideNamed(String name);
+ ListIterator<? extends OrmVirtualOverride> virtualOverrides();
+ OrmVirtualOverride convertOverrideToVirtual(Override_ specifiedOverride);
+ OrmOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
+
+
+ interface Owner
+ extends OverrideContainer.Owner
+ {
+ <T extends XmlOverride> EList<T> getXmlOverrides();
+
+ OrmTypeMapping getTypeMapping();
+
+ TextRange getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java
new file mode 100644
index 0000000000..dd2f0f4baf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+
+/**
+ * <code>orm.xml</code> association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOverrideRelationship
+ extends OverrideRelationship,
+ OrmJoinColumnRelationship
+{
+ OrmAssociationOverride getAssociationOverride();
+
+ XmlAssociationOverride getXmlContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java
new file mode 100644
index 0000000000..f912d1067f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * Context model corresponding to the
+ * XML resource model {@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults},
+ * which corresponds to the <code>persistence-unit-defaults</code> element
+ * in the <code>orm.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public interface OrmPersistenceUnitDefaults
+ extends MappingFilePersistenceUnitDefaults
+{
+ /**
+ * Covariant override.
+ */
+ OrmPersistenceUnitMetadata getParent();
+
+ // ********** access **********
+ void setAccess(AccessType value);
+ String ACCESS_PROPERTY = "access"; //$NON-NLS-1$
+
+ // ********** schema container **********
+ SchemaContainer getDbSchemaContainer();
+
+ // ********** catalog **********
+ String getSpecifiedCatalog();
+ void setSpecifiedCatalog(String newSpecifiedCatalog);
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$
+ Catalog getDbCatalog();
+
+ // ********** schema **********
+ String getSpecifiedSchema();
+ void setSpecifiedSchema(String newSpecifiedSchema);
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$
+ Schema getDbSchema();
+
+ // ********** cascade persist **********
+ void setCascadePersist(boolean value);
+ String CASCADE_PERSIST_PROPERTY = "cascadePersist"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java
new file mode 100644
index 0000000000..ae87ffc6bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
+
+/**
+ * Context <code>orm.xml</code> persistence unit metadata.
+ * Context model corresponding to the
+ * XML resource model {@link XmlPersistenceUnitMetadata},
+ * which corresponds to the <code>persistence-unit-metadata</code> element
+ * in the <code>orm.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmPersistenceUnitMetadata
+ extends MappingFilePersistenceUnitMetadata
+{
+ /**
+ * Covariant override.
+ */
+ EntityMappings getParent();
+
+ /**
+ * This can be <code>null</code>. The context metadata is always present,
+ * even if the XML metadata is missing.
+ */
+ XmlEntityMappings getXmlEntityMappings();
+ void setXmlMappingMetadataComplete(boolean xmlMappingMetadataComplete);
+ String XML_MAPPING_METADATA_COMPLETE_PROPERTY = "xmlMappingMetadataComplete"; //$NON-NLS-1$
+
+ OrmPersistenceUnitDefaults getPersistenceUnitDefaults();
+
+ XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata();
+ XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate();
+ void removeXmlPersistenceUnitMetadataIfUnset();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java
new file mode 100644
index 0000000000..b660504f2f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Context <code>orm.xml</code> persistent <em>attribute</em>
+ * (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface OrmPersistentAttribute
+ extends PersistentAttribute, OrmReadOnlyPersistentAttribute
+{
+ /**
+ * Return an <code>orm.xml</code> mapping since the attribute is
+ * <em>specified</em>.
+ */
+ OrmAttributeMapping getMapping();
+
+ /**
+ * Convert the (currently specified) attribute to a virtual attribute.
+ * The attribute will be removed
+ * from the list of specified attributes
+ * and removed from the <code>orm.xml</code> file. Return the new attribute.
+ * Return <code>null</code> if the attribute does not correspond to an
+ * attribute in the Java persistent type.
+ * <p>
+ * @see #isVirtual()
+ * @see #setMappingKey(String)
+ */
+ OrmReadOnlyPersistentAttribute convertToVirtual();
+
+ OrmAttributeMapping setMappingKey(String key);
+
+ /**
+ * Called by the attribute's mapping when it's name changes,
+ * effectively changing the attribute's name.
+ */
+ void nameChanged(String oldName, String newName);
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
new file mode 100644
index 0000000000..b0b82a3b03
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * <code>orm.xml</code> persistent type
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface OrmPersistentType
+ extends PersistentType, PersistentType.Owner, XmlContextNode
+{
+ // ********** covariant overrides **********
+
+ EntityMappings getParent();
+
+ OrmTypeMapping getMapping();
+
+ /**
+ * Return a combination of the persistent type's <em>specified</em> and
+ * <em>virtual</em> attributes. The <em>specified</em> attributes are those
+ * explicitly listed in the <code>orm.xml</code> file; while the
+ * <em>virtual</em> attributes are those derived from the corresponding
+ * Java persistent type.
+ */
+ @SuppressWarnings("unchecked")
+ ListIterator<OrmReadOnlyPersistentAttribute> attributes();
+
+ OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName);
+
+
+ // ********** specified attributes **********
+
+ String SPECIFIED_ATTRIBUTES_LIST = "specifiedAttributes"; //$NON-NLS-1$
+
+ /**
+ * Return the persistent type's specified attributes.
+ */
+ ListIterator<OrmPersistentAttribute> specifiedAttributes();
+
+ /**
+ * Return the number of the persistent type's specified attributes.
+ */
+ int specifiedAttributesSize();
+
+ // TODO this is currently only used by tests; remove it and change tests to use
+ // OrmReadOnlyPersistenAttribute.convertToSpecified(String mappingKey)
+ OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName);
+
+
+ // ********** virtual attributes **********
+
+ String VIRTUAL_ATTRIBUTES_LIST = "virtualAttributes"; //$NON-NLS-1$
+
+ /**
+ * Return virtual <code>orm.xml</code> persistent attributes. These
+ * are attributes that exist in the corresponding Java class, but are not
+ * specified in the <code>orm.xml</code>.
+ */
+ ListIterator<OrmReadOnlyPersistentAttribute> virtualAttributes();
+
+ /**
+ * Return the number of virtual <code>orm.xml</code> persistent attributes.
+ * @see #virtualAttributes()
+ */
+ int virtualAttributesSize();
+
+ /**
+ * Convert the specified attribute to a virtual attribute. Remove the
+ * attribute from the type's list of specified attributes
+ * and remove it from the <code>orm.xml</code> file. Return the new
+ * (virtual) attribute.
+ * Return <code>null</code> if the specified attribute does not correspond
+ * to an attribute in the Java persistent type.
+ * <p>
+ * Throw an {@link IllegalArgumentException} if the attribute is already
+ * virtual.
+ *
+ * @see OrmPersistentAttribute#convertToVirtual()
+ */
+ OrmReadOnlyPersistentAttribute convertAttributeToVirtual(OrmPersistentAttribute specifiedAttribute);
+
+ /**
+ * Add the specified persistent attribute to the <code>orm.xml</code>.
+ * The attribute will be added to the <code>orm.xml</code> and moved
+ * from the list of virtual attributes to the list
+ * of specified attributes. It will keep the same mapping it had, either
+ * specified in a Java annotation or the default.
+ * <p>
+ * Throw an {@link IllegalArgumentException} if the attribute is already
+ * specified.
+ *
+ * @see OrmPersistentAttribute#convertToSpecified()
+ */
+ OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute);
+
+ /**
+ * Add the specified persistent attribute to the <code>orm.xml</code> with
+ * the specified mapping. The attribute will be added to the
+ * <code>orm.xml</code> and moved from the list of virtual attributes to
+ * the list of specified attributes.
+ * <p>
+ * Throw an {@link IllegalArgumentException} if the attribute is already
+ * specified.
+ *
+ * @see OrmPersistentAttribute#convertToSpecified(String)
+ */
+ OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey);
+
+
+ // ********** mapping morphing **********
+
+ /**
+ * This is called whenever the specified persistent attribute's mapping is
+ * changed as specified.
+ */
+ void changeMapping(OrmPersistentAttribute ormPersistentAttribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping);
+
+
+ // ********** refactoring **********
+
+ /**
+ * If this {@link OrmPersistentType#isFor(String)} the given IType, create a text
+ * DeleteEdit for deleting the type mapping element and any text that precedes it.
+ * Otherwise return an EmptyIterable.
+ * Though this will contain 1 or 0 DeleteEdits, using an Iterable
+ * for ease of use with other createDeleteEdit API.
+ */
+ Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+
+ // ********** misc **********
+
+ boolean contains(int textOffset);
+
+ /**
+ * This is called by the persistent type's mapping when its class
+ * (name) changes.
+ */
+ void mappingClassChanged(String oldClass, String newClass);
+
+ /**
+ * Return the Java persistent type that is referred to by the
+ * <code>orm.xml</code> persistent type.
+ * Return <code>null</code> if it is missing.
+ */
+ JavaPersistentType getJavaPersistentType();
+ String JAVA_PERSISTENT_TYPE_PROPERTY = "javaPersistentType"; //$NON-NLS-1$
+
+ /**
+ * Return the persistent type's default package.
+ */
+ String getDefaultPackage();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..0b451cc727
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
+
+/**
+ * <code>orm.xml</code> primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmPrimaryKeyJoinColumn
+ extends PrimaryKeyJoinColumn, OrmBaseJoinColumn
+{
+ XmlPrimaryKeyJoinColumn getXmlColumn();
+
+ void initializeFrom(ReadOnlyPrimaryKeyJoinColumn oldColumn);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java
new file mode 100644
index 0000000000..c8d304ed52
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer;
+
+/**
+ * <code>orm.xml</code> primary key join column relationship (1:1)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmPrimaryKeyJoinColumnRelationship
+ extends PrimaryKeyJoinColumnRelationship, OrmMappingRelationship
+{
+ XmlPrimaryKeyJoinColumnContainer getXmlContainer();
+
+ OrmPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..3333e28146
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy;
+
+/**
+ * <code>orm.xml</code> primary key join column relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmPrimaryKeyJoinColumnRelationshipStrategy
+ extends OrmRelationshipStrategy, PrimaryKeyJoinColumnRelationshipStrategy
+{
+ ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ OrmPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index);
+ OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn();
+ OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java
new file mode 100644
index 0000000000..7275bea005
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQuery;
+
+/**
+ * <code>orm.xml</code> named and named native queries
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmQuery
+ extends Query, XmlContextNode
+{
+ XmlQuery getXmlQuery();
+
+
+ // ********** hints **********
+
+ @SuppressWarnings("unchecked")
+ ListIterable<OrmQueryHint> getHints();
+
+ OrmQueryHint addHint();
+
+ OrmQueryHint addHint(int index);
+
+
+ // ********** validation **********
+
+ TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java
new file mode 100644
index 0000000000..4ef6ed563e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.QueryContainer;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> query container
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmQueryContainer
+ extends QueryContainer, XmlContextNode
+{
+ // ********** named queries **********
+
+ @SuppressWarnings("unchecked")
+ ListIterator<OrmNamedQuery> namedQueries();
+
+ OrmNamedQuery addNamedQuery();
+
+ OrmNamedQuery addNamedQuery(int index);
+
+
+ // ********** named native queries **********
+
+ @SuppressWarnings("unchecked")
+ ListIterator<OrmNamedNativeQuery> namedNativeQueries();
+
+ OrmNamedNativeQuery addNamedNativeQuery();
+
+ OrmNamedNativeQuery addNamedNativeQuery(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java
new file mode 100644
index 0000000000..beffe63141
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.QueryHint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
+
+/**
+ * <code>orm.xml</code> query hint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmQueryHint
+ extends QueryHint, XmlContextNode
+{
+ XmlQueryHint getXmlQueryHint();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java
new file mode 100644
index 0000000000..e751769020
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
+
+/**
+ * <code>orm.xml</code> association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmReadOnlyAssociationOverride
+ extends ReadOnlyAssociationOverride, OrmReadOnlyOverride
+{
+ OrmAssociationOverrideContainer getContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java
new file mode 100644
index 0000000000..344971592a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
+
+/**
+ * Read-only <code>orm.xml</code> attribute override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmReadOnlyAttributeOverride
+ extends ReadOnlyAttributeOverride, OrmReadOnlyOverride
+{
+ OrmAttributeOverrideContainer getContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java
new file mode 100644
index 0000000000..410c599958
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * Read-only <code>orm.xml</code> override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmReadOnlyOverride
+ extends ReadOnlyOverride, XmlContextNode
+{
+ OrmOverrideContainer getContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java
new file mode 100644
index 0000000000..6995be47ff
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * Read-only context <code>orm.xml</code> persistent <em>attribute</em>
+ * (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmReadOnlyPersistentAttribute
+ extends ReadOnlyPersistentAttribute, XmlContextNode
+{
+ /**
+ * A <em>specified</em> <code>orm.xml</code> attribute will return an
+ * <code>orm.xml</code> mapping, while a <em>virtual</em> attribute will
+ * return a Java mapping. If the attribute is <em>virtual</em>, the returned
+ * (Java) mapping is also <em>virtual</em>; i.e. it is read-only and is not to
+ * be modified (nor are any of its parts). The modifiable Java
+ * mapping can be retrieved via the modifiable Java attribute:
+ * {@link #resolveJavaPersistentAttribute()}.
+ */
+ AttributeMapping getMapping();
+
+ OrmPersistentType getOwningPersistentType();
+
+ OrmTypeMapping getOwningTypeMapping();
+
+ /**
+ * If the <code>orm.xml</code> attribute is <em>virtual</em>, the returned Java
+ * attribute is also <em>virtual</em>; i.e. it is read-only and is not to
+ * be modified (nor are any of its parts [e.g. column]). The modifiable Java
+ * attribute can be retrieved via {@link #resolveJavaPersistentAttribute()}.
+ */
+ JavaPersistentAttribute getJavaPersistentAttribute();
+ String JAVA_PERSISTENT_ATTRIBUTE_PROPERTY = "javaPersistentAttribute"; //$NON-NLS-1$
+
+ /**
+ * Return the <code>orm.xml</code> attribute's Java attribute; which, in the
+ * case of <em>virtual</em> attributes, is not the same Java attribute as
+ * returned by {@link #getJavaPersistentAttribute()}.
+ * <p>
+ * This is probably useful only to tests; since nothing else will want to
+ * modify the returned Java attribute.
+ */
+ JavaPersistentAttribute resolveJavaPersistentAttribute();
+
+ JavaResourcePersistentAttribute getJavaResourcePersistentAttribute();
+
+ boolean contains(int textOffset);
+
+
+ // ********** virtual -> specified **********
+
+ /**
+ * Convert the (currently virtual) attribute to a specified
+ * attribute. The attribute will be added to the list of specified
+ * attributes and added to the <code>orm.xml</code> file. The mapping will
+ * remain the same. Return the new attribute.
+ * @see #isVirtual()
+ * @throw IllegalStateException if the attribute is already specified
+ */
+ OrmPersistentAttribute convertToSpecified();
+
+ /**
+ * Convert the (currently virtual) persistent attribute to a specified
+ * attribute. The attribute will be added to the list of specified
+ * attributes and added to the <code>orm.xml</code> file. The mapping will
+ * be changed according to the specified mapping key.
+ * Return the new attribute.
+ * @see #isVirtual()
+ * @throw IllegalStateException if the attribute is already specified
+ */
+ OrmPersistentAttribute convertToSpecified(String mappingKey);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java
new file mode 100644
index 0000000000..09e3b7ebca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> relationship (join column, join table, mapped by,
+ * primary key join column, mapping)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface OrmReadOnlyRelationship
+ extends ReadOnlyRelationship, XmlContextNode
+{
+ OrmReadOnlyRelationshipStrategy getStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java
new file mode 100644
index 0000000000..38e20442f6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> read-only relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmReadOnlyRelationshipStrategy
+ extends ReadOnlyRelationshipStrategy, XmlContextNode
+{
+ OrmReadOnlyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java
new file mode 100644
index 0000000000..c8f8f00c81
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> read-only unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmReadOnlyUniqueConstraint
+ extends ReadOnlyUniqueConstraint, XmlContextNode
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java
new file mode 100644
index 0000000000..71f53cdf13
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.ReferenceTable;
+
+/**
+ * <code>orm.xml</code> join table or collection table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmReferenceTable
+ extends ReferenceTable, OrmTable
+{
+ // ********** join columns **********
+
+ ListIterator<OrmJoinColumn> joinColumns();
+
+ ListIterator<OrmJoinColumn> specifiedJoinColumns();
+ OrmJoinColumn getSpecifiedJoinColumn(int index);
+ OrmJoinColumn addSpecifiedJoinColumn();
+ OrmJoinColumn addSpecifiedJoinColumn(int index);
+
+ OrmJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java
new file mode 100644
index 0000000000..416a61364b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Relationship;
+
+/**
+ * <code>orm.xml</code> relationship (join column, join table, mapped by,
+ * primary key join column, mapping)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface OrmRelationship
+ extends Relationship, OrmReadOnlyRelationship
+{
+ OrmRelationshipStrategy getStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java
new file mode 100644
index 0000000000..739d460fc8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
+
+/**
+ * <code>orm.xml</code> relationship (1:1, 1:m, m:1, m:m) mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmRelationshipMapping
+ extends RelationshipMapping, OrmAttributeMapping
+{
+ AbstractXmlRelationshipMapping getXmlAttributeMapping();
+
+ OrmCascade getCascade();
+
+ OrmMappingRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java
new file mode 100644
index 0000000000..7704ca4aa4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
+
+/**
+ * <code>orm.xml</code> relationship strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OrmRelationshipStrategy
+ extends RelationshipStrategy, OrmReadOnlyRelationshipStrategy
+{
+ OrmRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java
new file mode 100644
index 0000000000..cd600a1310
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
+import org.eclipse.jpt.jpa.core.context.SecondaryTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
+
+/**
+ * <code>orm.xml</code> secondary table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmSecondaryTable
+ extends SecondaryTable, OrmTable
+{
+ OrmEntity getParent();
+
+ void initializeFrom(ReadOnlySecondaryTable oldSecondaryTable);
+
+ XmlSecondaryTable getXmlTable();
+
+
+ // ********** primary key join columns **********
+
+ ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
+ OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+ OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java
new file mode 100644
index 0000000000..b4158a6c45
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+
+/**
+ * <code>orm.xml</code> sequence generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmSequenceGenerator
+ extends SequenceGenerator, OrmGenerator
+{
+ XmlSequenceGenerator getXmlGenerator();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java
new file mode 100644
index 0000000000..bfe8774ab9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.SingleRelationshipMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping;
+
+/**
+ * <code>orm.xml</code> single (1:1, m:1) mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OrmSingleRelationshipMapping
+ extends SingleRelationshipMapping, OrmRelationshipMapping
+{
+ AbstractXmlSingleRelationshipMapping getXmlAttributeMapping();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java
new file mode 100644
index 0000000000..64bd9c75bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface OrmStructureNodes
+{
+
+ String ENTITY_MAPPINGS_ID = JptJpaCorePlugin.PLUGIN_ID + ".orm.entityMappings"; //$NON-NLS-1$
+
+ String PERSISTENT_TYPE_ID = JptJpaCorePlugin.PLUGIN_ID + ".orm.persistentType"; //$NON-NLS-1$
+
+ String PERSISTENT_ATTRIBUTE_ID = JptJpaCorePlugin.PLUGIN_ID + ".orm.persistentAttribute"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java
new file mode 100644
index 0000000000..0969a76ed5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OrmTable
+ extends Table, XmlContextNode
+{
+ TextRange getNameTextRange();
+ TextRange getSchemaTextRange();
+ TextRange getCatalogTextRange();
+
+ ListIterator<OrmUniqueConstraint> uniqueConstraints();
+ OrmUniqueConstraint getUniqueConstraint(int index);
+ OrmUniqueConstraint addUniqueConstraint();
+ OrmUniqueConstraint addUniqueConstraint(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java
new file mode 100644
index 0000000000..bb6d5bc2e2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.TableGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
+
+/**
+ * <code>orm.xml</code> table generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmTableGenerator
+ extends TableGenerator, OrmGenerator
+{
+ XmlTableGenerator getXmlGenerator();
+
+
+ // ********** unique constraints **********
+
+ @SuppressWarnings("unchecked")
+ Iterable<OrmUniqueConstraint> getUniqueConstraints();
+
+ OrmUniqueConstraint addUniqueConstraint();
+
+ OrmUniqueConstraint addUniqueConstraint(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java
new file mode 100644
index 0000000000..e474b841a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.TemporalConverter;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
+
+/**
+ * <code>orm.xml</code> temporal converter
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmTemporalConverter
+ extends TemporalConverter, OrmConverter
+{
+ // ********** adapter **********
+
+ public static class Adapter
+ implements OrmConverter.Adapter
+ {
+ private static final Adapter INSTANCE = new Adapter();
+ public static Adapter instance() {
+ return INSTANCE;
+ }
+
+ private Adapter() {
+ super();
+ }
+
+ public Class<? extends Converter> getConverterType() {
+ return TemporalConverter.class;
+ }
+
+ public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) {
+ XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping();
+ return (xmlMapping.getTemporal() == null) ? null : factory.buildOrmTemporalConverter(parent);
+ }
+
+ public boolean isActive(XmlConvertibleMapping xmlMapping) {
+ return xmlMapping.getTemporal() != null;
+ }
+
+ public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmTemporalConverter(parent);
+ }
+
+ public void clearXmlValue(XmlConvertibleMapping xmlMapping) {
+ xmlMapping.setTemporal(null);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java
new file mode 100644
index 0000000000..4ee1e4b385
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.TransientMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
+
+/**
+ * <code>orm.xml</code> transient "mapping"
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmTransientMapping
+ extends TransientMapping, OrmAttributeMapping
+{
+ XmlTransient getXmlAttributeMapping();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java
new file mode 100644
index 0000000000..ea81dae761
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * <code>orm.xml</code> type mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface OrmTypeMapping
+ extends TypeMapping, XmlContextNode
+{
+ // ********** class **********
+
+ /**
+ * <strong>NB:</strong> This may be a partial name to be prefixed by the
+ * entity mappings's package value.
+ *
+ * @see EntityMappings#getPackage()
+ */
+ String getClass_();
+
+ /**
+ * @see #getClass_()
+ */
+ void setClass(String class_);
+ String CLASS_PROPERTY = "class"; //$NON-NLS-1$
+
+
+ // ********** metadata complete **********
+
+ boolean isMetadataComplete();
+ Boolean getSpecifiedMetadataComplete();
+ void setSpecifiedMetadataComplete(Boolean metadataComplete);
+ String SPECIFIED_METADATA_COMPLETE_PROPERTY = "specifiedMetadataComplete"; //$NON-NLS-1$
+
+ /**
+ * Override metadata complete is true if the type mapping's persistence
+ * unit is marked "XML mapping metadata complete".
+ */
+ boolean isOverrideMetadataComplete();
+ String OVERRIDE_METADATA_COMPLETE_PROPERTY = "overrideMetadataComplete"; //$NON-NLS-1$
+
+
+ // ********** XML **********
+
+ /**
+ * 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.
+ * <p>
+ * Each concrete implementation must implement this
+ * method and return an int that matches its order in the schema.
+ */
+ int getXmlSequence();
+
+ /**
+ * Add the type mapping's XML type mapping to the appropriate list
+ * in the specified XML entity mappings.
+ */
+ void addXmlTypeMappingTo(XmlEntityMappings entityMappings);
+
+ /**
+ * Remove the type mapping's XML type mapping from the appropriate list
+ * in the specified XML entity mappings.
+ */
+ void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings);
+
+ XmlTypeMapping getXmlTypeMapping();
+
+ TextRange getSelectionTextRange();
+
+ TextRange getClassTextRange();
+
+ TextRange getAttributesTextRange();
+
+ boolean containsOffset(int textOffset);
+
+
+ // ********** Java type mapping **********
+
+ /**
+ * Return the Java type mapping corresponding to the <code>orm.xml</code>
+ * type mapping. Return <code>null</code> if there is no such Java type
+ * mapping; i.e. it does not exist or it is not the same type of type
+ * mapping (entity, mapped superclass, embeddable).
+ *
+ * @see #getJavaTypeMappingForDefaults()
+ */
+ JavaTypeMapping getJavaTypeMapping();
+
+ /**
+ * Check "metadata complete" before returning the Java type mapping.
+ * For <code>orm.xml</code> defaults, if "metadata complete" is
+ * <code>true</code>, return <code>null</code>.
+ *
+ * @see #getJavaTypeMapping()
+ */
+ JavaTypeMapping getJavaTypeMappingForDefaults();
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create a text DeleteEdit for deleting the type mapping element and any text that precedes it
+ */
+ DeleteEdit createDeleteEdit();
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+
+ // ********** misc **********
+
+ OrmPersistentType getPersistentType();
+
+ void initializeFrom(OrmTypeMapping oldMapping);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java
new file mode 100644
index 0000000000..fef4b7d092
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+
+/**
+ * Part of mechanism to extend the types of <code>orm.xml</code> type mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmTypeMappingDefinition
+{
+ /**
+ * Return the definition's mapping key.
+ * @see MappingKeys
+ */
+ String getKey();
+
+ /**
+ * Build a resource mapping using the specifed factory.
+ */
+ XmlTypeMapping buildResourceMapping(EFactory factory);
+
+ /**
+ * Build a context mapping for the specified parent and resource mapping,
+ * using the specified factory.
+ */
+ OrmTypeMapping buildContextMapping(
+ OrmPersistentType parent,
+ XmlTypeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java
new file mode 100644
index 0000000000..f320080aa6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
+
+/**
+ * <code>orm.xml</code> unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface OrmUniqueConstraint
+ extends UniqueConstraint, OrmReadOnlyUniqueConstraint
+{
+ XmlUniqueConstraint getXmlUniqueConstraint();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java
new file mode 100644
index 0000000000..4f29cf3fd2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VersionMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
+
+/**
+ * <code>orm.xml</code> version mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface OrmVersionMapping
+ extends VersionMapping, OrmColumnMapping, OrmConvertibleMapping
+{
+ XmlVersion getXmlAttributeMapping();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java
new file mode 100644
index 0000000000..a16dbcad5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualAssociationOverride;
+
+/**
+ * <code>orm.xml</code> virtual association override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualAssociationOverride
+ extends VirtualAssociationOverride,
+ OrmVirtualOverride,
+ OrmReadOnlyAssociationOverride
+{
+ OrmVirtualOverrideRelationship getRelationship();
+
+ OrmAssociationOverride convertToSpecified();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java
new file mode 100644
index 0000000000..6c957c2b80
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualAttributeOverride;
+
+/**
+ * Java virtual attribute override
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualAttributeOverride
+ extends VirtualAttributeOverride,
+ OrmVirtualOverride,
+ OrmReadOnlyAttributeOverride
+{
+ OrmAttributeOverride convertToSpecified();
+
+ OrmVirtualColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java
new file mode 100644
index 0000000000..ce33b3a81d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.VirtualColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> virtual column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualColumn
+ extends VirtualColumn, XmlContextNode
+{
+ /**
+ * The overridden column can be either a Java join column or an
+ * <code>orm.xml</code> join column; so we don't change the return type
+ * here.
+ */
+ Column getOverriddenColumn();
+
+
+ // ********** owner **********
+
+ interface Owner
+ extends VirtualColumn.Owner
+ {
+ /**
+ * The overridden column can be either a Java column or an
+ * <code>orm.xml</code> column; so we don't change the return type here.
+ */
+ Column resolveOverriddenColumn();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java
new file mode 100644
index 0000000000..9a17a4a6d7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.VirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> virtual join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualJoinColumn
+ extends VirtualJoinColumn, XmlContextNode
+{
+ /**
+ * The overridden join column can be either a Java join column or an
+ * <code>orm.xml</code> join column; so we don't change the return type
+ * here.
+ */
+ JoinColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java
new file mode 100644
index 0000000000..d2d4154496
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationship;
+
+/**
+ * <code>orm.xml</code> virtual join column relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualJoinColumnRelationship
+ extends VirtualJoinColumnRelationship,
+ OrmVirtualRelationship
+{
+ OrmVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..248fbb8293
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy;
+
+/**
+ * <code>orm.xml</code> virtual join column relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualJoinColumnRelationshipStrategy
+ extends VirtualJoinColumnRelationshipStrategy, OrmVirtualRelationshipStrategy
+{
+ ListIterator<OrmVirtualJoinColumn> joinColumns();
+ ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns();
+ OrmVirtualJoinColumn getSpecifiedJoinColumn(int index);
+ OrmVirtualJoinColumn getDefaultJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java
new file mode 100644
index 0000000000..55892a2148
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.VirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+
+/**
+ * <code>orm.xml</code> virtual join table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualJoinTable
+ extends VirtualJoinTable, XmlContextNode
+{
+ OrmVirtualJoinTableRelationshipStrategy getParent();
+
+ ListIterator<OrmVirtualUniqueConstraint> uniqueConstraints();
+ OrmVirtualUniqueConstraint getUniqueConstraint(int index);
+
+ ListIterator<OrmVirtualJoinColumn> joinColumns();
+ ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns();
+ OrmVirtualJoinColumn getSpecifiedJoinColumn(int index);
+ OrmVirtualJoinColumn getDefaultJoinColumn();
+
+ ListIterator<OrmVirtualJoinColumn> inverseJoinColumns();
+ ListIterator<OrmVirtualJoinColumn> specifiedInverseJoinColumns();
+ OrmVirtualJoinColumn getSpecifiedInverseJoinColumn(int index);
+ OrmVirtualJoinColumn getDefaultInverseJoinColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java
new file mode 100644
index 0000000000..b5b58c4bfc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationship;
+
+/**
+ * <code>orm.xml</code> virtual join table relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualJoinTableRelationship
+ extends VirtualJoinTableRelationship,
+ OrmVirtualRelationship
+{
+ OrmVirtualJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..2072e72dd5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationshipStrategy;
+
+/**
+ * <code>orm.xml</code> virtual join table relationship strategy.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualJoinTableRelationshipStrategy
+ extends VirtualJoinTableRelationshipStrategy, OrmVirtualRelationshipStrategy
+{
+ OrmVirtualJoinTable getJoinTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java
new file mode 100644
index 0000000000..031174b0c3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+
+/**
+ * <code>orm.xml</code> virtual<ul>
+ * <li>attribute override
+ * <li>association override
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualOverride
+ extends VirtualOverride, OrmReadOnlyOverride
+{
+ OrmOverride convertToSpecified();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java
new file mode 100644
index 0000000000..4da970ad2b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualOverrideRelationship;
+
+/**
+ * <code>orm.xml</code> virtual association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualOverrideRelationship
+ extends VirtualOverrideRelationship,
+ OrmVirtualJoinColumnRelationship
+{
+ OrmVirtualAssociationOverride getAssociationOverride();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..8823e4fc10
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+
+/**
+ * <code>orm.xml</code> virtual primary key join column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualPrimaryKeyJoinColumn
+ extends VirtualPrimaryKeyJoinColumn, XmlContextNode
+{
+ JavaPrimaryKeyJoinColumn getOverriddenColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java
new file mode 100644
index 0000000000..7738e2e999
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualRelationship;
+
+/**
+ * <code>orm.xml</code> virtual relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualRelationship
+ extends VirtualRelationship, OrmReadOnlyRelationship
+{
+ OrmVirtualRelationshipStrategy getStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java
new file mode 100644
index 0000000000..08c209b2c3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.VirtualRelationshipStrategy;
+
+/**
+ * <code>orm.xml</code> virtual strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualRelationshipStrategy
+ extends VirtualRelationshipStrategy, OrmReadOnlyRelationshipStrategy
+{
+ OrmVirtualRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java
new file mode 100644
index 0000000000..46cc96082c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.VirtualSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+
+/**
+ * <code>orm.xml</code> virtual secondary table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualSecondaryTable
+ extends VirtualSecondaryTable, XmlContextNode
+{
+ ListIterator<OrmVirtualPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterator<OrmVirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ OrmVirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
+
+ JavaSecondaryTable getOverriddenTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java
new file mode 100644
index 0000000000..7e9e7a911a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.VirtualUniqueConstraint;
+
+/**
+ * <code>orm.xml</code> virtual database unique constraint
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualUniqueConstraint
+ extends VirtualUniqueConstraint, OrmReadOnlyUniqueConstraint
+{
+ /**
+ * The overridden unique constraint can be either a Java unique constraint
+ * or an <code>orm.xml</code> unique constraint; so we don't change the
+ * return type here.
+ */
+ UniqueConstraint getOverriddenUniqueConstraint();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java
new file mode 100644
index 0000000000..0b4a509790
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.MappingFile;
+
+/**
+ * JPA <code>orm.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface OrmXml
+ extends MappingFile
+{
+ // ********** root **********
+
+ /**
+ * String constant associated with changes to the
+ * <code>entity-mappings</code> property
+ */
+ String ROOT_PROPERTY = "root"; //$NON-NLS-1$
+
+ /**
+ * Covariant override.
+ */
+ EntityMappings getRoot();
+
+ OrmPersistentType getPersistentType(String name);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java
new file mode 100644
index 0000000000..b8f98cb0c4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
+
+/**
+ * <code>orm.xml</code> context node factory
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmXmlContextNodeFactory
+{
+ // ********** ORM Context Model **********
+
+ EntityMappings buildEntityMappings(OrmXml parent, XmlEntityMappings entityMappings);
+
+ OrmPersistenceUnitMetadata buildOrmPersistenceUnitMetadata(EntityMappings parent);
+
+ OrmPersistenceUnitDefaults buildOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent);
+
+ OrmPersistentType buildOrmPersistentType(EntityMappings parent, XmlTypeMapping resourceMapping);
+
+ OrmEntity buildOrmEntity(OrmPersistentType parent, XmlEntity resourceMapping);
+
+ OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping);
+
+ OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping);
+
+ OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping);
+
+ OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+
+ OrmTable buildOrmTable(OrmEntity parent, Table.Owner owner);
+
+ OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent, Table.Owner owner, XmlSecondaryTable xmlSecondaryTable);
+
+ OrmVirtualSecondaryTable buildOrmVirtualSecondaryTable(OrmEntity parent, JavaSecondaryTable javaSecondaryTable);
+
+ OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn resourcePrimaryKeyJoinColumn);
+
+ OrmVirtualPrimaryKeyJoinColumn buildOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, ReadOnlyBaseJoinColumn.Owner owner, JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn);
+
+ OrmJoinTable buildOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Table.Owner owner);
+
+ OrmVirtualJoinTable buildOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable);
+
+ OrmJoinColumn buildOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn resourceJoinColumn);
+
+ OrmVirtualJoinColumn buildOrmVirtualJoinColumn(XmlContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn);
+
+ OrmAttributeOverrideContainer buildOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner);
+
+ OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner);
+
+ OrmAttributeOverride buildOrmAttributeOverride(OrmAttributeOverrideContainer parent, XmlAttributeOverride xmlOverride);
+
+ OrmVirtualAttributeOverride buildOrmVirtualAttributeOverride(OrmAttributeOverrideContainer parent, String name);
+
+ OrmAssociationOverride buildOrmAssociationOverride(OrmAssociationOverrideContainer parent, XmlAssociationOverride xmlOverride);
+
+ OrmVirtualAssociationOverride buildOrmVirtualAssociationOverride(OrmAssociationOverrideContainer parent, String name);
+
+ OrmOverrideRelationship buildOrmOverrideRelationship(OrmAssociationOverride parent);
+
+ OrmVirtualOverrideRelationship buildOrmVirtualOverrideRelationship(OrmVirtualAssociationOverride parent);
+
+ OrmDiscriminatorColumn buildOrmDiscriminatorColumn(OrmEntity parent, OrmDiscriminatorColumn.Owner owner);
+
+ OrmColumn buildOrmColumn(XmlContextNode parent, OrmColumn.Owner owner);
+
+ OrmVirtualColumn buildOrmVirtualColumn(XmlContextNode parent, OrmVirtualColumn.Owner owner);
+
+ OrmGeneratedValue buildOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue resourceGeneratedValue);
+
+ OrmGeneratorContainer buildOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer resourceGeneratorContainer);
+
+ OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator);
+
+ OrmTableGenerator buildOrmTableGenerator(XmlContextNode parent, XmlTableGenerator resourceTableGenerator);
+
+ OrmQueryContainer buildOrmQueryContainer(XmlContextNode parent, XmlQueryContainer resourceQueryContainer);
+
+ OrmNamedNativeQuery buildOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery resourceNamedQuery);
+
+ OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery);
+
+ OrmQueryHint buildOrmQueryHint(OrmQuery parent, XmlQueryHint resourceQueryhint);
+
+ OrmBasicMapping buildOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic resourceMapping);
+
+ OrmManyToManyMapping buildOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany resourceMapping);
+
+ OrmOneToManyMapping buildOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany resourceMapping);
+
+ OrmManyToOneMapping buildOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne resourceMapping);
+
+ OrmOneToOneMapping buildOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne resourceMapping);
+
+ OrmEmbeddedIdMapping buildOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId resourceMapping);
+
+ OrmEmbeddedMapping buildOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded resourceMapping);
+
+ OrmIdMapping buildOrmIdMapping(OrmPersistentAttribute parent, XmlId resourceMapping);
+
+ OrmTransientMapping buildOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient resourceMapping);
+
+ OrmVersionMapping buildOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion resourceMapping);
+
+ OrmAttributeMapping buildOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping);
+
+ OrmAttributeMapping buildUnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping);
+
+ OrmUniqueConstraint buildOrmUniqueConstraint(XmlContextNode parent, UniqueConstraint.Owner owner, XmlUniqueConstraint resourceUniqueConstraint);
+
+ OrmVirtualUniqueConstraint buildOrmVirtualUniqueConstraint(XmlContextNode parent, UniqueConstraint overriddenUniqueConstraint);
+
+ OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent);
+
+ OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent);
+
+ OrmConverter buildOrmLobConverter(OrmAttributeMapping parent);
+
+ /**
+ * JPA 1.0 only
+ */
+ OrmOrderable buildOrmOrderable(OrmAttributeMapping parent);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java
new file mode 100644
index 0000000000..7ed177a093
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <code>orm.xml</code> definition
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmXmlDefinition
+ extends MappingFileDefinition
+{
+ /**
+ * Return the factory for building XML resource nodes.
+ */
+ EFactory getResourceNodeFactory();
+
+ /**
+ * Return the factory for building XML context nodes.
+ */
+ OrmXmlContextNodeFactory getContextNodeFactory();
+
+
+ // ********** type/attribute mappings **********
+
+ /**
+ * Return a type mapping definiton for the specified mapping key.
+ * @throws IllegalArgumentException if the mapping key is not
+ * supported
+ */
+ OrmTypeMappingDefinition getTypeMappingDefinition(String mappingKey);
+
+ /**
+ * Return an attribute mapping definiton for the specified mapping key.
+ * Never return <code>null</code>.
+ */
+ OrmAttributeMappingDefinition getAttributeMappingDefinition(String mappingKey);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java
new file mode 100644
index 0000000000..1275887f77
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public class UnsupportedOrmAttributeMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new UnsupportedOrmAttributeMappingDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private UnsupportedOrmAttributeMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ throw new UnsupportedOperationException();
+ }
+
+ public OrmAttributeMapping buildContextMapping(OrmPersistentAttribute parent, XmlAttributeMapping resourceMapping, OrmXmlContextNodeFactory factory) {
+ return factory.buildUnsupportedOrmAttributeMapping(parent, (XmlNullAttributeMapping) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
new file mode 100644
index 0000000000..5902e9dd5f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Context model corresponding to the XML resource model
+ * {@link XmlJavaClassRef}, which corresponds to the <code>class<code> element
+ * in the <code>persistence.xml</code> file.
+ * This is also used for "implied" class refs; i.e. class refs that are not
+ * explicitly listed in the <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface ClassRef
+ extends XmlContextNode, JpaStructureNode, PersistentType.Owner
+{
+ /**
+ * Return whether the class ref is a reference to the specified type.
+ */
+ boolean isFor(String typeName);
+
+ /**
+ * Return <code>true</code> if the mapping file ref is <em>virtual</em>;
+ * return <code>false</code> if the mapping file ref is represented by an
+ * entry in the <code>persistence.xml</code> file.
+ */
+ boolean isVirtual();
+
+ /**
+ * Return the class ref's corresponding resource class ref.
+ * This is <code>null</code> for <em>implied</em> class refs.
+ */
+ XmlJavaClassRef getXmlClassRef();
+
+ /**
+ * Return whether the text representation of this persistence unit contains
+ * the given text offset
+ */
+ boolean containsOffset(int textOffset);
+
+
+ // ********** class name **********
+
+ /**
+ * String constant associated with changes to the class name
+ */
+ final static String CLASS_NAME_PROPERTY = "className"; //$NON-NLS-1$
+
+ /**
+ * 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"; //$NON-NLS-1$
+
+ /**
+ * Return the JavaPersistentType that corresponds to this IClassRef.
+ * This can be null.
+ * This is not settable by users of this API.
+ */
+ JavaPersistentType getJavaPersistentType();
+
+
+ // ********** refactoring **********
+
+ /**
+ * If this {@link #isFor(String)} the given IType, create a text
+ * DeleteEdit for deleting the class element and any text that precedes it.
+ * Otherwise return an EmptyIterable.
+ * Though this will contain 1 or 0 DeleteEdits, using an Iterable
+ * for ease of use with other createDeleteEdit API.
+ */
+ Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
+
+ /**
+ * Create ReplaceEdits for renaming the class element to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ * If this ClassRef does not match the original type, then return an empty Iterable.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming the class's package to the newName.
+ * The originalPackage has not yet been renamed.
+ * If this class is not a part of the original package, then return an empty Iterable.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java
new file mode 100644
index 0000000000..942142ca0f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JarFile;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Context model corresponding to the
+ * XML resource model {@link XmlJarFileRef},
+ * which corresponds to the <code>jar-file</code>
+ * element in the <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JarFileRef
+ extends XmlContextNode, JpaStructureNode, PersistentTypeContainer
+{
+ // ********** file name **********
+
+ /**
+ * String constant associated with changes to the file name.
+ */
+ String FILE_NAME_PROPERTY = "fileName"; //$NON-NLS-1$
+
+ /**
+ * Return the file name of the jar file ref.
+ */
+ String getFileName();
+
+ /**
+ * Set the file name of the jar file ref.
+ */
+ void setFileName(String fileName);
+
+
+ // ********** JAR file **********
+
+ /**
+ * String constant associated with changes to the JAR file.
+ */
+ String JAR_FILE_PROPERTY = "jarFile"; //$NON-NLS-1$
+
+ /**
+ * Return the JAR file ref's JAR file corresponding to the file name.
+ */
+ JarFile getJarFile();
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalFolder to the newName.
+ * The originalFolder has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createReplaceFolderEdits(IFolder originalFolder, String newName);
+
+
+ // ********** queries **********
+
+ XmlJarFileRef getXmlJarFileRef();
+
+ /**
+ * Return the persistent type, as listed in the JAR file,
+ * with the specified name. Return null if it does not exists.
+ */
+ PersistentType getPersistentType(String typeName);
+
+ /**
+ * Return whether the text representation of the JAR file ref contains
+ * the specified text offset.
+ */
+ boolean containsOffset(int textOffset);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
new file mode 100644
index 0000000000..03acbdcbb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Context model corresponding to the
+ * XML resource model {@link XmlMappingFileRef},
+ * which corresponds to the <code>mapping-file</code> element
+ * in the <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface MappingFileRef
+ extends XmlContextNode, JpaStructureNode, PersistentTypeContainer
+{
+ /**
+ * Covariant override.
+ */
+ PersistenceUnit getParent();
+
+
+ // ********** file name **********
+
+ /**
+ * String constant associated with changes to the file name.
+ */
+ String FILE_NAME_PROPERTY = "fileName"; //$NON-NLS-1$
+
+ /**
+ * Return the file name of the mapping file ref.
+ */
+ String getFileName();
+
+ /**
+ * Set the file name of the mapping file ref.
+ */
+ void setFileName(String fileName);
+
+ /**
+ * Return whether the mapping file ref is a reference to the specified file.
+ */
+ boolean isFor(IFile file);
+
+
+ // ********** mapping file (orm.xml) **********
+
+ /**
+ * String constant associated with changes to the mapping file.
+ */
+ String MAPPING_FILE_PROPERTY = "mappingFile"; //$NON-NLS-1$
+
+ /**
+ * Return mapping file corresponding to the mapping file ref's file name.
+ */
+ MappingFile getMappingFile();
+
+
+ // ********** persistence unit metadata **********
+
+ /**
+ * Return the mapping file's persistence unit metadata.
+ */
+ MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata();
+
+ /**
+ * Return whether the mapping file's persistence unit metadata exist.
+ */
+ boolean persistenceUnitMetadataExists();
+
+
+ // ********** misc **********
+
+ /**
+ * Return the mapping file ref's corresponding resource mapping file ref.
+ */
+ XmlMappingFileRef getXmlMappingFileRef();
+
+ /**
+ * Return whether the mapping file ref is "implied" by, or explicitly
+ * specified in, the <code>persistence.xml</code>.
+ */
+ boolean isImplied();
+
+ /**
+ * Return the persistent type, as listed in the mapping file,
+ * with the specified name. Return null if it does not exists.
+ */
+ PersistentType getPersistentType(String typeName);
+
+ /**
+ * Return whether the specified text offset is within
+ * the text representation of the mapping file.
+ */
+ boolean containsOffset(int textOffset);
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create DeleteEdits for deleting any references to the given type
+ * that is about to be deleted.
+ * Return an EmptyIterable if there are not any references to the given type.
+ */
+ Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
+
+ /**
+ * If this {@link #isFor(IFile)} the given IFile, create a text
+ * DeleteEdit for deleting the mapping file element and any text that precedes it
+ * from the persistence.xml.
+ * Otherwise return an EmptyIterable.
+ * Though this will contain 1 or 0 DeleteEdits, using an Iterable
+ * for ease of use with other createDeleteEdit API.
+ */
+ Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalFolder to the newName.
+ * The originalFolder has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName);
+
+ /**
+ * If this {@link #isFor(IFile)} the given IFile, create a text
+ * ReplaceEdit for renaming the mapping file element to the new name.
+ * Otherwise return an EmptyIterable.
+ * Though this will contain 1 or 0 ReplaceEdits, using an Iterable
+ * for ease of use with other createReplaceMappingFileEdits API.
+ */
+ Iterable<ReplaceEdit> createRenameMappingFileEdits(IFile originalFile, String newName);
+
+ /**
+ * If this {@link #isFor(IFile)} the given IFile create a text
+ * ReplaceEdit for moving the originalFile to the destination.
+ * Otherwise return an EmptyIterable.
+ * The originalFile has not been moved yet.
+ */
+ Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination.
+ * The runtimeDestination already includes the original folder name.
+ */
+ Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
new file mode 100644
index 0000000000..8574352ec5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+
+/**
+ * Context model corresponding to the XML resource model {@link XmlPersistence},
+ * which corresponds to the <code>persistence</code> element in the
+ * <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface Persistence
+ extends XmlContextNode, JpaStructureNode
+{
+ /**
+ * Return the resource model object associated with this context model object
+ */
+ XmlPersistence getXmlPersistence();
+
+ /**
+ * Covariant override.
+ */
+ PersistenceXml getParent();
+
+
+ // **************** persistence units **************************************
+
+ /**
+ * String constant associated with changes to the persistence units list
+ */
+ String PERSISTENCE_UNITS_LIST = "persistenceUnits"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence element's persistence units.
+ */
+ ListIterator<PersistenceUnit> persistenceUnits();
+
+ /**
+ * Return the number of persistence units.
+ */
+ int persistenceUnitsSize();
+
+ /**
+ * Add a persistence unit and return it.
+ */
+ PersistenceUnit addPersistenceUnit();
+
+ /**
+ * Add a persistence unit at the specified index and return it.
+ */
+ PersistenceUnit addPersistenceUnit(int index);
+
+ /**
+ * Remove the specified persistence unit from the persistence node.
+ */
+ void removePersistenceUnit(PersistenceUnit persistenceUnit);
+
+ /**
+ * Remove the persistence unit at the specified index from the persistence node.
+ */
+ void removePersistenceUnit(int index);
+
+
+ // **************** text range *********************************************
+
+ /**
+ * Return whether the text representation of this persistence contains
+ * the specified text offset.
+ */
+ boolean containsOffset(int textOffset);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java
new file mode 100644
index 0000000000..2e34050432
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface PersistenceStructureNodes
+{
+ String PREFIX = JptJpaCorePlugin.PLUGIN_ID_ + "persistence"; //$NON-NLS-1$
+ String PREFIX_ = PREFIX + '.';
+
+ String PERSISTENCE_ID = PREFIX_ + "persistence"; //$NON-NLS-1$
+ String PERSISTENCE_UNIT_ID = PREFIX_ + "persistenceUnit"; //$NON-NLS-1$
+ String CLASS_REF_ID = PREFIX_ + "classRef"; //$NON-NLS-1$
+ String MAPPING_FILE_REF_ID = PREFIX_ + "mappingFileRef"; //$NON-NLS-1$
+ String JAR_FILE_REF_ID = PREFIX_ + "jarFileRef"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
new file mode 100644
index 0000000000..90b30cbb46
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
@@ -0,0 +1,839 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Context model corresponding to the XML resource model {@link XmlPersistenceUnit},
+ * which corresponds to the <code>persistence-unit</code> element in the
+ * <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface PersistenceUnit
+ extends XmlContextNode, JpaStructureNode, PersistentTypeContainer
+{
+ /**
+ * Covariant override.
+ */
+ Persistence getParent();
+
+
+ // ********** name **********
+
+ /**
+ * String constant associated with changes to the persistence unit's name.
+ */
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's name.
+ */
+ String getName();
+
+ /**
+ * Set the persistence unit's name.
+ */
+ void setName(String name);
+
+
+ // ********** transaction type **********
+
+ /**
+ * Return the persistence unit's transaction type,
+ * whether specified or defaulted.
+ */
+ PersistenceUnitTransactionType getTransactionType();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * specified transaction type
+ */
+ String SPECIFIED_TRANSACTION_TYPE_PROPERTY = "specifiedTransactionType"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's specified transaction type.
+ */
+ PersistenceUnitTransactionType getSpecifiedTransactionType();
+
+ /**
+ * Set the persistence unit's specified transaction type.
+ */
+ void setSpecifiedTransactionType(PersistenceUnitTransactionType transactionType);
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default transaction type (not typically changed).
+ */
+ String DEFAULT_TRANSACTION_TYPE_PROPERTY = "defaultTransactionType"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's default transaction type.
+ */
+ PersistenceUnitTransactionType getDefaultTransactionType();
+
+
+ // ********** description **********
+
+ /**
+ * String constant associated with changes to the persistence unit's description.
+ */
+ String DESCRIPTION_PROPERTY = "description"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's description.
+ */
+ String getDescription();
+
+ /**
+ * Set the persistence unit's description.
+ */
+ void setDescription(String description);
+
+
+ // ********** provider **********
+
+ /**
+ * String constant associated with changes to the persistence unit's provider.
+ */
+ String PROVIDER_PROPERTY = "provider"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's provider.
+ */
+ String getProvider();
+
+ /**
+ * Set the persistence unit's provider.
+ */
+ void setProvider(String provider);
+
+
+ // ********** JTA data source **********
+
+ /**
+ * String constant associated with changes to the persistence unit's JTA data source
+ */
+ String JTA_DATA_SOURCE_PROPERTY = "jtaDataSource"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's JTA data source.
+ */
+ String getJtaDataSource();
+
+ /**
+ * Set the persistence unit's JTA data source.
+ */
+ void setJtaDataSource(String jtaDataSource);
+
+
+ // ********** non-JTA data source **********
+
+ /**
+ * String constant associated with changes to the persistence unit's non-JTA data source
+ */
+ String NON_JTA_DATA_SOURCE_PROPERTY = "nonJtaDataSource"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's non-JTA data source.
+ */
+ String getNonJtaDataSource();
+
+ /**
+ * Set the persistence unit's non-JTA data source.
+ */
+ void setNonJtaDataSource(String nonJtaDataSource);
+
+
+ // ********** mapping file refs **********
+
+ /**
+ * Return the persistence unit's list of mapping file refs,
+ * both specified and implied.
+ */
+ ListIterator<MappingFileRef> mappingFileRefs();
+
+ /**
+ * Return the size of the persistence unit's list of mapping file refs,
+ * both specified and implied.
+ */
+ int mappingFileRefsSize();
+
+ /**
+ * Return all the mapping file refs, both specified and implied,
+ * containing the specified type.
+ */
+ Iterator<MappingFileRef> mappingFileRefsContaining(String typeName);
+
+
+ // ********** specified mapping file refs **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * specified mapping file refs.
+ */
+ String SPECIFIED_MAPPING_FILE_REFS_LIST = "specifiedMappingFileRefs"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's list of specified mapping file refs.
+ */
+ ListIterator<MappingFileRef> specifiedMappingFileRefs();
+
+ /**
+ * Return the size of the persistence unit's list of specified mapping file refs.
+ */
+ int specifiedMappingFileRefsSize();
+
+ /**
+ * Add a new specified mapping file ref to the persistence unit;
+ * return the newly-created mapping file ref.
+ */
+ MappingFileRef addSpecifiedMappingFileRef(String fileName);
+
+ /**
+ * Add a new specified mapping file ref to the persistence unit at the specified index;
+ * return the newly-created mapping file ref.
+ */
+ MappingFileRef addSpecifiedMappingFileRef(int index, String fileName);
+
+ /**
+ * Remove the specified mapping file ref from the persistence unit.
+ */
+ void removeSpecifiedMappingFileRef(MappingFileRef mappingFileRef);
+
+ /**
+ * Remove the specified mapping file ref at the specified index from the persistence unit.
+ */
+ void removeSpecifiedMappingFileRef(int index);
+
+
+ // ********** implied mapping file ref **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * implied mapping file ref.
+ */
+ String IMPLIED_MAPPING_FILE_REF_PROPERTY = "impliedMappingFileRef"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's implied mapping file ref.
+ */
+ MappingFileRef getImpliedMappingFileRef();
+
+
+ // ********** jar file refs **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * JAR file refs.
+ */
+ String JAR_FILE_REFS_LIST = "jarFileRefs"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's list of JAR file refs.
+ */
+ ListIterator<JarFileRef> jarFileRefs();
+
+ /**
+ * Return the size of the persistence unit's list of JAR file refs.
+ */
+ int jarFileRefsSize();
+
+ /**
+ * Add a new JAR file ref to the persistence unit;
+ * return the newly-created JAR file ref.
+ */
+ JarFileRef addJarFileRef(String fileName);
+
+ /**
+ * Add a new JAR file ref to the persistence unit at the specified index;
+ * return the newly-created JAR file ref.
+ */
+ JarFileRef addJarFileRef(int index, String fileName);
+
+ /**
+ * Remove the specified JAR file ref from the persistence unit.
+ */
+ void removeJarFileRef(JarFileRef jarFileRef);
+
+ /**
+ * Remove the JAR file ref at the specified index from the persistence unit.
+ */
+ void removeJarFileRef(int index);
+
+
+ // ********** class refs **********
+
+ /**
+ * Return the persistence unit's list of class refs,
+ * both specified and implied.
+ */
+ Iterator<ClassRef> classRefs();
+
+ /**
+ * Return the size of the persistence unit's list of class refs,
+ * both specified and implied.
+ */
+ int classRefsSize();
+
+
+ // ********** specified class refs **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * specified class refs.
+ */
+ String SPECIFIED_CLASS_REFS_LIST = "specifiedClassRefs"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's list of specified class refs.
+ */
+ ListIterator<ClassRef> specifiedClassRefs();
+
+ /**
+ * Return the size of the persistence unit's list of specified mapping file refs.
+ */
+ int specifiedClassRefsSize();
+
+ /**
+ * Add a new specified class ref to the persistence unit;
+ * return the newly-created class ref.
+ */
+ ClassRef addSpecifiedClassRef(String className);
+
+ /**
+ * Add a new specified class ref to the persistence unit at the specified index;
+ * return the newly-created class ref.
+ */
+ ClassRef addSpecifiedClassRef(int index, String className);
+
+ /**
+ * Remove the specified class ref from the persistence unit.
+ */
+ void removeSpecifiedClassRef(ClassRef classRef);
+
+ /**
+ * Remove the specified class ref at the specified index from the persistence unit.
+ */
+ void removeSpecifiedClassRef(int index);
+
+
+ // ********** implied class refs **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * implied class refs.
+ */
+ String IMPLIED_CLASS_REFS_COLLECTION = "impliedClassRefs"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's list of implied class refs.
+ */
+ Iterator<ClassRef> impliedClassRefs();
+
+ /**
+ * Return the size of the persistence unit's list of implied class refs.
+ */
+ int impliedClassRefsSize();
+
+
+ // ********** exclude unlisted classes **********
+
+ /**
+ * Return whether the persistence unit excludes unlisted classes.
+ */
+ boolean excludesUnlistedClasses();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * "exclude unlisted classes" flag.
+ */
+ String SPECIFIED_EXCLUDE_UNLISTED_CLASSES_PROPERTY = "specifiedExcludeUnlistedClasses"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's specified "exclude unlisted classes" flag.
+ */
+ Boolean getSpecifiedExcludeUnlistedClasses();
+
+ /**
+ * Set the persistence unit's specified "exclude unlisted classes" flag.
+ */
+ void setSpecifiedExcludeUnlistedClasses(Boolean excludeUnlistedClasses);
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default "exclude unlisted classes" flag (not typically changed).
+ */
+ String DEFAULT_EXCLUDE_UNLISTED_CLASSES_PROPERTY = "defaultExcludeUnlistedClasses"; //$NON-NLS-1$
+
+ /**
+ * Return whether the persistence unit excludes unlisted classes by default.
+ */
+ boolean getDefaultExcludeUnlistedClasses();
+
+
+ // ********** properties **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * properties.
+ */
+ String PROPERTIES_LIST = "properties"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's list of properties.
+ */
+ ListIterator<Property> properties();
+
+ /**
+ * Return the size of the persistence unit's list of properties.
+ */
+ int propertiesSize();
+
+ /**
+ * Return the *first* property in the persistence unit's property list with
+ * the specified name. Return null if the list does not contain a property
+ * with the specified name.
+ */
+ Property getProperty(String propertyName);
+
+ /**
+ * Return all the properties in the persistence unit with the specified
+ * name. Return an empty Iterable if the persistence unit does not contain
+ * a property with the specified name.
+ */
+ Iterable<Property> getPropertiesNamed(String propertyName);
+
+ /**
+ * Return the persistence unit's properties with names beginning with the
+ * specified prefix.
+ */
+ Iterator<Property> propertiesWithNamePrefix(String propertyNamePrefix);
+
+ /**
+ * Add a new property to the persistence unit;
+ * return the newly-created property.
+ */
+ Property addProperty();
+
+ /**
+ * Add a new property to the persistence unit at the specified index;
+ * return the newly-created property.
+ */
+ Property addProperty(int index);
+
+ /**
+ * Set the value of the *first* property in the persistence unit's property
+ * list with the specified name to the specified value, creating a new
+ * property if one does not already exist. If a property exists and the
+ * specified value is null, the existing property is removed.
+ */
+ void setProperty(String propertyName, String value);
+
+ /**
+ * Set the value of the property with the specified name, creating a new
+ * property if one does not exist or if the specified flag indicates
+ * duplicate property names are allowed. If a property exists and duplicate
+ * values are not allowed and the specified value is null, the existing
+ * property is removed.
+ */
+ void setProperty(String propertyName, String value, boolean duplicatePropertyNamesAllowed);
+
+ /**
+ * Remove the specified property from the persistence unit.
+ */
+ void removeProperty(Property property);
+
+ /**
+ * Remove the *first* property in the persistence unit's property list
+ * with the specified name.
+ */
+ void removeProperty(String propertyName);
+
+ /**
+ * Remove the *first* property in the persistence unit's property list
+ * with the specified name and value, allowing the removal of properties
+ * with duplicate property names.
+ */
+ void removeProperty(String propertyName, String value);
+
+ /**
+ * Call back method for Property name changing.
+ */
+ void propertyNameChanged(String oldPropertyName, String newPropertyName, String value);
+
+ /**
+ * Call back method for Property value changing.
+ */
+ void propertyValueChanged(String propertyName, String newValue);
+
+ /**
+ * Simple property interface.
+ */
+ interface Property
+ extends XmlContextNode
+ {
+ PersistenceUnit getParent();
+
+ @SuppressWarnings("hiding")
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+ String getName();
+ void setName(String name);
+
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+ String getValue();
+ void setValue(String value);
+
+ XmlProperty getXmlProperty();
+
+ /**
+ * Create ReplaceEdits for renaming the property value to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ * If this value does not match the original type, then return an empty Iterable.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming the property value package to the newName.
+ * The originalPackage has not yet been renamed.
+ * If this value is not in the originalPackage, then return an empty Iterable.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+ }
+
+
+ // ********** mapping file (orm.xml) persistence unit metadata **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * "XML mapping metadata complete" flag.
+ */
+ String XML_MAPPING_METADATA_COMPLETE_PROPERTY = "xmlMappingMetadataComplete"; //$NON-NLS-1$
+
+ /**
+ * Return the default "XML mapping metadata complete" flag from the
+ * first persistence unit metadata
+ * found in the persistence unit's list of mapping files.
+ */
+ boolean isXmlMappingMetadataComplete();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default access type.
+ */
+ String DEFAULT_ACCESS_PROPERTY = "defaultAccess"; //$NON-NLS-1$
+
+ /**
+ * Return the default access type from the first persistence unit metadata
+ * found in the persistence unit's list of mapping files.
+ */
+ AccessType getDefaultAccess();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default database catalog.
+ */
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$
+
+ /**
+ * Return the default database catalog from the first persistence unit metadata
+ * found in the persistence unit's list of mapping files.
+ */
+ String getDefaultCatalog();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default database schema.
+ */
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$
+
+ /**
+ * Return the default database schema from the first persistence unit metadata
+ * found in the persistence unit's list of mapping files.
+ */
+ String getDefaultSchema();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default "cascade persist" flag.
+ */
+ String DEFAULT_CASCADE_PERSIST_PROPERTY = "defaultCascadePersist"; //$NON-NLS-1$
+
+ /**
+ * Return the default "cascade persist" flag from the first persistence unit metadata
+ * found in the persistence unit's list of mapping files.
+ */
+ boolean getDefaultCascadePersist();
+
+
+ // ********** generators **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * collection of "global" generators.
+ * NB: There are no granular collection change notifications;
+ * only a "collection changed" notification when the collection
+ * is rebuilt at the finish of the persistence unit's "update".
+ */
+ String GENERATORS_COLLECTION = "generators"; //$NON-NLS-1$
+
+ /**
+ * Return the generators defined within the persistence unit's scope,
+ * including generators with duplicate names.
+ */
+ Iterator<Generator> generators();
+
+ /**
+ * Return the size of the list of generators defined within the persistence unit's scope,
+ * including generators with duplicate names.
+ */
+ int generatorsSize();
+
+ /**
+ * Add the specified generator (that is defined elsewhere) to the
+ * list of generators defined within the persistence unit's scope.
+ * NB: This is to be called by every generator during "update".
+ * This method does not directly generate a change notification.
+ * The change notification is fired at the end of the persistence unit's
+ * "update", once all the generators have added themselves.
+ */
+ void addGenerator(Generator generator);
+
+ /**
+ * Return the names of the generators defined in the persistence
+ * unit's scope, with duplicates removed.
+ */
+ Iterable<String> getUniqueGeneratorNames();
+
+
+ // ********** queries **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * collection of "global" queries.
+ * NB: There are no granular collection change notifications;
+ * only a "collection changed" notification when the collection is
+ * rebuilt at the finish of the persistence unit's "update".
+ */
+ String QUERIES_COLLECTION = "queries"; //$NON-NLS-1$
+
+ /**
+ * Return the queries defined within the persistence unit's scope,
+ * including queries with duplicate names.
+ */
+ Iterator<Query> queries();
+
+ /**
+ * Return the number of queries defined within the persistence unit's scope,
+ * including queries with duplicate names.
+ */
+ int queriesSize();
+
+ /**
+ * Add the specified query (that is defined elsewhere) to the
+ * list of queries defined within the persistence unit's scope.
+ * NB: This is to be called by every query during "update".
+ * This method does not directly generate a change notification.
+ * The change notification is fired at the end of the persistence unit's
+ * "update", once all the queries have added themselves.
+ */
+ void addQuery(Query query);
+
+
+ // ********** misc **********
+
+ /**
+ * Return the XML resource model corresponding to the
+ * persistence unit.
+ */
+ XmlPersistenceUnit getXmlPersistenceUnit();
+
+ /**
+ * Return the persistent type specified in the persistence unit with the
+ * specified name.
+ */
+ PersistentType getPersistentType(String typeName);
+
+ /**
+ * Return whether the persistence unit specifies a persistent type with the
+ * specified name (i.e. the type is listed either in the persistence unit's
+ * list of specified classes or in one of the persistent unit's mapping files).
+ */
+ boolean specifiesPersistentType(String typeName);
+
+ /**
+ * Return the persistence unit's entities.
+ */
+ Iterable<Entity> getEntities();
+
+ /**
+ * Return the entity specified in the persistence unit with the
+ * specified name. Return null if there is no persistent type
+ * with the specified name or if the persistent type is not mapped as an
+ * entity.
+ * @see org.eclipse.jpt.jpa.core.MappingKeys#ENTITY_TYPE_MAPPING_KEY
+ */
+ Entity getEntity(String typeName);
+
+ /**
+ * Return the embeddable specified in the persistence unit with the
+ * specified name. Return null if there is no persistent type
+ * with the specified name or if the persistent type is not mapped as an
+ * embeddable.
+ * @see org.eclipse.jpt.jpa.core.MappingKeys#EMBEDDABLE_TYPE_MAPPING_KEY
+ */
+ Embeddable getEmbeddable(String typeName);
+
+ /**
+ * Return whether the text representation of this persistence unit contains
+ * the given text offset
+ */
+ boolean containsOffset(int textOffset);
+
+ /**
+ * Return all the entities defined in both the implied and specified mapping files
+ * of a persistence unit
+ */
+ Iterable<Entity> getOrmEntities();
+
+ /**
+ * Return the entity names of all the entities defined in both the implied and specified mapping files
+ * of a persistence unit
+ */
+ Iterator<String> ormEntityNames();
+
+ /**
+ * Return all the entities defined with both the implied and specified Java classes
+ * of a persistence unit
+ */
+ Iterable<Entity> getJavaEntities();
+
+ /**
+ * Return the entity names of all the entities defined with both the implied and specified Java classes
+ * of a persistence unit
+ */
+ Iterator<String> javaEntityNames();
+
+ /**
+ * Return the entity names of entities only defined with mapped Java classes of a persistence unit.
+ * The names of Java entities overridden by entities defined in the mapping files are excluded.
+ */
+ Iterator<String> javaEntityNamesExclOverridden();
+
+
+ // ********** validation **********
+
+ /**
+ * Return whether the persistence unit validates agains database metadata.
+ * (For instance, if the connection is not active, then it should not.)
+ */
+ boolean validatesAgainstDatabase();
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create DeleteEdits for deleting any references to the deleted type.
+ * Return an EmptyIterable if there are not any references.
+ */
+ Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
+
+ /**
+ * Create DeleteEdits for deleting any references to the deleted file
+ * Return an EmptyIterable if there are not any references.
+ */
+ Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalFolder to the newName.
+ * The originalFolder has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName);
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalFile to the newName.
+ * Return an EmptyIterable if there are not any references.
+ * The originalFile has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameMappingFileEdits(IFile originalFile, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalFile to the destination.
+ * Return an EmptyIterable if there are not any references.
+ * The originalFile has not been moved yet.
+ */
+ Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination.
+ * The runtimeDestination already includes the original folder name.
+ */
+ Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination);
+
+ /**
+ * Return a location relative to the beginning of the persistence.xml for
+ * inserting a new mapping-file element. If there are existing mapping files,
+ * the location should be after those. If no existing mapping files then make
+ * sure the location does not violate the persistence.xml schema.
+ */
+ int findInsertLocationForMappingFileRef();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java
new file mode 100644
index 0000000000..a50723c10b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+* Copyright (c) 2007, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.model.Model;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.3
+ */
+public interface PersistenceUnitProperties extends Model
+{
+ /**
+ * Method used for identifying the given property.
+ */
+ boolean itemIsProperty(PersistenceUnit.Property item);
+
+ /**
+ * Returns the property name used for change notification of the given property.
+ */
+ String propertyIdOf(PersistenceUnit.Property property);
+
+ /**
+ * Return the PersistenceUnit of this Properties.
+ */
+ PersistenceUnit getPersistenceUnit();
+
+ /**
+ * Return the JPA project the PersistenceUnit belongs to.
+ */
+ JpaProject getJpaProject();
+
+ /**
+ * A Property with the given name had its value changed
+ */
+ void propertyValueChanged(String propertyName, String newValue);
+
+ /**
+ * A Property with the given name was removed
+ */
+ void propertyRemoved(String propertyName);
+
+
+ // ************ refactoring **************
+
+ /**
+ * Create ReplaceEdits for renaming any references to the originalType to the newName.
+ * The originalType has not yet been renamed, the newName is the new short name.
+ */
+ Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
+
+ /**
+ * Create ReplaceEdits for moving any references to the originalType to the newPackage.
+ * The originalType has not yet been moved.
+ */
+ Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
+
+ /**
+ * Create ReplaceEdits for renaming any reference to the originalPackage newName.
+ * The originalPackage has not yet been renamed.
+ */
+ Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java
new file mode 100644
index 0000000000..c9478dc229
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType;
+
+/**
+ * Context model corresponding to the XML resource model
+ * {@link XmlPersistenceUnitTransactionType},
+ * which corresponds to the <code>transaction-type</code> element in the
+ * <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public enum PersistenceUnitTransactionType
+{
+ /** Corresponds to JTA transaction type */
+ JTA,
+
+ /** Corresponds to RESOURCE_LOCAL transaction type */
+ RESOURCE_LOCAL;
+
+ public static PersistenceUnitTransactionType fromXmlResourceModel(XmlPersistenceUnitTransactionType transactionType) {
+ if (transactionType == null) {
+ return null;
+ }
+ switch (transactionType) {
+ case JTA:
+ return JTA;
+ case RESOURCE_LOCAL:
+ return RESOURCE_LOCAL;
+ default:
+ throw new IllegalArgumentException("unknown transaction type: " + transactionType); //$NON-NLS-1$
+ }
+ }
+
+ public static XmlPersistenceUnitTransactionType toXmlResourceModel(PersistenceUnitTransactionType transactionType) {
+ if (transactionType == null) {
+ return null;
+ }
+ switch (transactionType) {
+ case JTA:
+ return XmlPersistenceUnitTransactionType.JTA;
+ case RESOURCE_LOCAL:
+ return XmlPersistenceUnitTransactionType.RESOURCE_LOCAL;
+ default:
+ throw new IllegalArgumentException("unknown transaction type: " + transactionType); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java
new file mode 100644
index 0000000000..ff1c034335
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.XmlFile;
+
+/**
+ * JPA <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface PersistenceXml
+ extends XmlFile
+{
+ // ********** persistence **********
+
+ /**
+ * String constant associated with changes to the persistence property
+ */
+ public final static String PERSISTENCE_PROPERTY = "persistence"; //$NON-NLS-1$
+
+ /**
+ * Return the content represented by the root of the <code>persistence.xml</code> file.
+ * This may be null.
+ */
+ Persistence getPersistence();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
new file mode 100644
index 0000000000..98ef23c467
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.java.JarFile;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
+
+/**
+ * Interface used by persistence unit to gather up persistent types.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface PersistenceXmlContextNodeFactory
+{
+ Persistence buildPersistence(PersistenceXml parent, XmlPersistence resourcePersistence);
+
+ PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit resourcePersistenceUnit);
+
+ /**
+ * Build a "specified" mapping file ref.
+ */
+ MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef);
+
+ /**
+ * Build a "implied" mapping file ref.
+ */
+ MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent);
+
+ /**
+ * Build a "specified" class ref.
+ */
+ ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef xmlClassRef);
+
+ /**
+ * Build an "implied" class ref.
+ */
+ ClassRef buildClassRef(PersistenceUnit parent, String className);
+
+ JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef);
+
+ JarFile buildJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot);
+
+ PersistenceUnit.Property buildProperty(PersistenceUnit parent, XmlProperty property);
+
+ PersistenceUnitProperties buildConnection(PersistenceUnit parent);
+
+ PersistenceUnitProperties buildOptions(PersistenceUnit parent);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java
new file mode 100644
index 0000000000..218b88e434
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+
+/**
+ * <code>persistence.xml</code> definition
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface PersistenceXmlDefinition
+ extends ResourceDefinition
+{
+ EFactory getResourceNodeFactory();
+
+ PersistenceXmlContextNodeFactory getContextNodeFactory();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java
new file mode 100644
index 0000000000..554e665f01
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.persistence;
+
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+
+/**
+ * Interface used by persistence unit to gather up persistent types.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface PersistentTypeContainer {
+
+ /**
+ * Return the container's persistent types.
+ */
+ Iterable<? extends PersistentType> getPersistentTypes();
+
+
+ Transformer<PersistentTypeContainer, Iterable<? extends PersistentType>> TRANSFORMER =
+ new Transformer<PersistentTypeContainer, Iterable<? extends PersistentType>>() {
+ public Iterable<? extends PersistentType> transform(PersistentTypeContainer container) {
+ return container.getPersistentTypes();
+ }
+ @Override
+ public String toString() {
+ return "PersistentTypeContainer.TRANSFORMER"; //$NON-NLS-1$
+ }
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java
new file mode 100644
index 0000000000..9912509ddb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.ArrayList;
+import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+
+public abstract class AbstractJpaAnnotationDefinitionProvider
+ implements JpaAnnotationDefinitionProvider
+{
+ protected ArrayList<AnnotationDefinition> typeAnnotationDefinitions;
+
+ protected ArrayList<AnnotationDefinition> typeMappingAnnotationDefinitions;
+
+ protected ArrayList<AnnotationDefinition> attributeAnnotationDefinitions;
+
+ private ArrayList<AnnotationDefinition> packageAnnotationDefinitions;
+
+
+ protected AbstractJpaAnnotationDefinitionProvider() {
+ super();
+ }
+
+
+ // ********** type annotation definitions **********
+
+ public synchronized Iterable<AnnotationDefinition> getTypeAnnotationDefinitions() {
+ if (this.typeAnnotationDefinitions == null) {
+ this.typeAnnotationDefinitions = this.buildTypeAnnotationDefinitions();
+ }
+ return this.typeAnnotationDefinitions;
+ }
+
+ protected ArrayList<AnnotationDefinition> buildTypeAnnotationDefinitions() {
+ ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
+ this.addTypeAnnotationDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
+
+
+ // ********** type mapping annotation definitions **********
+
+ public synchronized Iterable<AnnotationDefinition> getTypeMappingAnnotationDefinitions() {
+ if (this.typeMappingAnnotationDefinitions == null) {
+ this.typeMappingAnnotationDefinitions = this.buildTypeMappingAnnotationDefinitions();
+ }
+ return this.typeMappingAnnotationDefinitions;
+ }
+
+ protected ArrayList<AnnotationDefinition> buildTypeMappingAnnotationDefinitions() {
+ ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
+ this.addTypeMappingAnnotationDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
+
+
+ // ********** attribute annotation definitions **********
+
+ public synchronized Iterable<AnnotationDefinition> getAttributeAnnotationDefinitions() {
+ if (this.attributeAnnotationDefinitions == null) {
+ this.attributeAnnotationDefinitions = this.buildAttributeAnnotationDefinitions();
+ }
+ return this.attributeAnnotationDefinitions;
+ }
+
+ protected ArrayList<AnnotationDefinition> buildAttributeAnnotationDefinitions() {
+ ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
+ this.addAttributeAnnotationDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
+
+
+ // ********** package annotation definitions **********
+
+ public synchronized Iterable<AnnotationDefinition> getPackageAnnotationDefinitions() {
+ if (this.packageAnnotationDefinitions == null) {
+ this.packageAnnotationDefinitions = this.buildPackageAnnotationDefinitions();
+ }
+ return this.packageAnnotationDefinitions;
+ }
+
+ protected ArrayList<AnnotationDefinition> buildPackageAnnotationDefinitions() {
+ ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
+ this.addPackageAnnotationDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
new file mode 100644
index 0000000000..31ea66c1c3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
@@ -0,0 +1,402 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaNullTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaDataSource;
+import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFile;
+import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaProject;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaBasicMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEntity;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaGeneratedValue;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaGeneratorContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaIdMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaJoinTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaLobConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaManyToManyMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaManyToOneMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNamedQuery;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOneToManyMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOneToOneMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOrderable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaQueryContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaQueryHint;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTableGenerator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTransientMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVersionMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * Central class that allows extenders to easily replace implementations of
+ * various Dali interfaces.
+ */
+public abstract class AbstractJpaFactory
+ implements JpaFactory
+{
+ protected AbstractJpaFactory() {
+ super();
+ }
+
+
+ // ********** Core Model **********
+
+ public JpaProject buildJpaProject(JpaProject.Config config) {
+ return new GenericJpaProject(config);
+ }
+
+ public JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
+ return new GenericJpaDataSource(jpaProject, connectionProfileName);
+ }
+
+ public JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel) {
+ return new GenericJpaFile(jpaProject, file, contentType, resourceModel);
+ }
+
+
+ // ********** Context Nodes **********
+
+ public JpaRootContextNode buildRootContextNode(JpaProject parent) {
+ return new GenericRootContextNode(parent);
+ }
+
+
+ // ********** XML Context Model **********
+
+ public PersistenceXml buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource) {
+ return new GenericPersistenceXml(parent, resource);
+ }
+
+ public OrmXml buildMappingFile(MappingFileRef parent, JpaXmlResource resource) {
+ return new GenericOrmXml(parent, resource);
+ }
+
+
+ // ********** Java Context Model **********
+
+ public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) {
+ return new GenericJavaPersistentType(owner, jrpt);
+ }
+
+ public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
+ return new GenericJavaPersistentAttribute(parent, jrpa);
+ }
+
+ public JavaTypeMapping buildJavaNullTypeMapping(JavaPersistentType parent) {
+ return new JavaNullTypeMapping(parent);
+ }
+
+ public JavaEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation) {
+ return new GenericJavaEntity(parent, entityAnnotation);
+ }
+
+ public JavaMappedSuperclass buildJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappedSuperclassAnnotation) {
+ return new GenericJavaMappedSuperclass(parent, mappedSuperclassAnnotation);
+ }
+
+ public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation) {
+ return new GenericJavaEmbeddable(parent, embeddableAnnotation);
+ }
+
+ public JavaTable buildJavaTable(JavaEntity parent, Table.Owner owner) {
+ return new GenericJavaTable(parent, owner);
+ }
+
+ public JavaColumn buildJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) {
+ return new GenericJavaColumn(parent, owner);
+ }
+
+ public JavaVirtualColumn buildJavaVirtualColumn(JavaJpaContextNode parent, JavaVirtualColumn.Owner owner) {
+ return new GenericJavaVirtualColumn(parent, owner);
+ }
+
+ public JavaDiscriminatorColumn buildJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner) {
+ return new GenericJavaDiscriminatorColumn(parent, owner);
+ }
+
+ public JavaJoinColumn buildJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner, JoinColumnAnnotation joinColumnAnnotation) {
+ return new GenericJavaJoinColumn(parent, owner, joinColumnAnnotation);
+ }
+
+ public JavaVirtualJoinColumn buildJavaVirtualJoinColumn(JavaJpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) {
+ return new GenericJavaVirtualJoinColumn(parent, owner, joinColumn);
+ }
+
+ public JavaJoinTable buildJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Table.Owner owner) {
+ return new GenericJavaJoinTable(parent, owner);
+ }
+
+ public JavaVirtualJoinTable buildJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) {
+ return new GenericJavaVirtualJoinTable(parent, overriddenTable);
+ }
+
+ public JavaSecondaryTable buildJavaSecondaryTable(JavaEntity parent, Table.Owner owner, SecondaryTableAnnotation tableAnnotation) {
+ return new GenericJavaSecondaryTable(parent, owner, tableAnnotation);
+ }
+
+ public JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaBasicMapping(parent);
+ }
+
+ public JavaEmbeddedIdMapping buildJavaEmbeddedIdMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaEmbeddedIdMapping(parent);
+ }
+
+ public JavaEmbeddedMapping buildJavaEmbeddedMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaEmbeddedMapping(parent);
+ }
+
+ public JavaIdMapping buildJavaIdMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaIdMapping(parent);
+ }
+
+ public JavaManyToManyMapping buildJavaManyToManyMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaManyToManyMapping(parent);
+ }
+
+ public JavaManyToOneMapping buildJavaManyToOneMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaManyToOneMapping(parent);
+ }
+
+ public JavaOneToManyMapping buildJavaOneToManyMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaOneToManyMapping(parent);
+ }
+
+ public JavaOneToOneMapping buildJavaOneToOneMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaOneToOneMapping(parent);
+ }
+
+ public JavaTransientMapping buildJavaTransientMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaTransientMapping(parent);
+ }
+
+ public JavaVersionMapping buildJavaVersionMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaVersionMapping(parent);
+ }
+
+ public JavaAttributeMapping buildJavaNullAttributeMapping(JavaPersistentAttribute parent) {
+ return new GenericJavaNullAttributeMapping(parent);
+ }
+
+ public JavaGeneratorContainer buildJavaGeneratorContainer(JavaJpaContextNode parent, JavaGeneratorContainer.Owner owner) {
+ return new GenericJavaGeneratorContainer(parent, owner);
+ }
+
+ public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation sequenceGeneratorAnnotation) {
+ return new GenericJavaSequenceGenerator(parent, sequenceGeneratorAnnotation);
+ }
+
+ public JavaTableGenerator buildJavaTableGenerator(JavaJpaContextNode parent, TableGeneratorAnnotation tableGeneratorAnnotation) {
+ return new GenericJavaTableGenerator(parent, tableGeneratorAnnotation);
+ }
+
+ public JavaGeneratedValue buildJavaGeneratedValue(JavaIdMapping parent, GeneratedValueAnnotation generatedValueAnnotation) {
+ return new GenericJavaGeneratedValue(parent, generatedValueAnnotation);
+ }
+
+ public JavaPrimaryKeyJoinColumn buildJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) {
+ return new GenericJavaPrimaryKeyJoinColumn(parent, owner, pkJoinColumnAnnotation);
+ }
+
+ public JavaAttributeOverrideContainer buildJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner) {
+ return new GenericJavaAttributeOverrideContainer(parent, owner);
+ }
+
+ public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaJpaContextNode parent, JavaAssociationOverrideContainer.Owner owner) {
+ return new GenericJavaAssociationOverrideContainer(parent, owner);
+ }
+
+ public JavaAttributeOverride buildJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverrideAnnotation annotation) {
+ return new GenericJavaAttributeOverride(parent, annotation);
+ }
+
+ public JavaVirtualAttributeOverride buildJavaVirtualAttributeOverride(JavaAttributeOverrideContainer parent, String name) {
+ return new GenericJavaVirtualAttributeOverride(parent, name);
+ }
+
+ public JavaAssociationOverride buildJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverrideAnnotation annotation) {
+ return new GenericJavaAssociationOverride(parent, annotation);
+ }
+
+ public JavaVirtualAssociationOverride buildJavaVirtualAssociationOverride(JavaAssociationOverrideContainer parent, String name) {
+ return new GenericJavaVirtualAssociationOverride(parent, name);
+ }
+
+ public JavaOverrideRelationship buildJavaOverrideRelationship(JavaAssociationOverride parent) {
+ return new GenericJavaOverrideRelationship(parent);
+ }
+
+ public JavaVirtualOverrideRelationship buildJavaVirtualOverrideRelationship(JavaVirtualAssociationOverride parent) {
+ return new GenericJavaVirtualOverrideRelationship(parent);
+ }
+
+ public JavaQueryContainer buildJavaQueryContainer(JavaJpaContextNode parent, JavaQueryContainer.Owner owner) {
+ return new GenericJavaQueryContainer(parent, owner);
+ }
+
+ public JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation namedQueryAnnotation) {
+ return new GenericJavaNamedQuery(parent, namedQueryAnnotation);
+ }
+
+ public JavaNamedNativeQuery buildJavaNamedNativeQuery(JavaJpaContextNode parent, NamedNativeQueryAnnotation namedNativeQueryAnnotation) {
+ return new GenericJavaNamedNativeQuery(parent, namedNativeQueryAnnotation);
+ }
+
+ public JavaQueryHint buildJavaQueryHint(JavaQuery parent, QueryHintAnnotation queryHintAnnotation) {
+ return new GenericJavaQueryHint(parent, queryHintAnnotation);
+ }
+
+ public JavaUniqueConstraint buildJavaUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint.Owner owner, UniqueConstraintAnnotation constraintAnnotation) {
+ return new GenericJavaUniqueConstraint(parent, owner, constraintAnnotation);
+ }
+
+ public JavaVirtualUniqueConstraint buildJavaVirtualUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint uniqueConstraint) {
+ return new GenericJavaVirtualUniqueConstraint(parent, uniqueConstraint);
+ }
+
+ public JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation) {
+ return new GenericJavaEnumeratedConverter(parent, annotation);
+ }
+
+ public JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation) {
+ return new GenericJavaTemporalConverter(parent, annotation);
+ }
+
+ public JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation) {
+ return new GenericJavaLobConverter(parent, annotation);
+ }
+
+ public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) {
+ return new GenericJavaOrderable(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
new file mode 100644
index 0000000000..a7a7a73a20
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport;
+import org.eclipse.jpt.common.utility.internal.model.ChangeSupport;
+import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaNode;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Database;
+
+/**
+ * Some common Dali behavior:<ul>
+ * <li>containment hierarchy
+ * <li>Eclipse adaptable
+ * <li>update triggers
+ * </ul>
+ */
+public abstract class AbstractJpaNode
+ extends AbstractModel
+ implements JpaNode
+{
+ protected final JpaNode parent;
+
+
+ // ********** constructor/initialization **********
+
+ protected AbstractJpaNode(JpaNode parent) {
+ super();
+ this.checkParent(parent);
+ this.parent = parent;
+ }
+
+ protected void checkParent(JpaNode p) {
+ if (p == null) {
+ if (this.requiresParent()) {
+ throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$
+ }
+ } else {
+ if (this.forbidsParent()) {
+ throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ protected boolean requiresParent() {
+ return true;
+ }
+
+ protected final boolean forbidsParent() {
+ return ! this.requiresParent(); // assume 'parent' is not optional
+ }
+
+ @Override
+ protected ChangeSupport buildChangeSupport() {
+ return new AspectChangeSupport(this, this.buildChangeSupportListener());
+ }
+
+ protected AspectChangeSupport.Listener buildChangeSupportListener() {
+ return new AspectChangeSupport.Listener() {
+ public void aspectChanged(String aspectName) {
+ AbstractJpaNode.this.aspectChanged(aspectName);
+ }
+ };
+ }
+
+
+ // ********** IAdaptable implementation **********
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+
+ // ********** JpaNode implementation **********
+
+ public JpaNode getParent() {
+ return this.parent;
+ }
+
+ public IResource getResource() {
+ return this.parent.getResource();
+ }
+
+ public JpaProject getJpaProject() {
+ return this.parent.getJpaProject();
+ }
+
+
+ // ********** convenience methods **********
+
+ protected JpaPlatform getJpaPlatform() {
+ return this.getJpaProject().getJpaPlatform();
+ }
+
+ protected JpaPlatform.Version getJpaPlatformVersion() {
+ return this.getJpaPlatform().getJpaVersion();
+ }
+
+ protected boolean isJpa2_0Compatible() {
+ return JptJpaCorePlugin.nodeIsJpa2_0Compatible(this);
+ }
+
+ /**
+ * Call {@link #isJpa2_0Compatible()} before calling this method.
+ */
+ protected JpaFactory2_0 getJpaFactory2_0() {
+ return (JpaFactory2_0) this.getJpaFactory();
+ }
+
+ protected JpaFactory getJpaFactory() {
+ return this.getJpaPlatform().getJpaFactory();
+ }
+
+ protected JpaPlatformVariation getJpaPlatformVariation() {
+ return this.getJpaPlatform().getJpaVariation();
+ }
+
+ protected JpaFile getJpaFile(IFile file) {
+ return this.getJpaProject().getJpaFile(file);
+ }
+
+ protected JpaDataSource getDataSource() {
+ return this.getJpaProject().getDataSource();
+ }
+
+ protected Database getDatabase() {
+ return this.getDataSource().getDatabase();
+ }
+
+ protected boolean connectionProfileIsActive() {
+ return this.getDataSource().connectionProfileIsActive();
+ }
+
+ /**
+ * Pre-condition: specified catalog <em>identifier</em> is not null.
+ * NB: Do not use the catalog <em>name</em>.
+ */
+ protected Catalog resolveDbCatalog(String catalog) {
+ Database database = this.getDatabase();
+ return (database == null) ? null : database.getCatalogForIdentifier(catalog);
+ }
+
+
+ // ********** AspectChangeSupport.Listener support **********
+
+ protected void aspectChanged(String aspectName) {
+ if (this.aspectTriggersUpdate(aspectName)) {
+// String msg = Thread.currentThread() + " aspect change: " + this + ": " + aspectName;
+// System.out.println(msg);
+// new Exception(msg).printStackTrace(System.out);
+ this.stateChanged();
+ }
+ }
+
+ protected boolean aspectTriggersUpdate(String aspectName) {
+ return ! this.aspectDoesNotTriggerUpdate(aspectName);
+ }
+
+ protected boolean aspectDoesNotTriggerUpdate(String aspectName) {
+ // ignore state changes so we don't get a stack overflow :-)
+ // (and we don't use state changes except here)
+ return (aspectName == null) ||
+ this.nonUpdateAspectNames().contains(aspectName);
+ }
+
+ protected final Set<String> nonUpdateAspectNames() {
+ synchronized (NON_UPDATE_ASPECT_NAME_SETS) {
+ HashSet<String> nonUpdateAspectNames = NON_UPDATE_ASPECT_NAME_SETS.get(this.getClass());
+ if (nonUpdateAspectNames == null) {
+ nonUpdateAspectNames = new HashSet<String>();
+ this.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ NON_UPDATE_ASPECT_NAME_SETS.put(this.getClass(), nonUpdateAspectNames);
+ }
+ return nonUpdateAspectNames;
+ }
+ }
+
+ private static final HashMap<Class<? extends AbstractJpaNode>, HashSet<String>> NON_UPDATE_ASPECT_NAME_SETS = new HashMap<Class<? extends AbstractJpaNode>, HashSet<String>>();
+
+ protected void addNonUpdateAspectNamesTo(@SuppressWarnings("unused") Set<String> nonUpdateAspectNames) {
+ // when you override this method, don't forget to include:
+ // super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ }
+
+ public void stateChanged() {
+ this.fireStateChanged();
+ if (this.parent != null) {
+ this.parent.stateChanged();
+ }
+ }
+
+
+ // ********** convenience stuff **********
+
+ /**
+ * Useful for building validation messages.
+ */
+ public static final String[] EMPTY_STRING_ARRAY = StringTools.EMPTY_STRING_ARRAY;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java
new file mode 100644
index 0000000000..785068d04f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.ArrayList;
+import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+
+/**
+ * All the state in the JPA platform should be "static" (i.e. unchanging once
+ * it is initialized).
+ */
+public abstract class AbstractJpaPlatformProvider
+ implements JpaPlatformProvider
+{
+ protected ArrayList<JpaResourceModelProvider> resourceModelProviders;
+
+ protected ArrayList<JavaTypeMappingDefinition> javaTypeMappingDefinitions;
+
+ protected ArrayList<DefaultJavaAttributeMappingDefinition> defaultJavaAttributeMappingDefinitions;
+
+ protected ArrayList<JavaAttributeMappingDefinition> specifiedJavaAttributeMappingDefinitions;
+
+ protected ArrayList<ResourceDefinition> resourceDefinitions;
+
+
+ /**
+ * zero-argument constructor
+ */
+ protected AbstractJpaPlatformProvider() {
+ super();
+ }
+
+
+ // ********** resource models **********
+
+ public synchronized Iterable<JpaResourceModelProvider> getResourceModelProviders() {
+ if (this.resourceModelProviders == null) {
+ this.resourceModelProviders = this.buildResourceModelProviders();
+ }
+ return this.resourceModelProviders;
+ }
+
+ protected ArrayList<JpaResourceModelProvider> buildResourceModelProviders() {
+ ArrayList<JpaResourceModelProvider> providers = new ArrayList<JpaResourceModelProvider>();
+ this.addResourceModelProvidersTo(providers);
+ return providers;
+ }
+
+ protected abstract void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers);
+
+
+ // ********** Java type mappings **********
+
+ public synchronized Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions() {
+ if (this.javaTypeMappingDefinitions == null) {
+ this.javaTypeMappingDefinitions = this.buildJavaTypeMappingDefinitions();
+ }
+ return this.javaTypeMappingDefinitions;
+ }
+
+ protected ArrayList<JavaTypeMappingDefinition> buildJavaTypeMappingDefinitions() {
+ ArrayList<JavaTypeMappingDefinition> definitions = new ArrayList<JavaTypeMappingDefinition>();
+ this.addJavaTypeMappingDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ /**
+ * To the specified list, add mapping definitions to use for analyzing the
+ * mapping of a type given all annotations on it. The order is important,
+ * as once a mapping definition tests positive for a
+ * type, all following mapping definitions are ignored.
+ */
+ protected abstract void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions);
+
+
+ // ********** Java attribute mappings **********
+
+ public synchronized Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions() {
+ if (this.defaultJavaAttributeMappingDefinitions == null) {
+ this.defaultJavaAttributeMappingDefinitions = this.buildDefaultJavaAttributeMappingDefinitions();
+ }
+ return this.defaultJavaAttributeMappingDefinitions;
+ }
+
+ protected ArrayList<DefaultJavaAttributeMappingDefinition> buildDefaultJavaAttributeMappingDefinitions() {
+ ArrayList<DefaultJavaAttributeMappingDefinition> definitions = new ArrayList<DefaultJavaAttributeMappingDefinition>();
+ this.addDefaultJavaAttributeMappingDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ /**
+ * To the specified list, add mapping definitions to use for analyzing the
+ * default mapping of an attribute. The order is important,
+ * as once a mapping definition tests positive for an attribute,
+ * all following mapping definitions are ignored.
+ */
+ protected abstract void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions);
+
+ public synchronized Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions() {
+ if (this.specifiedJavaAttributeMappingDefinitions == null) {
+ this.specifiedJavaAttributeMappingDefinitions = this.buildSpecifiedJavaAttributeMappingDefinitions();
+ }
+ return this.specifiedJavaAttributeMappingDefinitions;
+ }
+
+ protected ArrayList<JavaAttributeMappingDefinition> buildSpecifiedJavaAttributeMappingDefinitions() {
+ ArrayList<JavaAttributeMappingDefinition> definitions = new ArrayList<JavaAttributeMappingDefinition>();
+ this.addSpecifiedJavaAttributeMappingDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ /**
+ * To the specified list, add mapping definitions to use for analyzing the
+ * specified mapping of an attribute given all annotations on it. The order
+ * is important, as once a mapping definition tests positive for an
+ * attribute, all following mapping definitions are ignored.
+ */
+ protected abstract void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions);
+
+
+ // ********** resource definitions **********
+
+ public synchronized Iterable<ResourceDefinition> getResourceDefinitions() {
+ if (this.resourceDefinitions == null) {
+ this.resourceDefinitions = this.buildResourceDefinitions();
+ }
+ return this.resourceDefinitions;
+ }
+
+ protected ArrayList<ResourceDefinition> buildResourceDefinitions() {
+ ArrayList<ResourceDefinition> definitions = new ArrayList<ResourceDefinition>();
+ this.addResourceDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
new file mode 100644
index 0000000000..aea481dfcd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
@@ -0,0 +1,1955 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IResourceProxy;
+import org.eclipse.core.resources.IResourceProxyVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
+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.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.JptResourceModelListener;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.resource.ResourceLocator;
+import org.eclipse.jpt.common.utility.Command;
+import org.eclipse.jpt.common.utility.CommandExecutor;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.BitTools;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.ThreadLocalCommandExecutor;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer;
+import org.eclipse.jpt.common.utility.internal.synchronizers.SynchronousSynchronizer;
+import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer;
+import org.eclipse.jpt.common.utility.synchronizers.Synchronizer;
+import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPersistentTypeCache;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageInfoCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.ConnectionProfile;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * JPA project. Holds all the JPA stuff.
+ *
+ * The JPA platform provides the hooks for vendor-specific stuff.
+ *
+ * The JPA files are the "resource" model (i.e. objects that correspond directly
+ * to Eclipse resources; e.g. Java source code files, XML files, JAR files).
+ *
+ * The root context node is the "context"model (i.e. objects that attempt to
+ * model the JPA spec, using the "resource" model as an adapter to the Eclipse
+ * resources).
+ *
+ * The data source is an adapter to the DTP meta-data model.
+ */
+public abstract class AbstractJpaProject
+ extends AbstractJpaNode
+ implements JpaProject2_0
+{
+ /**
+ * The Eclipse project corresponding to the JPA project.
+ */
+ protected final IProject project;
+
+ /**
+ * The vendor-specific JPA platform that builds the JPA project
+ * and all its contents.
+ */
+ protected final JpaPlatform jpaPlatform;
+
+ /**
+ * The JPA files associated with the JPA project:
+ * persistence.xml
+ * orm.xml
+ * java
+ */
+ protected final Vector<JpaFile> jpaFiles = new Vector<JpaFile>();
+
+ /**
+ * The "external" Java resource compilation units (source). Populated upon demand.
+ */
+ protected final Vector<JavaResourceCompilationUnit> externalJavaResourceCompilationUnits = new Vector<JavaResourceCompilationUnit>();
+
+ /**
+ * The "external" Java resource persistent types (binary). Populated upon demand.
+ */
+ protected final JavaResourcePersistentTypeCache externalJavaResourcePersistentTypeCache;
+
+ /**
+ * Resource models notify this listener when they change. A project update
+ * should occur any time a resource model changes.
+ */
+ protected final JptResourceModelListener resourceModelListener;
+
+ /**
+ * The root of the model representing the collated resources associated with
+ * the JPA project.
+ */
+ protected final JpaRootContextNode rootContextNode;
+
+ /**
+ * A pluggable synchronizer that keeps the JPA
+ * project's context model synchronized with its resource model, either
+ * synchronously or asynchronously (or not at all). A synchronous synchronizer
+ * is the default. For performance reasons, a UI should
+ * immediately change this to an asynchronous synchronizer. A synchronous
+ * synchronizer can be used when the project is being manipulated by a "batch"
+ * (or non-UI) client (e.g. when testing "synchronization"). A null updater
+ * can used during tests that do not care whether "synchronization" occur.
+ * Clients will need to explicitly configure the synchronizer if they require
+ * an asynchronous synchronizer.
+ */
+ protected volatile Synchronizer contextModelSynchronizer;
+ protected volatile boolean synchronizingContextModel = false;
+
+ /**
+ * A pluggable synchronizer that "updates" the JPA project, either
+ * synchronously or asynchronously (or not at all). A synchronous updater
+ * is the default, allowing a newly-constructed JPA project to be "updated"
+ * upon return from the constructor. For performance reasons, a UI should
+ * immediately change this to an asynchronous updater. A synchronous
+ * updater can be used when the project is being manipulated by a "batch"
+ * (or non-UI) client (e.g. when testing the "update" behavior). A null
+ * updater can used during tests that do not care whether "synchronization"
+ * occur.
+ * Clients will need to explicitly configure the updater if they require
+ * an asynchronous updater.
+ */
+ protected volatile CallbackSynchronizer updateSynchronizer;
+ protected final CallbackSynchronizer.Listener updateSynchronizerListener;
+
+ /**
+ * The data source that wraps the DTP model.
+ */
+ // TODO move to persistence unit... :-(
+ protected final JpaDataSource dataSource;
+
+ /**
+ * A catalog name used to override the connection's default catalog.
+ */
+ protected volatile String userOverrideDefaultCatalog;
+
+ /**
+ * A schema name used to override the connection's default schema.
+ */
+ protected volatile String userOverrideDefaultSchema;
+
+ /**
+ * Flag indicating whether the project should "discover" annotated
+ * classes automatically, as opposed to requiring the classes to be
+ * listed in <code>persistence.xml</code>. Stored as a preference.
+ * @see #setDiscoversAnnotatedClasses(boolean)
+ */
+ protected volatile boolean discoversAnnotatedClasses;
+
+ /**
+ * Support for modifying documents shared with the UI.
+ */
+ protected final ThreadLocalCommandExecutor modifySharedDocumentCommandExecutor;
+
+ /**
+ * The name of the Java project source folder that holds the generated
+ * metamodel. If the name is <code>null</code> the metamodel is not
+ * generated.
+ */
+ protected volatile String metamodelSourceFolderName;
+
+
+ // ********** constructor/initialization **********
+
+ protected AbstractJpaProject(JpaProject.Config config) {
+ super(null); // JPA project is the root of the containment tree
+ if ((config.getProject() == null) || (config.getJpaPlatform() == null)) {
+ throw new NullPointerException();
+ }
+ this.project = config.getProject();
+ this.jpaPlatform = config.getJpaPlatform();
+ this.dataSource = this.getJpaFactory().buildJpaDataSource(this, config.getConnectionProfileName());
+ this.userOverrideDefaultCatalog = config.getUserOverrideDefaultCatalog();
+ this.userOverrideDefaultSchema = config.getUserOverrideDefaultSchema();
+ this.discoversAnnotatedClasses = config.discoverAnnotatedClasses();
+
+ this.modifySharedDocumentCommandExecutor = this.buildModifySharedDocumentCommandExecutor();
+
+ this.resourceModelListener = this.buildResourceModelListener();
+ // build the JPA files corresponding to the Eclipse project's files
+ InitialResourceProxyVisitor visitor = this.buildInitialResourceProxyVisitor();
+ visitor.visitProject(this.project);
+
+ this.externalJavaResourcePersistentTypeCache = this.buildExternalJavaResourcePersistentTypeCache();
+
+ if (this.isJpa2_0Compatible()) {
+ this.metamodelSourceFolderName = ((JpaProject2_0.Config) config).getMetamodelSourceFolderName();
+ if (this.metamodelSoureFolderNameIsInvalid()) {
+ this.metamodelSourceFolderName = null;
+ }
+ }
+
+ this.rootContextNode = this.buildRootContextNode();
+
+ // there *shouldn't* be any changes to the resource model...
+ this.setContextModelSynchronizer_(this.buildSynchronousContextModelSynchronizer());
+
+ this.updateSynchronizerListener = this.buildUpdateSynchronizerListener();
+ // "update" the project before returning
+ this.setUpdateSynchronizer_(this.buildSynchronousUpdateSynchronizer());
+
+ // start listening to this cache once the context model has been built
+ // and all the external types are faulted in
+ this.externalJavaResourcePersistentTypeCache.addResourceModelListener(this.resourceModelListener);
+ }
+
+ @Override
+ protected boolean requiresParent() {
+ return false;
+ }
+
+ @Override
+ public IResource getResource() {
+ return this.project;
+ }
+
+ protected JavaResourcePersistentTypeCache buildExternalJavaResourcePersistentTypeCache() {
+ return new BinaryPersistentTypeCache(this.jpaPlatform.getAnnotationProvider());
+ }
+
+ protected JpaRootContextNode buildRootContextNode() {
+ return this.getJpaFactory().buildRootContextNode(this);
+ }
+
+
+ // ********** initial resource proxy visitor **********
+
+ protected InitialResourceProxyVisitor buildInitialResourceProxyVisitor() {
+ return new InitialResourceProxyVisitor();
+ }
+
+ protected class InitialResourceProxyVisitor implements IResourceProxyVisitor {
+ protected InitialResourceProxyVisitor() {
+ super();
+ }
+ protected void visitProject(IProject p) {
+ try {
+ p.accept(this, IResource.NONE);
+ } catch (CoreException ex) {
+ // shouldn't happen - we don't throw any CoreExceptions
+ throw new RuntimeException(ex);
+ }
+ }
+ // add a JPA file for every [appropriate] file encountered by the visitor
+ public boolean visit(IResourceProxy resource) {
+ switch (resource.getType()) {
+ case IResource.ROOT : // shouldn't happen
+ return true; // visit children
+ case IResource.PROJECT :
+ return true; // visit children
+ case IResource.FOLDER :
+ return true; // visit children
+ case IResource.FILE :
+ AbstractJpaProject.this.addJpaFile_((IFile) resource.requestResource());
+ return false; // no children
+ default :
+ return false; // no children
+ }
+ }
+ }
+
+
+ // ********** misc **********
+
+ /**
+ * Ignore changes to this collection. Adds can be ignored since they are triggered
+ * by requests that will, themselves, trigger updates (typically during the
+ * update of an object that calls a setter with the newly-created resource
+ * type). Deletes will be accompanied by manual updates.
+ */
+ @Override
+ protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
+ super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ nonUpdateAspectNames.add(EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION);
+ }
+
+
+ // ********** general queries **********
+
+ @Override
+ public JpaProject getJpaProject() {
+ return this;
+ }
+
+ public String getName() {
+ return this.project.getName();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+
+ public IProject getProject() {
+ return this.project;
+ }
+
+ public IJavaProject getJavaProject() {
+ return JavaCore.create(this.project);
+ }
+
+ @Override
+ public JpaPlatform getJpaPlatform() {
+ return this.jpaPlatform;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<JavaResourceCompilationUnit> getCombinedJavaResourceCompilationUnits() {
+ return new CompositeIterable<JavaResourceCompilationUnit>(
+ this.getInternalJavaResourceCompilationUnits(),
+ this.getExternalJavaResourceCompilationUnits()
+ );
+ }
+
+
+ // ********** database **********
+
+ @Override
+ public JpaDataSource getDataSource() {
+ return this.dataSource;
+ }
+
+ public ConnectionProfile getConnectionProfile() {
+ return this.dataSource.getConnectionProfile();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDefaultDbCatalog() {
+ String catalog = this.getDefaultCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ public String getDefaultCatalog() {
+ String catalog = this.getUserOverrideDefaultCatalog();
+ return (catalog != null) ? catalog : this.getDatabaseDefaultCatalog();
+ }
+
+ protected String getDatabaseDefaultCatalog() {
+ Database db = this.getDatabase();
+ return (db == null ) ? null : db.getDefaultCatalogIdentifier();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDefaultDbSchemaContainer() {
+ String catalog = this.getDefaultCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ public Schema getDefaultDbSchema() {
+ SchemaContainer sc = this.getDefaultDbSchemaContainer();
+ return (sc == null) ? null : sc.getSchemaForIdentifier(this.getDefaultSchema());
+ }
+
+ public String getDefaultSchema() {
+ String schema = this.getUserOverrideDefaultSchema();
+ if (schema != null) {
+ return schema;
+ }
+
+ String catalog = this.getDefaultCatalog();
+ if (catalog == null) {
+ // if there is no default catalog (either user-override or database-determined),
+ // the database probably does not support catalogs;
+ // return the database's default schema
+ return this.getDatabaseDefaultSchema();
+ }
+
+ Catalog dbCatalog = this.resolveDbCatalog(catalog);
+ if (dbCatalog != null) {
+ return dbCatalog.getDefaultSchemaIdentifier();
+ }
+
+ // if we could not find a catalog on the database that matches the default
+ // catalog name, return the database's default schema(?) - hmmm
+ return this.getDatabaseDefaultSchema();
+ }
+
+ protected String getDatabaseDefaultSchema() {
+ Database db = this.getDatabase();
+ return (db == null ) ? null : db.getDefaultSchemaIdentifier();
+ }
+
+
+ // ********** user override default catalog **********
+
+ public String getUserOverrideDefaultCatalog() {
+ return this.userOverrideDefaultCatalog;
+ }
+
+ public void setUserOverrideDefaultCatalog(String catalog) {
+ String old = this.userOverrideDefaultCatalog;
+ this.userOverrideDefaultCatalog = catalog;
+ JptJpaCorePlugin.setUserOverrideDefaultCatalog(this.project, catalog);
+ this.firePropertyChanged(USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+
+ // ********** user override default schema **********
+
+ public String getUserOverrideDefaultSchema() {
+ return this.userOverrideDefaultSchema;
+ }
+
+ public void setUserOverrideDefaultSchema(String schema) {
+ String old = this.userOverrideDefaultSchema;
+ this.userOverrideDefaultSchema = schema;
+ JptJpaCorePlugin.setUserOverrideDefaultSchema(this.project, schema);
+ this.firePropertyChanged(USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+
+ // ********** discover annotated classes **********
+
+ public boolean discoversAnnotatedClasses() {
+ return this.discoversAnnotatedClasses;
+ }
+
+ public void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses) {
+ boolean old = this.discoversAnnotatedClasses;
+ this.discoversAnnotatedClasses = discoversAnnotatedClasses;
+ JptJpaCorePlugin.setDiscoverAnnotatedClasses(this.project, discoversAnnotatedClasses);
+ this.firePropertyChanged(DISCOVERS_ANNOTATED_CLASSES_PROPERTY, old, discoversAnnotatedClasses);
+ }
+
+
+ // ********** JPA files **********
+
+ public Iterator<JpaFile> jpaFiles() {
+ return this.getJpaFiles().iterator();
+ }
+
+ protected Iterable<JpaFile> getJpaFiles() {
+ return new LiveCloneIterable<JpaFile>(this.jpaFiles); // read-only
+ }
+
+ public int jpaFilesSize() {
+ return this.jpaFiles.size();
+ }
+
+ protected Iterable<JpaFile> getJpaFiles(final IContentType contentType) {
+ return new FilteringIterable<JpaFile>(this.getJpaFiles()) {
+ @Override
+ protected boolean accept(JpaFile jpaFile) {
+ return jpaFile.getContentType().isKindOf(contentType);
+ }
+ };
+ }
+
+ @Override
+ public JpaFile getJpaFile(IFile file) {
+ for (JpaFile jpaFile : this.getJpaFiles()) {
+ if (jpaFile.getFile().equals(file)) {
+ return jpaFile;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Add a JPA file for the specified file, if appropriate.
+ * Return true if a JPA File was created and added, false otherwise
+ */
+ protected boolean addJpaFile(IFile file) {
+ JpaFile jpaFile = this.addJpaFile_(file);
+ if (jpaFile != null) {
+ this.fireItemAdded(JPA_FILES_COLLECTION, jpaFile);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 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 JpaFile addJpaFile_(IFile file) {
+ if (this.fileIsJavaRelated(file)) {
+ if ( ! this.getJavaProject().isOnClasspath(file)) {
+ return null; // java-related files must be on the Java classpath
+ }
+ }
+ else if ( ! this.fileResourceLocationIsValid(file)) {
+ return null;
+ }
+
+ JpaFile jpaFile = this.buildJpaFile(file);
+ if (jpaFile == null) {
+ return null;
+ }
+ jpaFile.getResourceModel().addResourceModelListener(this.resourceModelListener);
+ this.jpaFiles.add(jpaFile);
+ return jpaFile;
+ }
+
+ /**
+ * <code>.java</code> or <code>.jar</code>
+ */
+ protected boolean fileIsJavaRelated(IFile file) {
+ IContentType contentType = PlatformTools.getContentType(file);
+ return (contentType != null) && this.contentTypeIsJavaRelated(contentType);
+ }
+
+ /**
+ * pre-condition: content type is not <code>null</code>
+ */
+ protected boolean contentTypeIsJavaRelated(IContentType contentType) {
+ return contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE) ||
+ contentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE);
+ }
+
+ protected boolean fileResourceLocationIsValid(IFile file) {
+ ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(this.getProject());
+ return resourceLocator.acceptResourceLocation(this.getProject(), file.getParent());
+ }
+
+ /**
+ * Log any developer exceptions and don't build a JPA file rather
+ * than completely failing to build the JPA Project.
+ */
+ protected JpaFile buildJpaFile(IFile file) {
+ try {
+ return this.getJpaPlatform().buildJpaFile(this, file);
+ } catch (Exception ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ /**
+ * Remove the JPA file corresponding to the specified IFile, if it exists.
+ * Return true if a JPA File was removed, false otherwise
+ */
+ protected boolean removeJpaFile(IFile file) {
+ JpaFile jpaFile = this.getJpaFile(file);
+ if (jpaFile != null) { // a JpaFile is not added for every IFile
+ this.removeJpaFile(jpaFile);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Stop listening to the JPA file and remove it.
+ */
+ protected void removeJpaFile(JpaFile jpaFile) {
+ jpaFile.getResourceModel().removeResourceModelListener(this.resourceModelListener);
+ if ( ! this.removeItemFromCollection(jpaFile, this.jpaFiles, JPA_FILES_COLLECTION)) {
+ throw new IllegalArgumentException(jpaFile.toString());
+ }
+ }
+
+
+ // ********** external Java resource persistent types (source or binary) **********
+
+ protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(String typeName) {
+ IType jdtType = this.findType(typeName);
+ return (jdtType == null) ? null : this.buildPersistableExternalJavaResourcePersistentType(jdtType);
+ }
+
+ protected IType findType(String typeName) {
+ try {
+ return this.getJavaProject().findType(typeName);
+ } catch (JavaModelException ex) {
+ return null; // ignore exception?
+ }
+ }
+
+ protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(IType jdtType) {
+ JavaResourcePersistentType jrpt = this.buildExternalJavaResourcePersistentType(jdtType);
+ return ((jrpt != null) && jrpt.isPersistable()) ? jrpt : null;
+ }
+
+ protected JavaResourcePersistentType buildExternalJavaResourcePersistentType(IType jdtType) {
+ return jdtType.isBinary() ?
+ this.buildBinaryExternalJavaResourcePersistentType(jdtType) :
+ this.buildSourceExternalJavaResourcePersistentType(jdtType);
+ }
+
+ protected JavaResourcePersistentType buildBinaryExternalJavaResourcePersistentType(IType jdtType) {
+ return this.externalJavaResourcePersistentTypeCache.addPersistentType(jdtType);
+ }
+
+ protected JavaResourcePersistentType buildSourceExternalJavaResourcePersistentType(IType jdtType) {
+ JavaResourceCompilationUnit jrcu = this.getExternalJavaResourceCompilationUnit(jdtType.getCompilationUnit());
+ String jdtTypeName = jdtType.getFullyQualifiedName('.'); // JDT member type names use '$'
+ for (Iterator<JavaResourcePersistentType> stream = jrcu.persistentTypes(); stream.hasNext(); ) {
+ JavaResourcePersistentType jrpt = stream.next();
+ if (jrpt.getQualifiedName().equals(jdtTypeName)) {
+ return jrpt;
+ }
+ }
+ // we can get here if the project JRE is removed;
+ // see SourceCompilationUnit#getPrimaryType(CompilationUnit)
+ // bug 225332
+ return null;
+ }
+
+
+ // ********** external Java resource persistent types (binary) **********
+
+ public JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache() {
+ return this.externalJavaResourcePersistentTypeCache;
+ }
+
+
+ // ********** external Java resource compilation units (source) **********
+
+ public Iterator<JavaResourceCompilationUnit> externalJavaResourceCompilationUnits() {
+ return this.getExternalJavaResourceCompilationUnits().iterator();
+ }
+
+ protected Iterable<JavaResourceCompilationUnit> getExternalJavaResourceCompilationUnits() {
+ return new LiveCloneIterable<JavaResourceCompilationUnit>(this.externalJavaResourceCompilationUnits); // read-only
+ }
+
+ public int externalJavaResourceCompilationUnitsSize() {
+ return this.externalJavaResourceCompilationUnits.size();
+ }
+
+ /**
+ * Return the resource model compilation unit corresponding to the specified
+ * JDT compilation unit. If it does not exist, build it.
+ */
+ protected JavaResourceCompilationUnit getExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
+ for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
+ if (jrcu.getCompilationUnit().equals(jdtCompilationUnit)) {
+ // we will get here if the JRCU could not build its persistent type...
+ return jrcu;
+ }
+ }
+ return this.addExternalJavaResourceCompilationUnit(jdtCompilationUnit);
+ }
+
+ /**
+ * Add an external Java resource compilation unit.
+ */
+ protected JavaResourceCompilationUnit addExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
+ JavaResourceCompilationUnit jrcu = this.buildJavaResourceCompilationUnit(jdtCompilationUnit);
+ this.addItemToCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION);
+ jrcu.addResourceModelListener(this.resourceModelListener);
+ return jrcu;
+ }
+
+ protected JavaResourceCompilationUnit buildJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
+ return new SourceTypeCompilationUnit(
+ jdtCompilationUnit,
+ this.jpaPlatform.getAnnotationProvider(),
+ this.jpaPlatform.getAnnotationEditFormatter(),
+ this.modifySharedDocumentCommandExecutor
+ );
+ }
+
+ protected boolean removeExternalJavaResourceCompilationUnit(IFile file) {
+ for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
+ if (jrcu.getFile().equals(file)) {
+ this.removeExternalJavaResourceCompilationUnit(jrcu);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void removeExternalJavaResourceCompilationUnit(JavaResourceCompilationUnit jrcu) {
+ jrcu.removeResourceModelListener(this.resourceModelListener);
+ this.removeItemFromCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION);
+ }
+
+
+ // ********** context model **********
+
+ public JpaRootContextNode getRootContextNode() {
+ return this.rootContextNode;
+ }
+
+
+ // ********** utility **********
+
+ public IFile getPlatformFile(IPath runtimePath) {
+ return JptCommonCorePlugin.getPlatformFile(this.project, runtimePath);
+ }
+
+
+ // ********** XML files **********
+
+ public JpaXmlResource getPersistenceXmlResource() {
+ return (JpaXmlResource) this.getResourceModel(
+ JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH,
+ JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE
+ );
+ }
+
+ public JpaXmlResource getDefaultOrmXmlResource() {
+ return this.getMappingFileXmlResource(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ }
+
+ public JpaXmlResource getMappingFileXmlResource(IPath runtimePath) {
+ return (JpaXmlResource) this.getResourceModel(runtimePath, JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ }
+
+ /**
+ * If the specified file exists, is significant to the JPA project, and its
+ * content is a "kind of" the specified content type, return the JPA
+ * resource model corresponding to the file; otherwise, return null.
+ */
+ protected JptResourceModel getResourceModel(IPath runtimePath, IContentType contentType) {
+ IFile file = this.getPlatformFile(runtimePath);
+ return (file != null && file.exists()) ? this.getResourceModel(file, contentType) : null;
+ }
+
+ /**
+ * If the specified file is significant to the JPA project and its content
+ * is a "kind of" the specified content type, return the JPA resource model
+ * corresponding to the file; otherwise, return null.
+ */
+ protected JptResourceModel getResourceModel(IFile file, IContentType contentType) {
+ JpaFile jpaFile = this.getJpaFile(file);
+ return (jpaFile == null) ? null : jpaFile.getResourceModel(contentType);
+ }
+
+
+ // ********** annotated Java source classes **********
+
+ public Iterator<String> annotatedJavaSourceClassNames() {
+ return this.getAnnotatedJavaSourceClassNames().iterator();
+ }
+
+ protected Iterable<String> getAnnotatedJavaSourceClassNames() {
+ return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
+ @Override
+ protected String transform(JavaResourcePersistentType jrpType) {
+ return jrpType.getQualifiedName();
+ }
+ };
+ }
+
+ /**
+ * Return only those valid annotated Java resource persistent types that are
+ * directly part of the JPA project, ignoring those in JARs referenced in
+ * <code>persistence.xml</code>.
+ * @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter)
+ */
+ protected Iterable<JavaResourcePersistentType> getInternalAnnotatedSourceJavaResourcePersistentTypes() {
+ return new FilteringIterable<JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) {
+ @Override
+ protected boolean accept(JavaResourcePersistentType jrpType) {
+ return jrpType.isPersistable() && jrpType.isAnnotated(); // i.e. the type is valid and has a valid type annotation
+ }
+ };
+ }
+
+ /**
+ * Return only the names of those valid <em>mapped</em> (i.e. annotated with
+ * <code>@Entity</code>, <code>@Embeddable</code>, etc.) Java resource
+ * persistent types that are directly part of the JPA project, ignoring
+ * those in JARs referenced in <code>persistence.xml</code>.
+ */
+ public Iterable<String> getMappedJavaSourceClassNames() {
+ return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalMappedSourceJavaResourcePersistentTypes()) {
+ @Override
+ protected String transform(JavaResourcePersistentType jrpType) {
+ return jrpType.getQualifiedName();
+ }
+ };
+ }
+
+ /**
+ * Return only those valid <em>mapped</em> (i.e. annotated with
+ * <code>@Entity</code>, <code>@Embeddable</code>, etc.) Java resource
+ * persistent types that are directly part of the JPA project, ignoring
+ * those in JARs referenced in <code>persistence.xml</code>.
+ */
+ protected Iterable<JavaResourcePersistentType> getInternalMappedSourceJavaResourcePersistentTypes() {
+ return new FilteringIterable<JavaResourcePersistentType>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
+ @Override
+ protected boolean accept(JavaResourcePersistentType jrpType) {
+ return jrpType.isMapped(); // i.e. the type is already persistable and annotated
+ }
+ };
+ }
+
+ /**
+ * Return only those Java resource persistent types that are directly
+ * part of the JPA project, ignoring those in JARs referenced in
+ * <code>persistence.xml</code>
+ */
+ protected Iterable<JavaResourcePersistentType2_0> getInternalSourceJavaResourcePersistentTypes2_0() {
+ return new SubIterableWrapper<JavaResourcePersistentType, JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes());
+ }
+
+ /**
+ * Return only those Java resource persistent types that are directly
+ * part of the JPA project, ignoring those in JARs referenced in
+ * <code>persistence.xml</code>
+ */
+ protected Iterable<JavaResourcePersistentType> getInternalSourceJavaResourcePersistentTypes() {
+ return new CompositeIterable<JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypeLists());
+ }
+
+ /**
+ * Return only those Java resource persistent types that are directly
+ * part of the JPA project, ignoring those in JARs referenced in
+ * <code>persistence.xml</code>
+ */
+ protected Iterable<Iterable<JavaResourcePersistentType>> getInternalSourceJavaResourcePersistentTypeLists() {
+ return new TransformationIterable<JavaResourceCompilationUnit, Iterable<JavaResourcePersistentType>>(this.getInternalJavaResourceCompilationUnits()) {
+ @Override
+ protected Iterable<JavaResourcePersistentType> transform(final JavaResourceCompilationUnit compilationUnit) {
+ return new Iterable<JavaResourcePersistentType>() {
+ public Iterator<JavaResourcePersistentType> iterator() {
+ return compilationUnit.persistentTypes(); // *all* the types in the compilation unit
+ }
+ };
+ }
+ };
+ }
+
+ /**
+ * Return the JPA project's resource compilation units.
+ */
+ protected Iterable<JavaResourceCompilationUnit> getInternalJavaResourceCompilationUnits() {
+ return new TransformationIterable<JpaFile, JavaResourceCompilationUnit>(this.getJavaSourceJpaFiles()) {
+ @Override
+ protected JavaResourceCompilationUnit transform(JpaFile jpaFile) {
+ return (JavaResourceCompilationUnit) jpaFile.getResourceModel();
+ }
+ };
+ }
+
+ /**
+ * Return the JPA project's JPA files with Java source <em>content</em>.
+ */
+ protected Iterable<JpaFile> getJavaSourceJpaFiles() {
+ return this.getJpaFiles(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ }
+
+
+ // ********** Java resource persistent type look-up **********
+
+ public JavaResourcePersistentType getJavaResourcePersistentType(String typeName) {
+ for (JavaResourcePersistentType jrpType : this.getPersistableJavaResourcePersistentTypes()) {
+ if (jrpType.getQualifiedName().equals(typeName)) {
+ return jrpType;
+ }
+ }
+ // if we don't have a type already, try to build new one from the project classpath
+ return this.buildPersistableExternalJavaResourcePersistentType(typeName);
+ }
+
+ /**
+ * return *all* the "persistable" Java resource persistent types, including those in JARs referenced in
+ * persistence.xml
+ * @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter)
+ */
+ protected Iterable<JavaResourcePersistentType> getPersistableJavaResourcePersistentTypes() {
+ return new FilteringIterable<JavaResourcePersistentType>(this.getJavaResourcePersistentTypes()) {
+ @Override
+ protected boolean accept(JavaResourcePersistentType jrpType) {
+ return jrpType.isPersistable();
+ }
+ };
+ }
+
+ /**
+ * return *all* the Java resource persistent types, including those in JARs referenced in
+ * persistence.xml
+ */
+ protected Iterable<JavaResourcePersistentType> getJavaResourcePersistentTypes() {
+ return new CompositeIterable<JavaResourcePersistentType>(this.getJavaResourcePersistentTypeSets());
+ }
+
+ /**
+ * return *all* the Java resource persistent types, including those in JARs referenced in
+ * persistence.xml
+ */
+ protected Iterable<Iterable<JavaResourcePersistentType>> getJavaResourcePersistentTypeSets() {
+ return new TransformationIterable<JavaResourceNode.Root, Iterable<JavaResourcePersistentType>>(this.getJavaResourceNodeRoots()) {
+ @Override
+ protected Iterable<JavaResourcePersistentType> transform(final JavaResourceNode.Root root) {
+ return new Iterable<JavaResourcePersistentType>() {
+ public Iterator<JavaResourcePersistentType> iterator() {
+ return root.persistentTypes(); // *all* the types held by the root
+ }
+ };
+ }
+ };
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<JavaResourceNode.Root> getJavaResourceNodeRoots() {
+ return new CompositeIterable<JavaResourceNode.Root>(
+ this.getInternalJavaResourceCompilationUnits(),
+ this.getInternalJavaResourcePackageFragmentRoots(),
+ this.getExternalJavaResourceCompilationUnits(),
+ Collections.singleton(this.externalJavaResourcePersistentTypeCache)
+ );
+ }
+
+
+ // ********** Java resource persistent package look-up **********
+
+ public JavaResourcePackage getJavaResourcePackage(String packageName) {
+ for (JavaResourcePackage jrp : this.getJavaResourcePackages()) {
+ if (jrp.getName().equals(packageName)) {
+ return jrp;
+ }
+ }
+ return null;
+ }
+
+ public Iterable<JavaResourcePackage> getJavaResourcePackages(){
+ return new FilteringIterable<JavaResourcePackage>(
+ new TransformationIterable<JpaFile, JavaResourcePackage>(this.getPackageInfoSourceJpaFiles()) {
+ @Override
+ protected JavaResourcePackage transform(JpaFile jpaFile) {
+ return ((JavaResourcePackageInfoCompilationUnit) jpaFile.getResourceModel()).getPackage();
+ }
+ })
+ {
+ @Override
+ protected boolean accept(JavaResourcePackage packageInfo) {
+ return packageInfo != null;
+ }
+ };
+ }
+
+ /**
+ * return JPA files with package-info source "content"
+ */
+ protected Iterable<JpaFile> getPackageInfoSourceJpaFiles() {
+ return this.getJpaFiles(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE);
+ }
+
+
+ // ********** JARs **********
+
+ // TODO
+ public JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(String jarFileName) {
+// return this.getJarResourcePackageFragmentRoot(this.convertToPlatformFile(jarFileName));
+ return this.getJavaResourcePackageFragmentRoot(this.getProject().getFile(jarFileName));
+ }
+
+ protected JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(IFile jarFile) {
+ for (JavaResourcePackageFragmentRoot pfr : this.getInternalJavaResourcePackageFragmentRoots()) {
+ if (pfr.getFile().equals(jarFile)) {
+ return pfr;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<JavaResourcePackageFragmentRoot> getInternalJavaResourcePackageFragmentRoots() {
+ return new TransformationIterable<JpaFile, JavaResourcePackageFragmentRoot>(this.getJarJpaFiles()) {
+ @Override
+ protected JavaResourcePackageFragmentRoot transform(JpaFile jpaFile) {
+ return (JavaResourcePackageFragmentRoot) jpaFile.getResourceModel();
+ }
+ };
+ }
+
+ /**
+ * return JPA files with JAR "content"
+ */
+ public Iterable<JpaFile> getJarJpaFiles() {
+ return this.getJpaFiles(JptCommonCorePlugin.JAR_CONTENT_TYPE);
+ }
+
+
+ // ********** metamodel **********
+
+ public Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTopLevelTypes() {
+ if (this.metamodelSourceFolderName == null) {
+ return EmptyIterable.instance();
+ }
+ final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot();
+ return new FilteringIterable<JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes2_0()) {
+ @Override
+ protected boolean accept(JavaResourcePersistentType2_0 jrpt) {
+ return jrpt.isGeneratedMetamodelTopLevelType(genSourceFolder);
+ }
+ };
+ }
+
+ public JavaResourcePersistentType2_0 getGeneratedMetamodelTopLevelType(IFile file) {
+ JavaResourceCompilationUnit jrcu = this.getJavaResourceCompilationUnit(file);
+ if (jrcu == null) {
+ return null; // hmmm...
+ }
+ // TODO add API to JRCU to get top-level persistent type
+ Iterator<JavaResourcePersistentType> types = jrcu.persistentTypes();
+ if ( ! types.hasNext()) {
+ return null; // no types in the file
+ }
+ JavaResourcePersistentType2_0 jrpt = (JavaResourcePersistentType2_0) types.next();
+ return jrpt.isGeneratedMetamodelTopLevelType() ? jrpt : null;
+ }
+
+ protected JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file) {
+ return (JavaResourceCompilationUnit) this.getResourceModel(file, JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ }
+
+ public String getMetamodelSourceFolderName() {
+ return this.metamodelSourceFolderName;
+ }
+
+ public void setMetamodelSourceFolderName(String folderName) {
+ if (this.setMetamodelSourceFolderName_(folderName)) {
+ JptJpaCorePlugin.setMetamodelSourceFolderName(this.project, folderName);
+ if (folderName == null) {
+ this.disposeMetamodel();
+ } else {
+ this.initializeMetamodel();
+ }
+ }
+ }
+
+ protected boolean setMetamodelSourceFolderName_(String folderName) {
+ String old = this.metamodelSourceFolderName;
+ this.metamodelSourceFolderName = folderName;
+ return this.firePropertyChanged(METAMODEL_SOURCE_FOLDER_NAME_PROPERTY, old, folderName);
+ }
+
+ public void initializeMetamodel() {
+ if (this.isJpa2_0Compatible()) {
+ ((JpaRootContextNode2_0) this.rootContextNode).initializeMetamodel();
+ }
+ }
+
+ /**
+ * Synchronize the metamodel for 2.0-compatible JPA projects.
+ */
+ public void synchronizeMetamodel() {
+ if (this.isJpa2_0Compatible()) {
+ if (this.metamodelSourceFolderName != null) {
+ ((JpaRootContextNode2_0) this.rootContextNode).synchronizeMetamodel();
+ }
+ }
+ }
+
+ public void disposeMetamodel() {
+ if (this.isJpa2_0Compatible()) {
+ ((JpaRootContextNode2_0) this.rootContextNode).disposeMetamodel();
+ }
+ }
+
+ public IPackageFragmentRoot getMetamodelPackageFragmentRoot() {
+ return this.getJavaProject().getPackageFragmentRoot(this.getMetaModelSourceFolder());
+ }
+
+ protected IFolder getMetaModelSourceFolder() {
+ return this.getProject().getFolder(this.metamodelSourceFolderName);
+ }
+
+ /**
+ * If the metamodel source folder is no longer a Java project source
+ * folder, clear it out.
+ */
+ protected void checkMetamodelSourceFolderName() {
+ if (this.metamodelSoureFolderNameIsInvalid()) {
+ this.setMetamodelSourceFolderName(null);
+ }
+ }
+
+ protected boolean metamodelSoureFolderNameIsInvalid() {
+ return ! this.metamodelSourceFolderNameIsValid();
+ }
+
+ protected boolean metamodelSourceFolderNameIsValid() {
+ return CollectionTools.contains(this.getJavaSourceFolderNames(), this.metamodelSourceFolderName);
+ }
+
+
+ // ********** Java source folder names **********
+
+ public Iterable<String> getJavaSourceFolderNames() {
+ try {
+ return this.getJavaSourceFolderNames_();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return EmptyIterable.instance();
+ }
+ }
+
+ protected Iterable<String> getJavaSourceFolderNames_() throws JavaModelException {
+ return new TransformationIterable<IPackageFragmentRoot, String>(this.getJavaSourceFolders()) {
+ @Override
+ protected String transform(IPackageFragmentRoot pfr) {
+ try {
+ return this.transform_(pfr);
+ } catch (JavaModelException ex) {
+ return "Error: " + pfr.getPath(); //$NON-NLS-1$
+ }
+ }
+ private String transform_(IPackageFragmentRoot pfr) throws JavaModelException {
+ return pfr.getUnderlyingResource().getProjectRelativePath().toString();
+ }
+ };
+ }
+
+ protected Iterable<IPackageFragmentRoot> getJavaSourceFolders() throws JavaModelException {
+ return new FilteringIterable<IPackageFragmentRoot>(
+ this.getPackageFragmentRoots(),
+ SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER
+ );
+ }
+
+ protected static final Filter<IPackageFragmentRoot> SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER =
+ new Filter<IPackageFragmentRoot>() {
+ public boolean accept(IPackageFragmentRoot pfr) {
+ try {
+ return this.accept_(pfr);
+ } catch (JavaModelException ex) {
+ return false;
+ }
+ }
+ private boolean accept_(IPackageFragmentRoot pfr) throws JavaModelException {
+ return pfr.exists() && (pfr.getKind() == IPackageFragmentRoot.K_SOURCE);
+ }
+ };
+
+ protected Iterable<IPackageFragmentRoot> getPackageFragmentRoots() throws JavaModelException {
+ return new ArrayIterable<IPackageFragmentRoot>(this.getJavaProject().getPackageFragmentRoots());
+ }
+
+
+ // ********** Java events **********
+
+ // TODO handle changes to external projects
+ public void javaElementChanged(ElementChangedEvent event) {
+ this.processJavaDelta(event.getDelta());
+ }
+
+ /**
+ * We recurse back here from {@link #processJavaDeltaChildren(IJavaElementDelta)}.
+ */
+ protected void processJavaDelta(IJavaElementDelta delta) {
+ switch (delta.getElement().getElementType()) {
+ case IJavaElement.JAVA_MODEL :
+ this.processJavaModelDelta(delta);
+ break;
+ case IJavaElement.JAVA_PROJECT :
+ this.processJavaProjectDelta(delta);
+ break;
+ case IJavaElement.PACKAGE_FRAGMENT_ROOT :
+ this.processJavaPackageFragmentRootDelta(delta);
+ break;
+ case IJavaElement.PACKAGE_FRAGMENT :
+ this.processJavaPackageFragmentDelta(delta);
+ break;
+ case IJavaElement.COMPILATION_UNIT :
+ this.processJavaCompilationUnitDelta(delta);
+ break;
+ default :
+ break; // ignore the elements inside a compilation unit
+ }
+ }
+
+ protected void processJavaDeltaChildren(IJavaElementDelta delta) {
+ for (IJavaElementDelta child : delta.getAffectedChildren()) {
+ this.processJavaDelta(child); // recurse
+ }
+ }
+
+ /**
+ * Return whether the specified Java element delta is for a
+ * {@link IJavaElementDelta#CHANGED CHANGED}
+ * (as opposed to {@link IJavaElementDelta#ADDED ADDED} or
+ * {@link IJavaElementDelta#REMOVED REMOVED}) Java element
+ * and the specified flag is set.
+ * (The delta flags are only significant if the delta
+ * {@link IJavaElementDelta#getKind() kind} is
+ * {@link IJavaElementDelta#CHANGED CHANGED}.)
+ */
+ protected boolean deltaFlagIsSet(IJavaElementDelta delta, int flag) {
+ return (delta.getKind() == IJavaElementDelta.CHANGED) &&
+ BitTools.flagIsSet(delta.getFlags(), flag);
+ }
+
+ // ***** model
+ protected void processJavaModelDelta(IJavaElementDelta delta) {
+ // process the Java model's projects
+ this.processJavaDeltaChildren(delta);
+ }
+
+ // ***** project
+ protected void processJavaProjectDelta(IJavaElementDelta delta) {
+ // process the Java project's package fragment roots
+ this.processJavaDeltaChildren(delta);
+
+ // a classpath change can have pretty far-reaching effects...
+ if (this.classpathHasChanged(delta)) {
+ this.rebuild((IJavaProject) delta.getElement());
+ }
+ }
+
+ /**
+ * The specified Java project's classpath changed. Rebuild the JPA project
+ * as appropriate.
+ */
+ protected void rebuild(IJavaProject javaProject) {
+ // if the classpath has changed, we need to update everything since
+ // class references could now be resolved (or not) etc.
+ if (javaProject.equals(this.getJavaProject())) {
+ this.removeDeadJpaFiles();
+ this.checkMetamodelSourceFolderName();
+ this.synchronizeWithJavaSource(this.getInternalJavaResourceCompilationUnits());
+ } else {
+ // TODO see if changed project is on our classpath?
+ this.synchronizeWithJavaSource(this.getExternalJavaResourceCompilationUnits());
+ }
+ }
+
+ /**
+ * Loop through all our JPA files, remove any that are no longer on the
+ * classpath.
+ */
+ protected void removeDeadJpaFiles() {
+ for (JpaFile jpaFile : this.getJpaFiles()) {
+ if (this.jpaFileIsDead(jpaFile)) {
+ this.removeJpaFile(jpaFile);
+ }
+ }
+ }
+
+ protected boolean jpaFileIsDead(JpaFile jpaFile) {
+ return ! this.jpaFileIsAlive(jpaFile);
+ }
+
+ /**
+ * Sometimes (e.g. during tests), when a project has been deleted, we get a
+ * Java change event that indicates the Java project is CHANGED (as
+ * opposed to REMOVED, which is what typically happens). The event's delta
+ * indicates that everything in the Java project has been deleted and the
+ * classpath has changed. All entries in the classpath have been removed;
+ * but single entry for the Java project's root folder has been added. (!)
+ * This means any file in the project is on the Java project's classpath.
+ * This classpath change is what triggers us to rebuild the JPA project; so
+ * we put an extra check here to make sure the JPA file's resource file is
+ * still present.
+ * <p>
+ * This would not be a problem if Dali received the resource change event
+ * <em>before</em> JDT and simply removed the JPA project; but JDT receives
+ * the resource change event first and converts it into the problematic
+ * Java change event....
+ */
+ protected boolean jpaFileIsAlive(JpaFile jpaFile) {
+ IFile file = jpaFile.getFile();
+ return this.getJavaProject().isOnClasspath(file) &&
+ file.exists();
+ }
+
+ /**
+ * pre-condition:
+ * delta.getElement().getElementType() == IJavaElement.JAVA_PROJECT
+ */
+ protected boolean classpathHasChanged(IJavaElementDelta delta) {
+ return this.deltaFlagIsSet(delta, IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED);
+ }
+
+ protected void synchronizeWithJavaSource(Iterable<JavaResourceCompilationUnit> javaResourceCompilationUnits) {
+ for (JavaResourceCompilationUnit javaResourceCompilationUnit : javaResourceCompilationUnits) {
+ javaResourceCompilationUnit.synchronizeWithJavaSource();
+ }
+ }
+
+ // ***** package fragment root
+ protected void processJavaPackageFragmentRootDelta(IJavaElementDelta delta) {
+ // process the Java package fragment root's package fragments
+ this.processJavaDeltaChildren(delta);
+
+ if (this.classpathEntryHasBeenAdded(delta)) {
+ // TODO bug 277218
+ } else if (this.classpathEntryHasBeenRemoved(delta)) { // should be mutually-exclusive w/added (?)
+ // TODO bug 277218
+ }
+ }
+
+ /**
+ * pre-condition:
+ * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT
+ */
+ protected boolean classpathEntryHasBeenAdded(IJavaElementDelta delta) {
+ return this.deltaFlagIsSet(delta, IJavaElementDelta.F_ADDED_TO_CLASSPATH);
+ }
+
+ /**
+ * pre-condition:
+ * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT
+ */
+ protected boolean classpathEntryHasBeenRemoved(IJavaElementDelta delta) {
+ return this.deltaFlagIsSet(delta, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH);
+ }
+
+ // ***** package fragment
+ protected void processJavaPackageFragmentDelta(IJavaElementDelta delta) {
+ // process the java package fragment's compilation units
+ this.processJavaDeltaChildren(delta);
+ }
+
+ // ***** compilation unit
+ protected void processJavaCompilationUnitDelta(IJavaElementDelta delta) {
+ if (this.javaCompilationUnitDeltaIsRelevant(delta)) {
+ ICompilationUnit compilationUnit = (ICompilationUnit) delta.getElement();
+ for (JavaResourceCompilationUnit jrcu : this.getCombinedJavaResourceCompilationUnits()) {
+ if (jrcu.getCompilationUnit().equals(compilationUnit)) {
+ jrcu.synchronizeWithJavaSource();
+ // TODO ? this.resolveJavaTypes(); // might have new member types now...
+ break; // there *shouldn't* be any more...
+ }
+ }
+ }
+ // ignore the java compilation unit's children
+ }
+
+ protected boolean javaCompilationUnitDeltaIsRelevant(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 false;
+ }
+
+ // ignore java notification for ADDED or REMOVED;
+ // these are handled via resource notification
+ return delta.getKind() == IJavaElementDelta.CHANGED;
+ }
+
+
+ // ********** validation **********
+
+ public Iterator<IMessage> validationMessages(IReporter reporter) {
+ List<IMessage> messages = new ArrayList<IMessage>();
+ this.validate(messages, reporter);
+ return messages.iterator();
+ }
+
+ protected void validate(List<IMessage> messages, IReporter reporter) {
+ if (reporter.isCancelled()) {
+ throw new ValidationCancelledException();
+ }
+ this.validateLibraryProvider(messages);
+ this.validateConnection(messages);
+ this.rootContextNode.validate(messages, reporter);
+ }
+
+ protected void validateLibraryProvider(List<IMessage> messages) {
+ try {
+ this.validateLibraryProvider_(messages);
+ } catch (CoreException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ protected void validateLibraryProvider_(List<IMessage> messages) throws CoreException {
+ ILibraryProvider libraryProvider = LibraryProviderFramework.getCurrentProvider(getProject(), JpaFacet.FACET);
+ IFacetedProject facetedProject = ProjectFacetsManager.create(getProject());
+ IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(JpaFacet.FACET);
+ if ( ! libraryProvider.isEnabledFor(facetedProject, facetVersion)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PROJECT_INVALID_LIBRARY_PROVIDER,
+ this
+ )
+ );
+ }
+ }
+
+ protected void validateConnection(List<IMessage> messages) {
+ String cpName = this.dataSource.getConnectionProfileName();
+ if (StringTools.stringIsEmpty(cpName)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.PROJECT_NO_CONNECTION,
+ this
+ )
+ );
+ return;
+ }
+ ConnectionProfile cp = this.dataSource.getConnectionProfile();
+ if (cp == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.PROJECT_INVALID_CONNECTION,
+ new String[] {cpName},
+ this
+ )
+ );
+ return;
+ }
+ if (cp.isInactive()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.PROJECT_INACTIVE_CONNECTION,
+ new String[] {cpName},
+ this
+ )
+ );
+ }
+ }
+
+
+ // ********** dispose **********
+
+ public void dispose() {
+ this.contextModelSynchronizer.stop();
+ this.updateSynchronizer.stop();
+ this.updateSynchronizer.removeListener(this.updateSynchronizerListener);
+ this.dataSource.dispose();
+ // the XML resources are held indefinitely by the WTP translator framework,
+ // so we better remove our listener or the JPA project will not be GCed
+ for (JpaFile jpaFile : this.getJpaFiles()) {
+ jpaFile.getResourceModel().removeResourceModelListener(this.resourceModelListener);
+ }
+ }
+
+
+ // ********** resource model listener **********
+
+ protected JptResourceModelListener buildResourceModelListener() {
+ return new DefaultResourceModelListener();
+ }
+
+ protected class DefaultResourceModelListener
+ implements JptResourceModelListener
+ {
+ protected DefaultResourceModelListener() {
+ super();
+ }
+
+ public void resourceModelChanged(JptResourceModel jpaResourceModel) {
+// String msg = Thread.currentThread() + " resource model change: " + jpaResourceModel;
+// System.out.println(msg);
+// new Exception(msg).printStackTrace(System.out);
+ AbstractJpaProject.this.synchronizeContextModel(jpaResourceModel);
+ }
+
+ public void resourceModelReverted(JptResourceModel jpaResourceModel) {
+ IFile file = WorkbenchResourceHelper.getFile((JpaXmlResource)jpaResourceModel);
+ AbstractJpaProject.this.removeJpaFile(file);
+ AbstractJpaProject.this.addJpaFile(file);
+ }
+
+ public void resourceModelUnloaded(JptResourceModel jpaResourceModel) {
+ IFile file = WorkbenchResourceHelper.getFile((JpaXmlResource)jpaResourceModel);
+ AbstractJpaProject.this.removeJpaFile(file);
+ }
+ }
+
+ protected void synchronizeContextModel(@SuppressWarnings("unused") JptResourceModel jpaResourceModel) {
+ this.synchronizeContextModel();
+ }
+
+
+ // ********** resource events **********
+
+ // TODO need to do the same thing for external projects and compilation units
+ public void projectChanged(IResourceDelta delta) {
+ if (delta.getResource().equals(this.getProject())) {
+ this.internalProjectChanged(delta);
+ } else {
+ this.externalProjectChanged(delta);
+ }
+ }
+
+ protected void internalProjectChanged(IResourceDelta delta) {
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ this.setContextModelSynchronizer(Synchronizer.Null.instance());
+ this.setUpdateSynchronizer(CallbackSynchronizer.Null.instance());
+ }
+ ResourceDeltaVisitor resourceDeltaVisitor = this.buildInternalResourceDeltaVisitor();
+ resourceDeltaVisitor.visitDelta(delta);
+ // at this point, if we have added and/or removed JpaFiles, an "update" will have been triggered;
+ // any changes to the resource model during the "resolve" will trigger further "updates";
+ // there should be no need to "resolve" external Java types (they can't have references to
+ // the internal Java types)
+ if (resourceDeltaVisitor.encounteredSignificantChange()) {
+ this.resolveInternalJavaTypes();
+ }
+ }
+
+ protected ResourceDeltaVisitor buildInternalResourceDeltaVisitor() {
+ return new InternalResourceDeltaVisitor();
+ }
+
+ protected class InternalResourceDeltaVisitor extends ResourceDeltaVisitor {
+ protected InternalResourceDeltaVisitor() {
+ super();
+ }
+ @Override
+ public boolean fileChangeIsSignificant(IFile file, int deltaKind) {
+ return AbstractJpaProject.this.synchronizeJpaFiles(file, deltaKind);
+ }
+ }
+
+ /**
+ * Internal resource delta visitor callback.
+ * Return true if a JpaFile was either added or removed.
+ */
+ protected boolean synchronizeJpaFiles(IFile file, int deltaKind) {
+ switch (deltaKind) {
+ case IResourceDelta.ADDED :
+ return this.addJpaFile(file);
+ case IResourceDelta.REMOVED :
+ return this.removeJpaFile(file);
+ case IResourceDelta.CHANGED :
+ return this.checkForChangedFileContent(file);
+ case IResourceDelta.ADDED_PHANTOM :
+ break; // ignore
+ case IResourceDelta.REMOVED_PHANTOM :
+ break; // ignore
+ default :
+ break; // only worried about added/removed/changed files
+ }
+
+ return false;
+ }
+
+ protected boolean checkForChangedFileContent(IFile file) {
+ JpaFile jpaFile = this.getJpaFile(file);
+ if (jpaFile == null) {
+ // the file might have changed its content to something that we are interested in
+ return this.addJpaFile(file);
+ }
+
+ if (jpaFile.getContentType().equals(PlatformTools.getContentType(file))) {
+ // content has not changed - ignore
+ return false;
+ }
+
+ // the content type changed, we need to build a new JPA file
+ // (e.g. the schema of an orm.xml file changed from JPA to EclipseLink)
+ this.removeJpaFile(jpaFile);
+ this.addJpaFile(file);
+ return true; // at the least, we have removed a JPA file
+ }
+
+ protected void resolveInternalJavaTypes() {
+ for (JavaResourceCompilationUnit jrcu : this.getInternalJavaResourceCompilationUnits()) {
+ jrcu.resolveTypes();
+ }
+ }
+
+ protected void externalProjectChanged(IResourceDelta delta) {
+ if (this.getJavaProject().isOnClasspath(delta.getResource())) {
+ ResourceDeltaVisitor resourceDeltaVisitor = this.buildExternalResourceDeltaVisitor();
+ resourceDeltaVisitor.visitDelta(delta);
+ // force an "update" here since adding and/or removing an external Java type
+ // will only trigger an "update" if the "resolve" causes something in the resource model to change
+ if (resourceDeltaVisitor.encounteredSignificantChange()) {
+ this.update();
+ this.resolveExternalJavaTypes();
+ this.resolveInternalJavaTypes();
+ }
+ }
+ }
+
+ protected ResourceDeltaVisitor buildExternalResourceDeltaVisitor() {
+ return new ExternalResourceDeltaVisitor();
+ }
+
+ protected class ExternalResourceDeltaVisitor extends ResourceDeltaVisitor {
+ protected ExternalResourceDeltaVisitor() {
+ super();
+ }
+ @Override
+ public boolean fileChangeIsSignificant(IFile file, int deltaKind) {
+ return AbstractJpaProject.this.synchronizeExternalFiles(file, deltaKind);
+ }
+ }
+
+ /**
+ * external resource delta visitor callback
+ * Return true if an "external" Java resource compilation unit
+ * was added or removed.
+ */
+ protected boolean synchronizeExternalFiles(IFile file, int deltaKind) {
+ switch (deltaKind) {
+ case IResourceDelta.ADDED :
+ return this.externalFileAdded(file);
+ case IResourceDelta.REMOVED :
+ return this.externalFileRemoved(file);
+ case IResourceDelta.CHANGED :
+ break; // ignore
+ case IResourceDelta.ADDED_PHANTOM :
+ break; // ignore
+ case IResourceDelta.REMOVED_PHANTOM :
+ break; // ignore
+ default :
+ break; // only worried about added/removed/changed files
+ }
+
+ return false;
+ }
+
+ protected boolean externalFileAdded(IFile file) {
+ IContentType contentType = PlatformTools.getContentType(file);
+ if (contentType == null) {
+ return false;
+ }
+ if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ return true;
+ }
+ if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean externalFileRemoved(IFile file) {
+ IContentType contentType = PlatformTools.getContentType(file);
+ if (contentType == null) {
+ return false;
+ }
+ if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ return this.removeExternalJavaResourceCompilationUnit(file);
+ }
+ if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
+ return this.externalJavaResourcePersistentTypeCache.removePersistentTypes(file);
+ }
+ return false;
+ }
+
+ protected void resolveExternalJavaTypes() {
+ for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
+ jrcu.resolveTypes();
+ }
+ }
+
+ // ***** resource delta visitors
+ /**
+ * add or remove a JPA file for every [appropriate] file encountered by the visitor
+ */
+ protected abstract class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+ protected boolean encounteredSignificantChange = false;
+
+ protected ResourceDeltaVisitor() {
+ super();
+ }
+
+ protected void visitDelta(IResourceDelta delta) {
+ try {
+ delta.accept(this);
+ } catch (CoreException ex) {
+ // shouldn't happen - we don't throw any CoreExceptions
+ throw new RuntimeException(ex);
+ }
+ }
+
+ public boolean visit(IResourceDelta delta) {
+ IResource res = delta.getResource();
+ switch (res.getType()) {
+ case IResource.ROOT :
+ return true; // visit children
+ case IResource.PROJECT :
+ return true; // visit children
+ case IResource.FOLDER :
+ return true; // visit children
+ case IResource.FILE :
+ this.fileChanged((IFile) res, delta.getKind());
+ return false; // no children
+ default :
+ return false; // no children (probably shouldn't get here...)
+ }
+ }
+
+ protected void fileChanged(IFile file, int deltaKind) {
+ if (this.fileChangeIsSignificant(file, deltaKind)) {
+ this.encounteredSignificantChange = true;
+ }
+ }
+
+ protected abstract boolean fileChangeIsSignificant(IFile file, int deltaKind);
+
+ /**
+ * Return whether the visitor encountered some sort of "significant"
+ * change while traversing the IResourceDelta
+ * (e.g. a JPA file was added or removed).
+ */
+ protected boolean encounteredSignificantChange() {
+ return this.encounteredSignificantChange;
+ }
+
+ }
+
+
+ // ********** support for modifying documents shared with the UI **********
+
+ public void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor) {
+ this.modifySharedDocumentCommandExecutor.set(commandExecutor);
+ }
+
+ public CommandExecutor getModifySharedDocumentCommandExecutor() {
+ return this.modifySharedDocumentCommandExecutor;
+ }
+
+ protected ThreadLocalCommandExecutor buildModifySharedDocumentCommandExecutor() {
+ return new ThreadLocalCommandExecutor();
+ }
+
+
+ // ********** synchronize context model with resource model **********
+
+ public Synchronizer getContextModelSynchronizer() {
+ return this.contextModelSynchronizer;
+ }
+
+ public void setContextModelSynchronizer(Synchronizer synchronizer) {
+ if (synchronizer == null) {
+ throw new NullPointerException();
+ }
+ this.contextModelSynchronizer.stop();
+ this.setContextModelSynchronizer_(synchronizer);
+ }
+
+ protected void setContextModelSynchronizer_(Synchronizer synchronizer) {
+ this.contextModelSynchronizer = synchronizer;
+ this.contextModelSynchronizer.start();
+ }
+
+ /**
+ * Delegate to the context model synchronizer so clients can configure how
+ * synchronizations occur.
+ */
+ public void synchronizeContextModel() {
+ this.synchronizingContextModel = true;
+ this.contextModelSynchronizer.synchronize();
+ this.synchronizingContextModel = false;
+
+ // There are some changes to the resource model that will not change
+ // the existing context model and trigger an update (e.g. adding an
+ // @Entity annotation when the JPA project is automatically
+ // discovering annotated classes); so we explicitly execute an update
+ // here to discover those changes.
+ this.update();
+ }
+
+ /**
+ * Called by the context model synchronizer.
+ */
+ public IStatus synchronizeContextModel(IProgressMonitor monitor) {
+ this.rootContextNode.synchronizeWithResourceModel();
+ return Status.OK_STATUS;
+ }
+
+ public void synchronizeContextModelAndWait() {
+ Synchronizer temp = this.contextModelSynchronizer;
+ this.setContextModelSynchronizer(this.buildSynchronousContextModelSynchronizer());
+ this.synchronizeContextModel();
+ this.setContextModelSynchronizer(temp);
+ }
+
+
+ // ********** default context model synchronizer (synchronous) **********
+
+ protected Synchronizer buildSynchronousContextModelSynchronizer() {
+ return new SynchronousSynchronizer(this.buildSynchronousContextModelSynchronizerCommand());
+ }
+
+ protected Command buildSynchronousContextModelSynchronizerCommand() {
+ return new SynchronousContextModelSynchronizerCommand();
+ }
+
+ protected class SynchronousContextModelSynchronizerCommand
+ implements Command
+ {
+ public void execute() {
+ AbstractJpaProject.this.synchronizeContextModel(new NullProgressMonitor());
+ }
+ }
+
+
+ // ********** project "update" **********
+
+ public CallbackSynchronizer getUpdateSynchronizer() {
+ return this.updateSynchronizer;
+ }
+
+ public void setUpdateSynchronizer(CallbackSynchronizer synchronizer) {
+ if (synchronizer == null) {
+ throw new NullPointerException();
+ }
+ this.updateSynchronizer.stop();
+ this.updateSynchronizer.removeListener(this.updateSynchronizerListener);
+ this.setUpdateSynchronizer_(synchronizer);
+ }
+
+ protected void setUpdateSynchronizer_(CallbackSynchronizer synchronizer) {
+ this.updateSynchronizer = synchronizer;
+ this.updateSynchronizer.addListener(this.updateSynchronizerListener);
+ this.updateSynchronizer.start();
+ }
+
+ @Override
+ public void stateChanged() {
+ super.stateChanged();
+ this.update();
+ }
+
+ /**
+ * The JPA project's state has changed, "update" those parts of the
+ * JPA project that are dependent on other parts of the JPA project.
+ * <p>
+ * Delegate to the update synchronizer so clients can configure how
+ * updates occur.
+ * <p>
+ * Ignore any <em>updates</em> that occur while we are synchronizing
+ * the context model with the resource model because we will <em>update</em>
+ * the context model at the completion of the <em>sync</em>. This is really
+ * only useful for synchronous <em>syncs</em> and <em>updates</em>; since
+ * the job scheduling rules will prevent the <em>sync</em> and
+ * <em>update</em> jobs from running concurrently.
+ *
+ * @see #updateAndWait()
+ */
+ protected void update() {
+ if ( ! this.synchronizingContextModel) {
+ this.updateSynchronizer.synchronize();
+ }
+ }
+
+ /**
+ * Called by the update synchronizer.
+ */
+ public IStatus update(IProgressMonitor monitor) {
+ this.rootContextNode.update();
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * This is the callback used by the update synchronizer to notify the JPA
+ * project that the "update" has quiesced (i.e. the "update" has completed
+ * and there are no outstanding requests for further "updates").
+ */
+ public void updateQuiesced() {
+ this.synchronizeMetamodel();
+ }
+
+ public void updateAndWait() {
+ CallbackSynchronizer temp = this.updateSynchronizer;
+ this.setUpdateSynchronizer(this.buildSynchronousUpdateSynchronizer());
+ this.update();
+ this.setUpdateSynchronizer(temp);
+ }
+
+
+ // ********** default update synchronizer (synchronous) **********
+
+ protected CallbackSynchronizer buildSynchronousUpdateSynchronizer() {
+ return new CallbackSynchronousSynchronizer(this.buildSynchronousUpdateSynchronizerCommand());
+ }
+
+ protected Command buildSynchronousUpdateSynchronizerCommand() {
+ return new SynchronousUpdateSynchronizerCommand();
+ }
+
+ protected class SynchronousUpdateSynchronizerCommand
+ implements Command
+ {
+ public void execute() {
+ AbstractJpaProject.this.update(new NullProgressMonitor());
+ }
+ }
+
+
+ // ********** update synchronizer listener **********
+
+ protected CallbackSynchronizer.Listener buildUpdateSynchronizerListener() {
+ return new UpdateSynchronizerListener();
+ }
+
+ protected class UpdateSynchronizerListener
+ implements CallbackSynchronizer.Listener
+ {
+ public void synchronizationQuiesced(CallbackSynchronizer synchronizer) {
+ AbstractJpaProject.this.updateQuiesced();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
new file mode 100644
index 0000000000..2e14d4d697
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder;
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.ForeignKey;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Singleton that delegates to the db object passed in.
+ */
+public final class GenericEntityGeneratorDatabaseAnnotationNameBuilder
+ implements EntityGeneratorDatabaseAnnotationNameBuilder
+{
+ public static final EntityGeneratorDatabaseAnnotationNameBuilder INSTANCE
+ = new GenericEntityGeneratorDatabaseAnnotationNameBuilder();
+
+ public static EntityGeneratorDatabaseAnnotationNameBuilder instance() {
+ return INSTANCE;
+ }
+
+ // ensure single instance
+ private GenericEntityGeneratorDatabaseAnnotationNameBuilder() {
+ super();
+ }
+
+ public String buildTableAnnotationName(String entityName, Table table) {
+ return table.getIdentifier(entityName);
+ }
+
+ public String buildColumnAnnotationName(String attributeName, Column column) {
+ return column.getIdentifier(attributeName);
+ }
+
+ public String buildJoinColumnAnnotationName(String attributeName, ForeignKey foreignKey) {
+ return foreignKey.getJoinColumnAnnotationIdentifier(attributeName);
+ }
+
+ public String buildJoinColumnAnnotationName(Column column) {
+ return column.getIdentifier();
+ }
+
+ public String buildJoinTableAnnotationName(Table table) {
+ return table.getIdentifier();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java
new file mode 100644
index 0000000000..f86051c5cf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.ArrayList;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverrideAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverridesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.BasicAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.ColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EntityAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EnumeratedAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.GeneratedValueAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.IdAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.IdClassAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.InheritanceAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnsAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.JoinTableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.LobAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToManyAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToOneAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.MapKeyAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueriesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueryAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.OneToManyAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.OneToOneAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.OrderByAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.SequenceGeneratorAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+
+public class GenericJpaAnnotationDefinitionProvider
+ extends AbstractJpaAnnotationDefinitionProvider
+{
+ // singleton
+ private static final JpaAnnotationDefinitionProvider INSTANCE = new GenericJpaAnnotationDefinitionProvider();
+
+ /**
+ * Return the singleton
+ */
+ public static JpaAnnotationDefinitionProvider instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private GenericJpaAnnotationDefinitionProvider() {
+ super();
+ }
+
+ @Override
+ protected void addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS);
+ }
+
+ protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
+ AssociationOverrideAnnotationDefinition.instance(),
+ AssociationOverridesAnnotationDefinition.instance(),
+ AttributeOverrideAnnotationDefinition.instance(),
+ AttributeOverridesAnnotationDefinition.instance(),
+ DiscriminatorColumnAnnotationDefinition.instance(),
+ DiscriminatorValueAnnotationDefinition.instance(),
+ EmbeddableAnnotationDefinition.instance(),
+ EntityAnnotationDefinition.instance(),
+ IdClassAnnotationDefinition.instance(),
+ InheritanceAnnotationDefinition.instance(),
+ MappedSuperclassAnnotationDefinition.instance(),
+ NamedQueryAnnotationDefinition.instance(),
+ NamedQueriesAnnotationDefinition.instance(),
+ NamedNativeQueryAnnotationDefinition.instance(),
+ NamedNativeQueriesAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
+ SecondaryTableAnnotationDefinition.instance(),
+ SecondaryTablesAnnotationDefinition.instance(),
+ SequenceGeneratorAnnotationDefinition.instance(),
+ TableAnnotationDefinition.instance(),
+ TableGeneratorAnnotationDefinition.instance()
+ };
+
+ @Override
+ protected void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, TYPE_MAPPING_ANNOTATION_DEFINITIONS);
+ }
+
+ protected static final AnnotationDefinition[] TYPE_MAPPING_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
+ EmbeddableAnnotationDefinition.instance(),
+ EntityAnnotationDefinition.instance(),
+ MappedSuperclassAnnotationDefinition.instance()
+ };
+
+ @Override
+ protected void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS);
+ }
+
+ protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
+ AssociationOverrideAnnotationDefinition.instance(),
+ AssociationOverridesAnnotationDefinition.instance(),
+ AttributeOverrideAnnotationDefinition.instance(),
+ AttributeOverridesAnnotationDefinition.instance(),
+ BasicAnnotationDefinition.instance(),
+ ColumnAnnotationDefinition.instance(),
+ EmbeddedAnnotationDefinition.instance(),
+ EmbeddedIdAnnotationDefinition.instance(),
+ EnumeratedAnnotationDefinition.instance(),
+ GeneratedValueAnnotationDefinition.instance(),
+ IdAnnotationDefinition.instance(),
+ JoinColumnAnnotationDefinition.instance(),
+ JoinColumnsAnnotationDefinition.instance(),
+ JoinTableAnnotationDefinition.instance(),
+ LobAnnotationDefinition.instance(),
+ ManyToManyAnnotationDefinition.instance(),
+ ManyToOneAnnotationDefinition.instance(),
+ MapKeyAnnotationDefinition.instance(),
+ OneToManyAnnotationDefinition.instance(),
+ OneToOneAnnotationDefinition.instance(),
+ OrderByAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
+ SequenceGeneratorAnnotationDefinition.instance(),
+ TableGeneratorAnnotationDefinition.instance(),
+ TemporalAnnotationDefinition.instance(),
+ TransientAnnotationDefinition.instance(),
+ VersionAnnotationDefinition.instance()
+ };
+
+ @Override
+ protected void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ // no package annotations
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java
new file mode 100644
index 0000000000..62a7cfe743
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Delegate to annotation definition providers.
+ * The platform factory will build an instance of this annotation provider,
+ * passing in the appropriate array of annotation definition providers necessary
+ * to build the annotations for the platform (vendor and/or version).
+ */
+public class GenericJpaAnnotationProvider
+ implements JpaAnnotationProvider
+{
+ private final Iterable<JpaAnnotationDefinitionProvider> annotationDefinitionProviders;
+
+
+ public GenericJpaAnnotationProvider(JpaAnnotationDefinitionProvider... annotationDefinitionProviders) {
+ super();
+ this.annotationDefinitionProviders = new ArrayIterable<JpaAnnotationDefinitionProvider>(annotationDefinitionProviders);
+ }
+
+
+ // ********** type annotations **********
+
+ public Iterator<String> typeAnnotationNames() {
+ return this.convertToNames(this.getTypeAnnotationDefinitions()).iterator();
+ }
+
+ protected Iterable<AnnotationDefinition> getTypeAnnotationDefinitions() {
+ return new CompositeIterable<AnnotationDefinition> (
+ new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
+ @Override
+ protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ return annotationDefinitionProvider.getTypeAnnotationDefinitions();
+ }
+ }
+ );
+ }
+
+ public Iterator<String> typeMappingAnnotationNames() {
+ return this.convertToNames(this.getTypeMappingAnnotationDefinitions()).iterator();
+ }
+
+ protected Iterable<AnnotationDefinition> getTypeMappingAnnotationDefinitions() {
+ return new CompositeIterable<AnnotationDefinition> (
+ new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
+ @Override
+ protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ return annotationDefinitionProvider.getTypeMappingAnnotationDefinitions();
+ }
+ }
+ );
+ }
+
+ public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, Type type, String annotationName) {
+ return this.getTypeAnnotationDefinition(annotationName).buildAnnotation(parent, type);
+ }
+
+ public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ return this.getTypeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
+ }
+
+ protected AnnotationDefinition getTypeAnnotationDefinition(String annotationName) {
+ AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getTypeAnnotationDefinitions(), annotationName);
+ if (annotationDefinition == null) {
+ throw new IllegalArgumentException("unsupported type annotation: " + annotationName); //$NON-NLS-1$
+ }
+ return annotationDefinition;
+ }
+
+ public Annotation buildNullTypeAnnotation(JavaResourcePersistentType parent, String annotationName) {
+ return this.getTypeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
+ }
+
+
+ // ********** attribute annotations **********
+
+ public Iterator<String> attributeAnnotationNames() {
+ return this.convertToNames(this.getAttributeAnnotationDefinitions()).iterator();
+ }
+
+ protected Iterable<AnnotationDefinition> getAttributeAnnotationDefinitions() {
+ return new CompositeIterable<AnnotationDefinition> (
+ new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
+ @Override
+ protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ return annotationDefinitionProvider.getAttributeAnnotationDefinitions();
+ }
+ }
+ );
+ }
+
+ public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) {
+ return this.getAttributeAnnotationDefinition(annotationName).buildAnnotation(parent, attribute);
+ }
+
+ public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ return this.getAttributeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
+ }
+
+ public Annotation buildNullAttributeAnnotation(JavaResourcePersistentAttribute parent, String annotationName) {
+ return this.getAttributeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
+ }
+
+ protected AnnotationDefinition getAttributeAnnotationDefinition(String annotationName) {
+ AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getAttributeAnnotationDefinitions(), annotationName);
+ if (annotationDefinition == null) {
+ throw new IllegalArgumentException("unsupported attribute annotation: " + annotationName); //$NON-NLS-1$
+ }
+ return annotationDefinition;
+ }
+
+
+ // ********** package annotations **********
+
+ public Iterator<String> packageAnnotationNames() {
+ return this.convertToNames(this.getPackageAnnotationDefinitions()).iterator();
+ }
+
+ protected Iterable<AnnotationDefinition> getPackageAnnotationDefinitions() {
+ return new CompositeIterable<AnnotationDefinition> (
+ new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
+ @Override
+ protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ return annotationDefinitionProvider.getPackageAnnotationDefinitions();
+ }
+ }
+ );
+ }
+
+ public Annotation buildPackageAnnotation(JavaResourcePackage parent, AnnotatedPackage pkg, String annotationName) {
+ return this.getPackageAnnotationDefinition(annotationName).buildAnnotation(parent, pkg);
+ }
+
+ public Annotation buildPackageAnnotation(JavaResourcePackage parent, IAnnotation jdtAnnotation) {
+ return this.getPackageAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
+ }
+
+ public Annotation buildNullPackageAnnotation(JavaResourcePackage parent, String annotationName) {
+ return this.getPackageAnnotationDefinition(annotationName).buildNullAnnotation(parent);
+ }
+
+ protected AnnotationDefinition getPackageAnnotationDefinition(String annotationName) {
+ AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getPackageAnnotationDefinitions(), annotationName);
+ if (annotationDefinition == null) {
+ throw new IllegalArgumentException("unsupported package annotation: " + annotationName); //$NON-NLS-1$
+ }
+ return annotationDefinition;
+ }
+
+
+ // ********** convenience methods **********
+
+ protected Iterable<String> convertToNames(Iterable<AnnotationDefinition> annotationDefinitions) {
+ return new TransformationIterable<AnnotationDefinition, String>(annotationDefinitions) {
+ @Override
+ protected String transform(AnnotationDefinition annotationDefinition) {
+ return annotationDefinition.getAnnotationName();
+ }
+ };
+ }
+
+ protected AnnotationDefinition selectAnnotationDefinition(Iterable<AnnotationDefinition> annotationDefinitions, String annotationName) {
+ for (AnnotationDefinition annotationDefinition : annotationDefinitions) {
+ if (annotationDefinition.getAnnotationName().equals(annotationName)) {
+ return annotationDefinition;
+ }
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
new file mode 100644
index 0000000000..c8e5bf9efd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.DefaultAnnotationEditFormatter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
+import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
+import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
+
+/**
+ * All the state in the JPA platform should be "static" (i.e. unchanging once
+ * it is initialized).
+ */
+public class GenericJpaPlatform
+ implements JpaPlatform
+{
+ private final String id;
+
+ private final Version jpaVersion;
+
+ private final JpaFactory jpaFactory;
+
+ private final JpaAnnotationProvider annotationProvider;
+
+ private final JpaPlatformProvider platformProvider;
+
+ private final JpaPlatformVariation jpaVariation;
+
+
+ public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, JpaAnnotationProvider jpaAnnotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) {
+ super();
+ this.id = id;
+ this.jpaVersion = jpaVersion;
+ this.jpaFactory = jpaFactory;
+ this.annotationProvider = jpaAnnotationProvider;
+ this.jpaVariation = jpaVariation;
+ this.platformProvider = platformProvider;
+ }
+
+
+ // ********** meta stuff **********
+
+ public String getId() {
+ return this.id;
+ }
+
+ public JpaPlatformDescription getDescription() {
+ return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(this.getId());
+ }
+
+ public Version getJpaVersion() {
+ return this.jpaVersion;
+ }
+
+
+ // ********** factory **********
+
+ public JpaFactory getJpaFactory() {
+ return this.jpaFactory;
+ }
+
+
+ // ********** platform providers **********
+
+ protected JpaPlatformProvider getPlatformProvider() {
+ return this.platformProvider;
+ }
+
+
+ // ********** JPA file/resource models **********
+
+ public JpaFile buildJpaFile(JpaProject jpaProject, IFile file) {
+ IContentType contentType = PlatformTools.getContentType(file);
+ return (contentType == null) ? null : this.buildJpaFile(jpaProject, file, contentType);
+ }
+
+ protected JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType) {
+ JptResourceModel resourceModel = this.buildResourceModel(jpaProject, file, contentType);
+ return (resourceModel == null) ? null : this.jpaFactory.buildJpaFile(jpaProject, file, contentType, resourceModel);
+ }
+
+ protected JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file, IContentType contentType) {
+ JpaResourceModelProvider provider = this.getResourceModelProvider(contentType);
+ return (provider == null) ? null : provider.buildResourceModel(jpaProject, file);
+ }
+
+ /**
+ * Return null if we don't have a provider for the specified content type
+ * (since we don't have control over the possible content types).
+ */
+ protected JpaResourceModelProvider getResourceModelProvider(IContentType contentType) {
+ for (JpaResourceModelProvider provider : this.platformProvider.getResourceModelProviders()) {
+ if (contentType.equals(provider.getContentType())) {
+ return provider;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** Java annotations **********
+
+ public JpaAnnotationProvider getAnnotationProvider() {
+ return this.annotationProvider;
+ }
+
+ public AnnotationEditFormatter getAnnotationEditFormatter() {
+ return DefaultAnnotationEditFormatter.instance();
+ }
+
+
+ // ********** Java type mappings **********
+
+ public Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions() {
+ return this.platformProvider.getJavaTypeMappingDefinitions();
+ }
+
+
+ // ********** Java attribute mappings **********
+
+ public Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions() {
+ return this.platformProvider.getSpecifiedJavaAttributeMappingDefinitions();
+ }
+
+ public Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions() {
+ return this.platformProvider.getDefaultJavaAttributeMappingDefinitions();
+ }
+
+
+ // ********** resource types and definitions **********
+
+ public boolean supportsResourceType(JptResourceType resourceType) {
+ for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) {
+ if (resourceDefinition.getResourceType().equals(resourceType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public ResourceDefinition getResourceDefinition(JptResourceType resourceType) {
+ for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) {
+ if (resourceDefinition.getResourceType().equals(resourceType)) {
+ return resourceDefinition;
+ }
+ }
+ throw new IllegalArgumentException("Illegal resource type: " + resourceType); //$NON-NLS-1$
+ }
+
+ public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
+ return this.platformProvider.getMostRecentSupportedResourceType(contentType);
+ }
+
+
+ // ********** database **********
+
+ public ConnectionProfileFactory getConnectionProfileFactory() {
+ return JptJpaDbPlugin.getConnectionProfileFactory();
+ }
+
+ public EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder() {
+ return GenericEntityGeneratorDatabaseAnnotationNameBuilder.instance();
+ }
+
+
+ // ********** validation **********
+
+ public JpaPlatformVariation getJpaVariation() {
+ return this.jpaVariation;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
new file mode 100644
index 0000000000..be8f3e7f80
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.Comparator;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
+import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFactory;
+import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
+
+/**
+ * All the state in the JPA platform should be "static" (i.e. unchanging once
+ * it is initialized).
+ */
+public class GenericJpaPlatformFactory
+ implements JpaPlatformFactory
+{
+ /**
+ * zero-argument constructor
+ */
+ public GenericJpaPlatformFactory() {
+ super();
+ }
+
+ public JpaPlatform buildJpaPlatform(String id) {
+ return new GenericJpaPlatform(
+ id,
+ this.buildJpaVersion(),
+ new GenericJpaFactory(),
+ new GenericJpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
+ GenericJpaPlatformProvider.instance(),
+ this.buildJpaPlatformVariation());
+ }
+
+
+ private JpaPlatform.Version buildJpaVersion() {
+ return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString());
+ }
+
+ protected JpaPlatformVariation buildJpaPlatformVariation() {
+ return new JpaPlatformVariation() {
+ public Supported getTablePerConcreteClassInheritanceIsSupported() {
+ return Supported.MAYBE;
+ }
+ public boolean isJoinTableOverridable() {
+ return false;
+ }
+ };
+ }
+
+
+ public static class SimpleVersion implements JpaPlatform.Version {
+ protected final String jpaVersion;
+
+ public static final Comparator<String> JPA_VERSION_COMPARATOR = new DefaultVersionComparator();
+
+ public SimpleVersion(String jpaVersion) {
+ super();
+ this.jpaVersion = jpaVersion;
+ }
+
+ /**
+ * The generic platform's version is the same as the JPA version.
+ */
+ public String getVersion() {
+ return this.getJpaVersion();
+ }
+
+ public String getJpaVersion() {
+ return this.jpaVersion;
+ }
+
+ /**
+ * For now, generic platforms are backward-compatible.
+ */
+ public boolean isCompatibleWithJpaVersion(String version) {
+ return JPA_VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0;
+ }
+
+ @Override
+ public String toString() {
+ return "JPA version: " + this.getJpaVersion(); //$NON-NLS-1$
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java
new file mode 100644
index 0000000000..7b5ef341a0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
+
+/**
+ * All the state in the JPA platform should be "static" (i.e. unchanging once
+ * it is initialized).
+ */
+public class GenericJpaPlatformProvider
+ extends AbstractJpaPlatformProvider
+{
+ // singleton
+ private static final JpaPlatformProvider INSTANCE = new GenericJpaPlatformProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaPlatformProvider instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private GenericJpaPlatformProvider() {
+ super();
+ }
+
+
+ // ********** resource models **********
+
+ public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
+ if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
+ return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
+ return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
+ return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
+ }
+ else {
+ throw new IllegalArgumentException(contentType.toString());
+ }
+ }
+
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
+ }
+
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance()
+ };
+
+
+ // ********** Java type mappings **********
+
+ @Override
+ protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ JavaEntityDefinition.instance(),
+ JavaEmbeddableDefinition.instance(),
+ JavaMappedSuperclassDefinition.instance()
+ };
+
+
+ // ********** Java attribute mappings **********
+
+ @Override
+ protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ JavaEmbeddedMappingDefinition.instance(),
+ JavaBasicMappingDefinition.instance()
+ };
+
+ @Override
+ protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ JavaTransientMappingDefinition.instance(),
+ JavaIdMappingDefinition.instance(),
+ JavaVersionMappingDefinition.instance(),
+ JavaBasicMappingDefinition.instance(),
+ JavaEmbeddedMappingDefinition.instance(),
+ JavaEmbeddedIdMappingDefinition.instance(),
+ JavaManyToManyMappingDefinition.instance(),
+ JavaManyToOneMappingDefinition.instance(),
+ JavaOneToManyMappingDefinition.instance(),
+ JavaOneToOneMappingDefinition.instance()
+ };
+
+
+ // ********** resource definitions **********
+
+ @Override
+ protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
+ CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
+ }
+
+ protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ GenericPersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance()
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
new file mode 100644
index 0000000000..0299725cf2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPackageFragmentRoot;
+
+/**
+ * JAR files
+ */
+public class JarResourceModelProvider
+ implements JpaResourceModelProvider
+{
+ // singleton
+ private static final JpaResourceModelProvider INSTANCE = new JarResourceModelProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaResourceModelProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private JarResourceModelProvider() {
+ super();
+ }
+
+ public IContentType getContentType() {
+ return JptCommonCorePlugin.JAR_CONTENT_TYPE;
+ }
+
+ /**
+ * NB: Despite the check in GenericJpaProject.addJpaFile_(IFile),
+ * we can get here and
+ * the PFR will be null if the JAR is underneath a directory on the
+ * classpath but the JAR itself is not on the classpath.
+ * Returning null should be OK.
+ */
+ public JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file) {
+ IPackageFragmentRoot pfr = JavaCore.createJarPackageFragmentRootFrom(file);
+ return (pfr ==null) ? null : new BinaryPackageFragmentRoot(pfr, jpaProject.getJpaPlatform().getAnnotationProvider());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
new file mode 100644
index 0000000000..4cde45e05f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePackageInfoCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+
+/**
+ * Java package-info.java source code
+ */
+public class JavaPackageInfoResourceModelProvider
+ implements JpaResourceModelProvider
+{
+ // singleton
+ private static final JpaResourceModelProvider INSTANCE = new JavaPackageInfoResourceModelProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaResourceModelProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private JavaPackageInfoResourceModelProvider() {
+ super();
+ }
+
+ public IContentType getContentType() {
+ return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE;
+ }
+
+ public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) {
+ return new SourcePackageInfoCompilationUnit(
+ JavaCore.createCompilationUnitFrom(file),
+ jpaProject.getJpaPlatform().getAnnotationProvider(),
+ jpaProject.getJpaPlatform().getAnnotationEditFormatter(),
+ jpaProject.getModifySharedDocumentCommandExecutor()
+ );
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
new file mode 100644
index 0000000000..bd0623255c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+
+/**
+ * Java source code
+ */
+public class JavaResourceModelProvider
+ implements JpaResourceModelProvider
+{
+ // singleton
+ private static final JpaResourceModelProvider INSTANCE = new JavaResourceModelProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaResourceModelProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private JavaResourceModelProvider() {
+ super();
+ }
+
+ public IContentType getContentType() {
+ return JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
+ }
+
+ public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) {
+ return new SourceTypeCompilationUnit(
+ JavaCore.createCompilationUnitFrom(file),
+ jpaProject.getJpaPlatform().getAnnotationProvider(),
+ jpaProject.getJpaPlatform().getAnnotationEditFormatter(),
+ jpaProject.getModifySharedDocumentCommandExecutor()
+ );
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java
new file mode 100644
index 0000000000..985056b392
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Oracle. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+
+public class JpaPlatformTester extends PropertyTester {
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (! (property.equals("jpaPlatform") || property.equals("jpaPlatformGroup"))
+ || ! (expectedValue instanceof String)) { //$NON-NLS-1$
+ return false;
+ }
+
+ JpaPlatformDescription platform = null;
+
+ if (receiver instanceof IResource) {
+ platform = platform(((IResource) receiver).getProject());
+ }
+ else if (receiver instanceof IJavaElement) {
+ platform = platform(((IJavaElement) receiver).getResource().getProject());
+ }
+ else if (receiver instanceof JpaPlatformDescription) {
+ platform = (JpaPlatformDescription) receiver;
+ }
+ else if (receiver instanceof JpaLibraryProviderInstallOperationConfig) {
+ platform = ((JpaLibraryProviderInstallOperationConfig) receiver).getJpaPlatform();
+ }
+
+ if (property.equals("jpaPlatform")) {
+ JpaPlatformDescription otherPlatform = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform((String) expectedValue);
+ return platform == null ? false : platform.equals(otherPlatform);
+ }
+ if (property.equals("jpaPlatformGroup")) {
+ JpaPlatformGroupDescription group = (platform == null) ? null : platform.getGroup();
+ JpaPlatformGroupDescription otherGroup = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatformGroup((String) expectedValue);
+ return group == null ? false : group.equals(otherGroup);
+ }
+ return false;
+ }
+
+ private JpaPlatformDescription platform(IProject project) {
+ return (project == null)
+ ? null
+ : JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(JptJpaCorePlugin.getJpaPlatformId(project));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java
new file mode 100644
index 0000000000..fd62b02ccf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * Copyright (c) 2008 BEA Systems, Inc 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:
+ * Konstantin Komissarchik - initial implementation and ongoing maintenance
+ * Oracle - copied and modified from org.eclipse.wst.common.project.facet.core.internal.FacetedProjectPropertyTester
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+
+public class JpaTester extends PropertyTester {
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (!property.equals("projectFacet")) { //$NON-NLS-1$
+ return false;
+ }
+ if (receiver instanceof IJavaElement) {
+ IProject project = ((IJavaElement) receiver).getResource().getProject();
+ if (project != null) {
+
+ String val = (String) expectedValue;
+ int colon = val.indexOf( ':' );
+ String facetID;
+ String facetVer;
+ if( colon == -1 || colon == val.length() - 1 ) {
+ facetID = val;
+ facetVer = null;
+ } else {
+ facetID = val.substring( 0, colon );
+ facetVer = val.substring( colon + 1 );
+ }
+ try {
+ return FacetedProjectFramework.hasProjectFacet( project, facetID, facetVer );
+ } catch (CoreException e) {
+ JptJpaCorePlugin.log(e.getStatus());
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java
new file mode 100644
index 0000000000..0783d9cf16
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Localized messages used by Dali core.
+ */
+public class JptCoreMessages {
+
+ public static String NONE;
+ public static String VALIDATE_JOB;
+ public static String VALIDATE_PROJECT_NOT_JPA;
+ public static String VALIDATE_PROJECT_IMPROPER_PLATFORM;
+ public static String VALIDATE_CONTAINER_QUESTIONABLE;
+ public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED;
+ public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION;
+ public static String VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED;
+ public static String VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT;
+ public static String VALIDATE_PLATFORM_NOT_SPECIFIED;
+ public static String VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION;
+ public static String VALIDATE_LIBRARY_PROVIDER_INVALID;
+ public static String VALIDATE_CONNECTION_NOT_SPECIFIED;
+ public static String VALIDATE_CONNECTION_INVALID;
+ public static String VALIDATE_CONNECTION_NOT_CONNECTED;
+ public static String VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED;
+ public static String VALIDATE_CONNECTION_DOESNT_CONTAIN_CATALOG;
+ public static String VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED;
+ public static String VALIDATE_CONNECTION_DOESNT_CONTAIN_SCHEMA;
+ public static String VALIDATE_RUNTIME_NOT_SPECIFIED;
+ public static String VALIDATE_RUNTIME_DOES_NOT_SUPPORT_EJB_30;
+ public static String VALIDATE_LIBRARY_NOT_SPECIFIED;
+ public static String SYNCHRONIZE_CLASSES_JOB;
+ public static String SYNCHRONIZING_CLASSES_TASK;
+ public static String INVALID_PERSISTENCE_XML_CONTENT;
+ public static String ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE;
+ public static String ERROR_WRITING_FILE;
+ public static String REGISTRY_MISSING_ATTRIBUTE;
+ public static String REGISTRY_INVALID_VALUE;
+ public static String REGISTRY_DUPLICATE;
+ public static String REGISTRY_FAILED_CLASS_LOAD;
+ public static String REGISTRY_FAILED_INTERFACE_ASSIGNMENT;
+ public static String REGISTRY_FAILED_INSTANTIATION;
+ public static String CONTEXT_MODEL_SYNC_JOB_NAME;
+ public static String UPDATE_JOB_NAME;
+ public static String PLATFORM_ID_DOES_NOT_EXIST;
+ public static String PREFERENCES_FLUSH_JOB_NAME;
+ public static String USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND;
+ public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND;
+ public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION;
+
+ private static final String BUNDLE_NAME = "jpa_core"; //$NON-NLS-1$
+ private static final Class<?> BUNDLE_CLASS = JptCoreMessages.class;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
+ }
+
+ private JptCoreMessages() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java
new file mode 100644
index 0000000000..124e5ce332
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * orm.xml
+ */
+public class OrmResourceModelProvider
+ implements JpaResourceModelProvider
+{
+ // singleton
+ private static final JpaResourceModelProvider INSTANCE = new OrmResourceModelProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaResourceModelProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private OrmResourceModelProvider() {
+ super();
+ }
+
+ public IContentType getContentType() {
+ return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE;
+ }
+
+ public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
+ return OrmXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java
new file mode 100644
index 0000000000..047e497f21
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * persistence.xml
+ */
+public class PersistenceResourceModelProvider
+ implements JpaResourceModelProvider
+{
+ // singleton
+ private static final JpaResourceModelProvider INSTANCE = new PersistenceResourceModelProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaResourceModelProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private PersistenceResourceModelProvider() {
+ super();
+ }
+
+ public IContentType getContentType() {
+ return JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE;
+ }
+
+ public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
+ return PersistenceXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java
new file mode 100644
index 0000000000..1e1d2cdba8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+
+/**
+ * [Double-duty] factory to build adapters for either standard projects or
+ * Java projects:
+ * - JPA project
+ *
+ * See org.eclipse.jpt.jpa.core plugin.xml.
+ */
+public class ProjectAdapterFactory
+ implements IAdapterFactory
+{
+ private static final Class<?>[] ADAPTER_LIST = new Class[] { JpaProject.class };
+
+ public Class<?>[] getAdapterList() {
+ return ADAPTER_LIST;
+ }
+
+ public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
+ if (adaptableObject instanceof IProject) {
+ return this.getAdapter((IProject) adaptableObject, adapterType);
+ }
+ if (adaptableObject instanceof IJavaProject) {
+ return this.getAdapter((IJavaProject) adaptableObject, adapterType);
+ }
+ return null;
+ }
+
+ private Object getAdapter(IProject project, Class <?>adapterType) {
+ if (adapterType == JpaProject.class) {
+ return this.getJpaProject(project);
+ }
+ return null;
+ }
+
+ private Object getAdapter(IJavaProject javaProject, Class <?>adapterType) {
+ if (adapterType == JpaProject.class) {
+ return this.getJpaProject(javaProject.getProject());
+ }
+ return null;
+ }
+
+ private JpaProject getJpaProject(IProject project) {
+ return JptJpaCorePlugin.getJpaProject(project);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java
new file mode 100644
index 0000000000..67535d5bb3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+
+/**
+ * Straightforward implementation of the JPA project config.
+ */
+public class SimpleJpaProjectConfig implements JpaProject2_0.Config {
+ protected IProject project;
+ protected JpaPlatform jpaPlatform;
+ protected String connectionProfileName;
+ protected String userOverrideDefaultCatalog;
+ protected String userOverrideDefaultSchema;
+ protected boolean discoverAnnotatedClasses;
+ protected String metamodelSourceFolderName;
+
+ public SimpleJpaProjectConfig() {
+ super();
+ }
+
+ public IProject getProject() {
+ return this.project;
+ }
+
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public JpaPlatform getJpaPlatform() {
+ return this.jpaPlatform;
+ }
+
+ public void setJpaPlatform(JpaPlatform jpaPlatform) {
+ this.jpaPlatform = jpaPlatform;
+ }
+
+ public String getConnectionProfileName() {
+ return this.connectionProfileName;
+ }
+
+ public void setConnectionProfileName(String connectionProfileName) {
+ this.connectionProfileName = connectionProfileName;
+ }
+
+ public String getUserOverrideDefaultSchema() {
+ return this.userOverrideDefaultSchema;
+ }
+
+ public void setUserOverrideDefaultSchema(String userOverrideDefaultSchema) {
+ this.userOverrideDefaultSchema = userOverrideDefaultSchema;
+ }
+
+ public String getUserOverrideDefaultCatalog() {
+ return this.userOverrideDefaultCatalog;
+ }
+
+ public void setUserOverrideDefaultCatalog(String userOverrideDefaultCatalog) {
+ this.userOverrideDefaultCatalog = userOverrideDefaultCatalog;
+ }
+
+ public boolean discoverAnnotatedClasses() {
+ return this.discoverAnnotatedClasses;
+ }
+
+ public void setDiscoverAnnotatedClasses(boolean discoverAnnotatedClasses) {
+ this.discoverAnnotatedClasses = discoverAnnotatedClasses;
+ }
+
+ public String getMetamodelSourceFolderName() {
+ return this.metamodelSourceFolderName;
+ }
+
+ public void setMetamodelSourceFolderName(String metamodelSourceFolderName) {
+ this.metamodelSourceFolderName = metamodelSourceFolderName;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.project.getName());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java
new file mode 100644
index 0000000000..22507e4026
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.jpa.core.JpaNode;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+public abstract class AbstractJpaContextNode
+ extends AbstractJpaNode
+ implements JpaContextNode
+{
+ protected AbstractJpaContextNode(JpaNode parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ public void synchronizeWithResourceModel() {
+ // NOP
+ }
+
+ /**
+ * convenience method
+ */
+ protected void synchronizeNodesWithResourceModel(Iterable<? extends JpaContextNode> nodes) {
+ for (JpaContextNode node : nodes) {
+ node.synchronizeWithResourceModel();
+ }
+ }
+
+ public void update() {
+ // NOP
+ }
+
+ /**
+ * convenience method
+ */
+ protected void updateNodes(Iterable<? extends JpaContextNode> nodes) {
+ for (JpaContextNode node : nodes) {
+ node.update();
+ }
+ }
+
+
+ // ********** containment hierarchy **********
+
+ /**
+ * covariant override
+ */
+ @Override
+ public JpaContextNode getParent() {
+ return (JpaContextNode) super.getParent();
+ }
+
+ /**
+ * Overridden in:<ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode#getResourceType() AbstractJavaJpaContextNode}
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJarFile#getResourceType() GenericJarFile}
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml#getResourceType() GenericOrmXml}
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml#getResourceType() GenericPersistenceXml}
+ * </ul>
+ */
+ public JptResourceType getResourceType() {
+ return this.getParent().getResourceType();
+ }
+
+ /**
+ * Overridden in:<ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#getPersistenceUnit() AbstractPersistenceUnit}
+ * to return itself
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode#getPersistenceUnit() GenericRootContextNode}
+ * to return <code>null</code>
+ * </ul>
+ */
+ public PersistenceUnit getPersistenceUnit() {
+ return this.getParent().getPersistenceUnit();
+ }
+
+ /**
+ * Overridden in:<ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings#getMappingFileRoot() AbstractEntityMappings}
+ * to return itself
+ * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode#getMappingFileRoot() GenericRootContextNode}
+ * to return <code>null</code>
+ * </ul>
+ */
+ public MappingFileRoot getMappingFileRoot() {
+ return this.getParent().getMappingFileRoot();
+ }
+
+
+ // ********** database stuff **********
+
+ public Schema getContextDefaultDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getContextDefaultDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getContextDefaultSchema());
+ }
+
+ protected String getContextDefaultSchema() {
+ MappingFileRoot mfr = this.getMappingFileRoot();
+ return (mfr != null) ? mfr.getSchema() : this.getPersistenceUnit().getDefaultSchema();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getContextDefaultDbSchemaContainer() {
+ String catalog = this.getContextDefaultCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getContextDefaultDbCatalog() {
+ String catalog = this.getContextDefaultCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ protected String getContextDefaultCatalog() {
+ MappingFileRoot mfr = this.getMappingFileRoot();
+ return (mfr != null) ? mfr.getCatalog() : this.getPersistenceUnit().getDefaultCatalog();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java
new file mode 100644
index 0000000000..8149d527c6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractXmlContextNode
+ extends AbstractJpaContextNode
+ implements XmlContextNode
+{
+ protected AbstractXmlContextNode(JpaContextNode parent) {
+ super(parent);
+ }
+
+
+ // ********** validation **********
+
+ /**
+ * All subclass implementations should be have a "super" call to this method.
+ */
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ if (reporter.isCancelled()) {
+ throw new ValidationCancelledException();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java
new file mode 100644
index 0000000000..ea6a5dbdb9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+
+/**
+ * Gather some of the behavior common to the Java and XML models. :-(
+ */
+public final class AttributeMappingTools
+{
+
+ // ********** all mapping names transformer **********
+
+ public static final Transformer<AttributeMapping, Iterator<String>> ALL_MAPPING_NAMES_TRANSFORMER = new AllMappingNamesTransformer();
+ static class AllMappingNamesTransformer
+ implements Transformer<AttributeMapping, Iterator<String>>
+ {
+ public Iterator<String> transform(AttributeMapping mapping) {
+ return mapping.allMappingNames();
+ }
+ }
+
+
+ // ********** all overridable attribute mapping names transformer **********
+
+ public static final Transformer<AttributeMapping, Iterator<String>> ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER = new AllOverridableAttributeMappingNamesTransformer();
+ static class AllOverridableAttributeMappingNamesTransformer
+ implements Transformer<AttributeMapping, Iterator<String>>
+ {
+ public Iterator<String> transform(AttributeMapping mapping) {
+ return mapping.allOverridableAttributeMappingNames();
+ }
+ }
+
+
+ // ********** all overridable association mapping names transformer **********
+
+ public static final Transformer<AttributeMapping, Iterator<String>> ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER = new AllOverridableAssociationMappingNamesTransformer();
+ static class AllOverridableAssociationMappingNamesTransformer
+ implements Transformer<AttributeMapping, Iterator<String>>
+ {
+ public Iterator<String> transform(AttributeMapping mapping) {
+ return mapping.allOverridableAssociationMappingNames();
+ }
+ }
+
+
+ // ********** constructor **********
+
+ /**
+ * Suppress default constructor, ensuring non-instantiability.
+ */
+ private AttributeMappingTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java
new file mode 100644
index 0000000000..07cc664f27
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on named columns
+ */
+public interface BaseColumnTextRangeResolver extends NamedColumnTextRangeResolver
+{
+ TextRange getTableTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..8918e1ce48
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on join columns
+ */
+public interface BaseJoinColumnTextRangeResolver extends NamedColumnTextRangeResolver
+{
+ TextRange getReferencedColumnNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java
new file mode 100644
index 0000000000..f8c958501b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+
+/**
+ * Utility methods for manipulating context containers.
+ */
+public class ContextContainerTools {
+
+ /**
+ * Adapter used to synchronize a context container with its corresponding
+ * resource container.
+ *
+ * @param <C> the type of context elements
+ * @param <R> the type of resource elements
+ */
+ public interface Adapter<C extends JpaContextNode, R> {
+
+ /**
+ * Return the container's context elements.
+ */
+ Iterable<C> getContextElements();
+
+ /**
+ * Return the container's current set of resource elements.
+ * These are what the context elements will be synchronized to.
+ */
+ Iterable<R> getResourceElements();
+
+ /**
+ * Return the resource element corresponding to the specified context
+ * element.
+ */
+ R getResourceElement(C contextElement);
+
+ /**
+ * Move the specified context element to the specified index.
+ */
+ void moveContextElement(int index, C element);
+
+ /**
+ * Add a context element for the specified resource element at the
+ * specified index.
+ */
+ void addContextElement(int index, R resourceElement);
+
+ /**
+ * Remove the specified context element from the container.
+ */
+ void removeContextElement(C element);
+ }
+
+
+ /**
+ * Using the specified adapter, synchronize a context container with its
+ * corresponding resource container: moving, removing, and adding elements
+ * as necessary.
+ * <p>
+ * We can do this because:<ul>
+ * <li>the XML translators will <em>move</em> the EMF elements when
+ * appropriate (as opposed to simply rebuilding them in place).
+ * <li>the Java resource model will re-use existing annotations when
+ * appropriate (as opposed to simply rebuilding them in place).
+ * </ul>
+ */
+ public static <C extends JpaContextNode, R> void synchronizeWithResourceModel(Adapter<C, R> adapter) {
+ sync(adapter, true); // true = sync
+ }
+
+ /**
+ * @see #synchronizeWithResourceModel(Adapter)
+ */
+ public static <C extends JpaContextNode, R> void update(Adapter<C, R> adapter) {
+ sync(adapter, false); // false = update
+ }
+
+ /**
+ * The specified <code>sync</code> flag controls whether any surviving
+ * context nodes are either <em>synchronized</em> (<code>true</code>) or
+ * <em>updated</em> (<code>false</code>).
+ */
+ protected static <C extends JpaContextNode, R> void sync(Adapter<C, R> adapter, boolean sync) {
+ HashSet<C> contextElements = CollectionTools.set(adapter.getContextElements());
+ ArrayList<C> contextElementsToSync = new ArrayList<C>(contextElements.size());
+ int resourceIndex = 0;
+
+ for (R resourceElement : adapter.getResourceElements()) {
+ boolean match = false;
+ for (Iterator<C> stream = contextElements.iterator(); stream.hasNext(); ) {
+ C contextElement = stream.next();
+ if (Tools.valuesAreEqual(adapter.getResourceElement(contextElement), resourceElement)) {
+ // we don't know the source index because the element has been moved by previously moved elements
+ adapter.moveContextElement(resourceIndex, contextElement);
+ stream.remove();
+ // TODO perform update here someday...
+ contextElementsToSync.add(contextElement);
+ match = true;
+ break;
+ }
+ }
+ if ( ! match) {
+ // added elements are sync'ed during construction or will be
+ // updated during the next "update" (which is triggered by
+ // their addition to the model)
+ adapter.addContextElement(resourceIndex, resourceElement);
+ }
+ resourceIndex++;
+ }
+ // remove any leftover context elements
+ for (C contextElement : contextElements) {
+ adapter.removeContextElement(contextElement);
+ }
+ // TODO bjv
+ // take care of the structural changes before sync'ing the remaining elements;
+ // we might be able to do this inline once we get rid of the "list change" events
+ // and go with only add, remove, etc. list events
+ // (these syncs will trigger "list change" events with list aspect adapters, which
+ // trigger refreshes of UI adapters (e.g. TableModelAdapter) which will prematurely
+ // discover any structural changes... :( )
+ // see ItemAspectListValueModelAdapter.itemAspectChanged(EventObject)
+ for (C contextElement : contextElementsToSync) {
+ if (sync) {
+ contextElement.synchronizeWithResourceModel();
+ } else {
+ contextElement.update();
+ }
+ }
+ }
+
+ private ContextContainerTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java
new file mode 100644
index 0000000000..19b118f3b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+
+public interface EntityTextRangeResolver
+ extends PrimaryKeyTextRangeResolver
+{
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..5c7ac1ede2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+/**
+ * Interface to resolve text ranges on join columns
+ */
+public interface JoinColumnTextRangeResolver
+ extends BaseJoinColumnTextRangeResolver, BaseColumnTextRangeResolver
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java
new file mode 100644
index 0000000000..0bc515e2a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import java.util.List;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public interface JptValidator
+{
+ /**
+ * Return a boolean used to determine whether to continue validating
+ */
+ boolean validate(List<IMessage> messages, IReporter reporter);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
new file mode 100644
index 0000000000..1d55cc1e9e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
@@ -0,0 +1,432 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.ColumnMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
+import org.eclipse.jpt.jpa.core.context.ReferenceTable;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Gather some of the behavior common to the Java and XML models. :-(
+ */
+public final class MappingTools {
+
+ /**
+ * Default join table name from the JPA spec:<br>
+ * "The concatenated names of the two associated primary
+ * entity tables, separated by a underscore."
+ * <pre>
+ * [owning table name]_[target table name]
+ * </pre>
+ * <strong>NB:</strong> The <em>names</em> are concatenated,
+ * <em>not</em> the <em>identifiers</em>.
+ * E.g. the join table for <code>"Foo"</code> and <code>"baR"</code>
+ * (where the "delimited" identifier is required) is:
+ * <pre>
+ * "Foo_baR"
+ * </pre>
+ * not
+ * <pre>
+ * "Foo"_"baR"
+ * </pre>
+ * As a result, we cannot honestly calculate the default name without a
+ * database connection. We need the database to convert the resulting name
+ * to an identifier appropriate to the current database.
+ */
+ public static String buildJoinTableDefaultName(ReadOnlyRelationship relationship) {
+ if (relationship.getJpaProject().getDataSource().connectionProfileIsActive()) {
+ return buildDbJoinTableDefaultName(relationship);
+ }
+ // continue with a "best effort":
+ String owningTableName = relationship.getTypeMapping().getPrimaryTableName();
+ if (owningTableName == null) {
+ return null;
+ }
+ RelationshipMapping relationshipMapping = relationship.getMapping();
+ if (relationshipMapping == null) {
+ return null;
+ }
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ String targetTableName = targetEntity.getPrimaryTableName();
+ if (targetTableName == null) {
+ return null;
+ }
+ return owningTableName + '_' + targetTableName;
+ }
+
+ /**
+ * Use the database to build a more accurate default name.
+ */
+ private static String buildDbJoinTableDefaultName(ReadOnlyRelationship relationship) {
+ Table owningTable = relationship.getTypeMapping().getPrimaryDbTable();
+ if (owningTable == null) {
+ return null;
+ }
+ RelationshipMapping relationshipMapping = relationship.getMapping();
+ if (relationshipMapping == null) {
+ return null;
+ }
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ Table targetTable = targetEntity.getPrimaryDbTable();
+ if (targetTable == null) {
+ return null;
+ }
+ String name = owningTable.getName() + '_' + targetTable.getName();
+ return owningTable.getDatabase().convertNameToIdentifier(name);
+ }
+
+ /**
+ * Default collection table name from the JPA spec:<br>
+ * "The concatenation of the name of the containing entity and
+ * the name of the collection attribute, separated by an underscore."
+ * <pre>
+ * [owning entity name]_[attribute name]
+ * </pre>
+ */
+ public static String buildCollectionTableDefaultName(ElementCollectionMapping2_0 mapping) {
+ Entity entity = mapping.getEntity();
+ if (entity == null) {
+ return null;
+ }
+ String owningEntityName = entity.getName();
+ String attributeName = mapping.getName();
+ return owningEntityName + '_' + attributeName;
+ }
+
+ /**
+ * Return the join column's default name;
+ * which is typically
+ * [attribute name]_[referenced column name]
+ * But, if we don't have an attribute name (e.g. in a unidirectional
+ * OneToMany or ManyToMany) is
+ * [target entity name]_[referenced column name]
+ *
+ * @see #buildJoinTableDefaultName(ReadOnlyRelationship)
+ */
+ public static String buildJoinColumnDefaultName(ReadOnlyJoinColumn joinColumn, ReadOnlyJoinColumn.Owner owner) {
+ if (owner.joinColumnsSize() != 1) {
+ return null;
+ }
+ String prefix = owner.getAttributeName();
+ if (prefix == null) {
+ Entity targetEntity = owner.getRelationshipTarget();
+ if (targetEntity == null) {
+ return null;
+ }
+ prefix = targetEntity.getName();
+ }
+ // not sure which of these is correct...
+ // (the spec implies that the referenced column is always the
+ // primary key column of the target entity)
+ // Column targetColumn = joinColumn.getTargetPrimaryKeyDbColumn();
+ String targetColumnName = joinColumn.getReferencedColumnName();
+ if (targetColumnName == null) {
+ return null;
+ }
+ String name = prefix + '_' + targetColumnName;
+ // not sure which of these is correct...
+ // converting the name to an identifier will result in the identifier
+ // being delimited nearly every time (at least on non-Sybase/MS
+ // databases); but that probably is not the intent of the spec...
+ // return targetColumn.getDatabase().convertNameToIdentifier(name);
+ return name;
+ }
+
+ /**
+ * Return the name of the attribute in the specified mapping's target entity
+ * that is owned by the mapping.
+ */
+ public static String getTargetAttributeName(RelationshipMapping relationshipMapping) {
+ if (relationshipMapping == null) {
+ return null;
+ }
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(targetEntity.getPersistentType().allAttributes())) {
+ if (attribute.getMapping().isOwnedBy(relationshipMapping)) {
+ return attribute.getName();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * If appropriate, return the name of the single primary key column of the
+ * relationship target.
+ * Spec states:<br>
+ * "The same name as the primary key column of the referenced table."<br>
+ * We are assuming that the primary key column is defined by the mappings instead of the database.
+ */
+ public static String buildJoinColumnDefaultReferencedColumnName(ReadOnlyJoinColumn.Owner joinColumnOwner) {
+ if (joinColumnOwner.joinColumnsSize() != 1) {
+ return null;
+ }
+ Entity targetEntity = joinColumnOwner.getRelationshipTarget();
+ if (targetEntity == null) {
+ return null;
+ }
+ return targetEntity.getPrimaryKeyColumnName();
+ }
+
+ public static ColumnMapping getColumnMapping(String attributeName, PersistentType persistentType) {
+ if ((attributeName == null) || (persistentType == null)) {
+ return null;
+ }
+ for (Iterator<ReadOnlyPersistentAttribute> stream = persistentType.allAttributes(); stream.hasNext(); ) {
+ ReadOnlyPersistentAttribute persAttribute = stream.next();
+ if (attributeName.equals(persAttribute.getName())) {
+ if (persAttribute.getMapping() instanceof ColumnMapping) {
+ return (ColumnMapping) persAttribute.getMapping();
+ }
+ // keep looking or return null???
+ }
+ }
+ return null;
+ }
+
+ public static RelationshipMapping getRelationshipMapping(String attributeName, TypeMapping typeMapping) {
+ if ((attributeName == null) || (typeMapping == null)) {
+ return null;
+ }
+ for (Iterator<AttributeMapping> stream = typeMapping.allAttributeMappings(); stream.hasNext(); ) {
+ AttributeMapping attributeMapping = stream.next();
+ if (attributeName.equals(attributeMapping.getName())) {
+ if (attributeMapping instanceof RelationshipMapping) {
+ return (RelationshipMapping) attributeMapping;
+ }
+ // keep looking or return null???
+ }
+ }
+ return null;
+ }
+
+ public static void convertReferenceTableDefaultToSpecifiedJoinColumn(ReferenceTable referenceTable) {
+ JoinColumn defaultJoinColumn = referenceTable.getDefaultJoinColumn();
+ if (defaultJoinColumn != null) {
+ String columnName = defaultJoinColumn.getDefaultName();
+ String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
+ JoinColumn joinColumn = referenceTable.addSpecifiedJoinColumn();
+ joinColumn.setSpecifiedName(columnName);
+ joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
+ }
+ }
+
+ public static void convertJoinTableDefaultToSpecifiedInverseJoinColumn(JoinTable joinTable) {
+ JoinColumn defaultInverseJoinColumn = joinTable.getDefaultInverseJoinColumn();
+ if (defaultInverseJoinColumn != null) {
+ String columnName = defaultInverseJoinColumn.getDefaultName();
+ String referencedColumnName = defaultInverseJoinColumn.getDefaultReferencedColumnName();
+ JoinColumn joinColumn = joinTable.addSpecifiedInverseJoinColumn(0);
+ joinColumn.setSpecifiedName(columnName);
+ joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
+ }
+ }
+
+ public static String getMetamodelFieldMapKeyTypeName(CollectionMapping2_0 mapping) {
+ PersistentType targetType = mapping.getResolvedTargetType();
+ String mapKey = mapping.getMapKey();
+ if ((mapKey == null) || (targetType == null)) {
+ String mapKeyClass = mapping.getMapKeyClass();
+ return mapKeyClass != null ? mapKeyClass : MetamodelField.DEFAULT_TYPE_NAME;
+ }
+ ReadOnlyPersistentAttribute mapKeyAttribute = targetType.resolveAttribute(mapKey);
+ if (mapKeyAttribute == null) {
+ return MetamodelField.DEFAULT_TYPE_NAME;
+ }
+ AttributeMapping2_0 mapKeyMapping = (AttributeMapping2_0) mapKeyAttribute.getMapping();
+ if (mapKeyMapping == null) {
+ return MetamodelField.DEFAULT_TYPE_NAME;
+ }
+ return mapKeyMapping.getMetamodelTypeName();
+ }
+
+ // TODO move to TypeMapping? may need different name (or may need to rename existing #resolve...)
+ public static Column resolveOverriddenColumn(TypeMapping overridableTypeMapping, String attributeName) {
+ // convenience null check to simplify client code
+ if (overridableTypeMapping == null) {
+ return null;
+ }
+
+ for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
+ Column column = typeMapping.resolveOverriddenColumn(attributeName);
+ if (column != null) {
+ return column;
+ }
+ }
+ return null;
+ }
+
+ // TODO move to TypeMapping? may need different name (or may need to rename existing #resolve...)
+ public static Relationship resolveOverriddenRelationship(TypeMapping overridableTypeMapping, String attributeName) {
+ // convenience null check to simplify client code
+ if (overridableTypeMapping == null) {
+ return null;
+ }
+
+ for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) {
+ Relationship relationship = typeMapping.resolveOverriddenRelationship(attributeName);
+ if (relationship != null) {
+ return relationship;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return whether the specified nodes are "duplicates".
+ * @see JpaNamedContextNode#duplicates(Object)
+ */
+ public static <T extends JpaNamedContextNode<? super T>> boolean nodesAreDuplicates(T node1, T node2) {
+ return (node1 != node2) &&
+ ! StringTools.stringIsEmpty(node1.getName()) &&
+ node1.getName().equals(node2.getName()) &&
+ ! node1.overrides(node2) &&
+ ! node2.overrides(node1);
+ }
+
+ /**
+ * Return whether the first specified node "overrides" the second,
+ * based on the "precedence" of their classes.
+ * @see JpaNamedContextNode#overrides(Object)
+ */
+ public static <T extends JpaNamedContextNode<? super T>> boolean nodeOverrides(T node1, T node2, Iterable<Class<? extends T>> precedenceTypeList) {
+ // this isn't ideal, but use it until adopters protest...
+ return (node1.getName() != null) &&
+ (node2.getName() != null) &&
+ node1.getName().equals(node2.getName()) &&
+ (node1.getPersistenceUnit() == node2.getPersistenceUnit()) &&
+ (calculatePrecedence(node1, precedenceTypeList) < calculatePrecedence(node2, precedenceTypeList));
+ }
+
+ /**
+ * Loop through the specified classes; return the index of the first class
+ * the specified node is an instance of.
+ */
+ private static <T extends JpaNamedContextNode<? super T>> int calculatePrecedence(T node, Iterable<Class<? extends T>> precedenceTypeList) {
+ int precedence = 0;
+ for (Class<?> nodeClass : precedenceTypeList) {
+ if (nodeClass.isInstance(node)) {
+ return precedence;
+ }
+ precedence++;
+ }
+ throw new IllegalArgumentException("unknown named node: " + node); //$NON-NLS-1$
+ }
+
+ public static String getPrimaryKeyColumnName(Entity entity) {
+ String pkColumnName = null;
+ for (Iterator<ReadOnlyPersistentAttribute> stream = entity.getPersistentType().allAttributes(); stream.hasNext(); ) {
+ ReadOnlyPersistentAttribute attribute = stream.next();
+ String current = attribute.getPrimaryKeyColumnName();
+ if (current != null) {
+ // 229423 - if the attribute is a primary key, but it has an attribute override,
+ // use the override column instead
+ ReadOnlyAttributeOverride attributeOverride = entity.getAttributeOverrideContainer().getOverrideNamed(attribute.getName());
+ if (attributeOverride != null) {
+ current = attributeOverride.getColumn().getName();
+ }
+ }
+ if (pkColumnName == null) {
+ pkColumnName = current;
+ } else {
+ if (current != 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;
+ }
+
+ /**
+ * "Unqualify" the specified attribute name, removing the mapping's name
+ * from the front of the attribute name if it is present. For example, if
+ * the mapping's name is <code>"foo"</code>, the attribute name
+ * <code>"foo.bar"</code> would be converted to <code>"bar"</code>).
+ * Return <code>null</code> if the attribute name cannot be "unqualified".
+ */
+ public static String unqualify(String mappingName, String attributeName) {
+ if (mappingName == null) {
+ return null;
+ }
+ if ( ! attributeName.startsWith(mappingName)) {
+ return null;
+ }
+ int mappingNameLength = mappingName.length();
+ if (attributeName.length() <= mappingNameLength) {
+ return null;
+ }
+ return (attributeName.charAt(mappingNameLength) == '.') ? attributeName.substring(mappingNameLength + 1) : null;
+ }
+
+ /**
+ * This transformer will prepend a specified qualifier, followed by a
+ * dot ('.'), to a string. For example, if a mapping's name is
+ * <code>"foo"</code> and one of its attribute's is named
+ * <code>"bar"</code>, the attribute's name will be transformed
+ * into <code>"foo.bar"</code>. If the specified qualifier is
+ * <code>null</code> (or an empty string), only a dot will be prepended
+ * to a string.
+ */
+ public static class QualifierTransformer
+ implements Transformer<String, String>
+ {
+ private final String prefix;
+ public QualifierTransformer(String qualifier) {
+ super();
+ this.prefix = (qualifier == null) ? "." : qualifier + '.'; //$NON-NLS-1$
+ }
+ public String transform(String s) {
+ return this.prefix + s;
+ }
+ }
+
+
+ // ********** constructor **********
+
+ /**
+ * Suppress default constructor, ensuring non-instantiability.
+ */
+ private MappingTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java
new file mode 100644
index 0000000000..da477387e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on named columns
+ */
+public interface NamedColumnTextRangeResolver
+{
+ TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java
new file mode 100644
index 0000000000..901eae1c02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on named columns
+ */
+public interface OverrideTextRangeResolver
+{
+ TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java
new file mode 100644
index 0000000000..7620a04d2e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+
+public class PersistentAttributePropertyTester
+ extends PropertyTester
+{
+ public static final String IS_MAPPED = "isMapped"; //$NON-NLS-1$
+
+ public static final String IS_VIRTUAL = "isVirtual"; //$NON-NLS-1$
+
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (property == null) {
+ return false;
+ }
+ if ( ! (expectedValue instanceof Boolean)) {
+ return false;
+ }
+ return this.test_(receiver, property, ((Boolean) expectedValue).booleanValue());
+ }
+
+ /**
+ * pre-condition: property is not <code>null</code>
+ */
+ protected boolean test_(Object receiver, String property, boolean expected) {
+ if (property.equals(IS_MAPPED)) {
+ boolean actual = ((ReadOnlyPersistentAttribute) receiver).getMapping().getKey() != null;
+ return actual == expected;
+ }
+ if (property.equals(IS_VIRTUAL)) {
+ boolean actual = ((ReadOnlyPersistentAttribute) receiver).isVirtual();
+ return actual == expected;
+ }
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java
new file mode 100644
index 0000000000..a2345cc459
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on persistent attributes
+ */
+public interface PersistentAttributeTextRangeResolver
+{
+ TextRange getAttributeTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java
new file mode 100644
index 0000000000..8a759ea107
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on persistent type mappings that can define primary keys
+ */
+public interface PrimaryKeyTextRangeResolver extends TypeMappingTextRangeResolver
+{
+
+ TextRange getIdClassTextRange();
+
+ TextRange getAttributeMappingTextRange(String attributeName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java
new file mode 100644
index 0000000000..a66f0ede07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on named columns
+ */
+public interface TableTextRangeResolver
+{
+ TextRange getNameTextRange();
+
+ TextRange getSchemaTextRange();
+
+ TextRange getCatalogTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java
new file mode 100644
index 0000000000..a30cac215c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on persistent type mappings
+ */
+public interface TypeMappingTextRangeResolver
+{
+ TextRange getTypeMappingTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java
new file mode 100644
index 0000000000..78deca4bf8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
+
+/**
+ * Gather some of the behavior common to the Java and XML models. :-(
+ */
+public class TypeMappingTools
+{
+ // ********** single relationship mappings **********
+
+ public static Iterable<String> getMappedByRelationshipAttributeNames(TypeMapping typeMapping) {
+ return new TransformationIterable<SingleRelationshipMapping2_0, String>(getMapsIdRelationshipMappings(typeMapping)) {
+ @Override
+ protected String transform(SingleRelationshipMapping2_0 attributeMapping) {
+ return attributeMapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getValue();
+ }
+ };
+ }
+
+ public static Iterable<SingleRelationshipMapping2_0> getMapsIdRelationshipMappings(TypeMapping typeMapping) {
+ return new FilteringIterable<SingleRelationshipMapping2_0>(getSingleRelationshipMappings(typeMapping)) {
+ @Override
+ protected boolean accept(SingleRelationshipMapping2_0 attributeMapping) {
+ return attributeMapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy();
+ }
+ };
+ }
+
+ protected static Iterable<SingleRelationshipMapping2_0> getSingleRelationshipMappings(TypeMapping typeMapping) {
+ return new SubIterableWrapper<AttributeMapping, SingleRelationshipMapping2_0>(getSingleRelationshipMappings_(typeMapping));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected static Iterable<AttributeMapping> getSingleRelationshipMappings_(TypeMapping typeMapping) {
+ return new CompositeIterable<AttributeMapping>(
+ typeMapping.getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY),
+ typeMapping.getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)
+ );
+ }
+
+
+ // ********** attribute mappings transformer **********
+
+ public static final Transformer<TypeMapping, Iterator<AttributeMapping>> ATTRIBUTE_MAPPINGS_TRANSFORMER = new AttributeMappingsTransformer();
+ static class AttributeMappingsTransformer
+ implements Transformer<TypeMapping, Iterator<AttributeMapping>>
+ {
+ public Iterator<AttributeMapping> transform(TypeMapping mapping) {
+ return mapping.attributeMappings();
+ }
+ }
+
+
+ // ********** associated tables transformer **********
+
+ public static final Transformer<TypeMapping, Iterator<ReadOnlyTable>> ASSOCIATED_TABLES_TRANSFORMER = new AssociatedTablesTransformer();
+ static class AssociatedTablesTransformer
+ implements Transformer<TypeMapping, Iterator<ReadOnlyTable>>
+ {
+ public Iterator<ReadOnlyTable> transform(TypeMapping mapping) {
+ return mapping.associatedTables();
+ }
+ }
+
+
+ // ********** overridable attribute names transformer **********
+
+ public static final Transformer<TypeMapping, Iterator<String>> OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER = new OverridableAttributeNamesTransformer();
+ static class OverridableAttributeNamesTransformer
+ implements Transformer<TypeMapping, Iterator<String>>
+ {
+ public Iterator<String> transform(TypeMapping mapping) {
+ return mapping.overridableAttributeNames();
+ }
+ }
+
+
+ // ********** overridable association names transformer **********
+
+ public static final Transformer<TypeMapping, Iterator<String>> OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER = new OverridableAssociationNamesTransformer();
+ static class OverridableAssociationNamesTransformer
+ implements Transformer<TypeMapping, Iterator<String>>
+ {
+ public Iterator<String> transform(TypeMapping mapping) {
+ return mapping.overridableAssociationNames();
+ }
+ }
+
+
+ // ********** constructor **********
+
+ /**
+ * Suppress default constructor, ensuring non-instantiability.
+ */
+ private TypeMappingTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
new file mode 100644
index 0000000000..1a92c17ab5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.ColumnMapping;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.SimpleMetamodelField;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java attribute mapping
+ * <p>
+ * The mapping annotation is <code>null</code> for default mappings.
+ * It will be faulted into existence whenever {@link #getAnnotationForUpdate()}
+ * is called. It will <em>not</em> return to <code>null</code> automatically
+ * when all its state is defaulted; it must be explicitly cleared via
+ * {@link JavaPersistentAttribute#setMappingKey(String)}.
+ */
+public abstract class AbstractJavaAttributeMapping<A extends Annotation>
+ extends AbstractJavaJpaContextNode
+ implements JavaAttributeMapping, AttributeMapping2_0
+{
+ protected boolean default_;
+
+
+ protected AbstractJavaAttributeMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.default_ = this.buildDefault();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.updateDefault();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.getPersistentAttribute().getName();
+ }
+
+
+ // ********** annotation **********
+
+ @SuppressWarnings("unchecked")
+ public A getMappingAnnotation() {
+ return (A) this.getAnnotation_();
+ }
+
+ protected Annotation getAnnotation_() {
+ return this.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName());
+ }
+
+ protected abstract String getAnnotationName();
+
+ /**
+ * This method should only be called on mappings that can occur by default
+ * (e.g. <code>Basic</code>, <code>Embedded</code>, <code>OneToOne</code>,
+ * and <code>OneToMany</code>).
+ */
+ public A getAnnotationForUpdate() {
+ A annotation = this.getMappingAnnotation();
+ if (annotation == null) {
+ this.getPersistentAttribute().setMappingKey(this.getKey());
+ annotation = this.getMappingAnnotation();
+ if (annotation == null) {
+ throw new IllegalStateException("missing annotation: " + this); //$NON-NLS-1$
+ }
+ }
+ return annotation;
+ }
+
+
+ // ********** default **********
+
+ public boolean isDefault() {
+ return this.default_;
+ }
+
+ protected void setDefault(boolean default_) {
+ boolean old = this.default_;
+ this.default_ = default_;
+ this.firePropertyChanged(DEFAULT_PROPERTY, old, default_);
+ }
+
+ public void updateDefault() {
+ this.setDefault(this.buildDefault());
+ }
+
+ protected boolean buildDefault() {
+ return this.getMappingAnnotation() == null;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaPersistentAttribute getParent() {
+ return (JavaPersistentAttribute) super.getParent();
+ }
+
+ public JavaPersistentAttribute getPersistentAttribute() {
+ return this.getParent();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getPersistentAttribute().getOwningTypeMapping();
+ }
+
+ public JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getPersistentAttribute().getResourcePersistentAttribute();
+ }
+
+ public String getPrimaryKeyColumnName() {
+ return null;
+ }
+
+ public boolean isOverridableAttributeMapping() {
+ return false;
+ }
+
+ public boolean isOverridableAssociationMapping() {
+ return false;
+ }
+
+ public boolean isRelationshipOwner() {
+ return false;
+ }
+
+ public boolean isOwnedBy(AttributeMapping mapping) {
+ return false;
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.getTypeMapping().validatesAgainstDatabase();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+
+
+ // ********** embedded mappings **********
+
+ public Iterator<String> allMappingNames() {
+ return new SingleElementIterator<String>(this.getName());
+ }
+
+ public Iterator<String> allOverridableAttributeMappingNames() {
+ return this.isOverridableAttributeMapping() ?
+ new SingleElementIterator<String>(this.getName()) :
+ EmptyIterator.<String>instance();
+ }
+
+ public Iterator<String> allOverridableAssociationMappingNames() {
+ return this.isOverridableAssociationMapping() ?
+ new SingleElementIterator<String>(this.getName()) :
+ EmptyIterator.<String>instance();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ ColumnMapping mapping = this.resolveColumnMapping(attributeName);
+ return (mapping == null) ? null : mapping.getColumn();
+ }
+
+ protected ColumnMapping resolveColumnMapping(String name) {
+ AttributeMapping mapping = this.resolveAttributeMapping(name);
+ return ((mapping != null) && mapping.isOverridableAttributeMapping()) ? (ColumnMapping) mapping : null;
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ RelationshipMapping mapping = this.resolveRelationshipMapping(attributeName);
+ return (mapping == null) ? null : mapping.getRelationship();
+ }
+
+ protected RelationshipMapping resolveRelationshipMapping(String name) {
+ AttributeMapping mapping = this.resolveAttributeMapping(name);
+ return ((mapping != null) && mapping.isOverridableAssociationMapping()) ? (RelationshipMapping) mapping : null;
+ }
+
+ public AttributeMapping resolveAttributeMapping(String attributeName) {
+ return this.getName().equals(attributeName) ? this : null;
+ }
+
+ protected Transformer<String, String> buildQualifierTransformer() {
+ return new MappingTools.QualifierTransformer(this.getName());
+ }
+
+ protected String unqualify(String attributeName) {
+ return MappingTools.unqualify(this.getName(), attributeName);
+ }
+
+
+ // ********** metamodel **********
+
+ public MetamodelField getMetamodelField() {
+ return new SimpleMetamodelField(
+ this.getMetamodelFieldModifiers(),
+ this.getMetamodelFieldTypeName(),
+ this.getMetamodelFieldTypeArgumentNames(),
+ this.getMetamodelFieldName()
+ );
+ }
+
+ protected Iterable<String> getMetamodelFieldModifiers() {
+ return STANDARD_METAMODEL_FIELD_MODIFIERS;
+ }
+
+ /**
+ * most mappings are "singular"
+ */
+ protected String getMetamodelFieldTypeName() {
+ return JPA2_0.SINGULAR_ATTRIBUTE;
+ }
+
+ protected final Iterable<String> getMetamodelFieldTypeArgumentNames() {
+ ArrayList<String> typeArgumentNames = new ArrayList<String>(3);
+ typeArgumentNames.add(this.getTypeMapping().getPersistentType().getName());
+ this.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ return typeArgumentNames;
+ }
+
+ /**
+ * by default, we add only the mapping's attribute type name;
+ * but collection relationship mappings will also need to add the key type
+ * name if the "collection" is of type java.util.Map
+ */
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ typeArgumentNames.add(this.getMetamodelTypeName());
+ }
+
+ public String getMetamodelTypeName() {
+ return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelTypeName();
+ }
+
+ protected String getMetamodelFieldName() {
+ return this.getName();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateMappingType(messages, astRoot);
+ }
+
+ protected void validateMappingType(List<IMessage> messages, CompilationUnit astRoot) {
+ if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
+ new String[] {this.getName()},
+ this,
+ this.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.getMappingAnnotationTextRange(astRoot);
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
+ }
+
+ protected TextRange getMappingAnnotationTextRange(CompilationUnit astRoot) {
+ A annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java
new file mode 100644
index 0000000000..5e2dd96aec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
+
+/**
+ * Java column or join column
+ */
+public abstract class AbstractJavaBaseColumn<A extends BaseColumnAnnotation, O extends JavaBaseColumn.Owner>
+ extends AbstractJavaNamedColumn<A, O>
+ implements JavaBaseColumn
+{
+ protected String specifiedTable;
+ protected String defaultTable;
+
+ protected Boolean specifiedUnique;
+ protected boolean defaultUnique;
+
+ protected Boolean specifiedNullable;
+ protected boolean defaultNullable;
+
+ protected Boolean specifiedInsertable;
+ protected boolean defaultInsertable;
+
+ protected Boolean specifiedUpdatable;
+ protected boolean defaultUpdatable;
+
+
+ protected AbstractJavaBaseColumn(JavaJpaContextNode parent, O owner) {
+ this(parent, owner, null);
+ }
+
+ protected AbstractJavaBaseColumn(JavaJpaContextNode parent, O owner, A columnAnnotation) {
+ super(parent, owner, columnAnnotation);
+ this.specifiedTable = this.buildSpecifiedTable();
+ this.specifiedUnique = this.buildSpecifiedUnique();
+ this.specifiedNullable = this.buildSpecifiedNullable();
+ this.specifiedInsertable = this.buildSpecifiedInsertable();
+ this.specifiedUpdatable = this.buildSpecifiedUpdatable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTable_(this.buildSpecifiedTable());
+ this.setSpecifiedUnique_(this.buildSpecifiedUnique());
+ this.setSpecifiedNullable_(this.buildSpecifiedNullable());
+ this.setSpecifiedInsertable_(this.buildSpecifiedInsertable());
+ this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultTable(this.buildDefaultTable());
+ this.setDefaultUnique(this.buildDefaultUnique());
+ this.setDefaultNullable(this.buildDefaultNullable());
+ this.setDefaultInsertable(this.buildDefaultInsertable());
+ this.setDefaultUpdatable(this.buildDefaultUpdatable());
+ }
+
+
+ // ********** table **********
+
+ @Override
+ public String getTable() {
+ return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ public void setSpecifiedTable(String table) {
+ if (this.valuesAreDifferent(this.specifiedTable, table)) {
+ this.getColumnAnnotation().setTable(table);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedTable_(table);
+ }
+ }
+
+ protected void setSpecifiedTable_(String table) {
+ String old = this.specifiedTable;
+ this.specifiedTable = table;
+ this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildSpecifiedTable() {
+ return this.getColumnAnnotation().getTable();
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String table) {
+ String old = this.defaultTable;
+ this.defaultTable = table;
+ this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildDefaultTable() {
+ return this.owner.getDefaultTableName();
+ }
+
+ public TextRange getTableTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.getColumnAnnotation().getTableTextRange(astRoot);
+ return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot);
+ }
+
+
+ // ********** unique **********
+
+ public boolean isUnique() {
+ return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique();
+ }
+
+ public Boolean getSpecifiedUnique() {
+ return this.specifiedUnique;
+ }
+
+ public void setSpecifiedUnique(Boolean unique) {
+ if (this.valuesAreDifferent(this.specifiedUnique, unique)) {
+ this.getColumnAnnotation().setUnique(unique);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedUnique_(unique);
+ }
+ }
+
+ protected void setSpecifiedUnique_(Boolean unique) {
+ Boolean old = this.specifiedUnique;
+ this.specifiedUnique = unique;
+ this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique);
+ }
+
+ protected Boolean buildSpecifiedUnique() {
+ return this.getColumnAnnotation().getUnique();
+ }
+
+ public boolean isDefaultUnique() {
+ return this.defaultUnique;
+ }
+
+ protected void setDefaultUnique(boolean unique) {
+ boolean old = this.defaultUnique;
+ this.defaultUnique = unique;
+ this.firePropertyChanged(DEFAULT_UNIQUE_PROPERTY, old, unique);
+ }
+
+ protected boolean buildDefaultUnique() {
+ return DEFAULT_UNIQUE;
+ }
+
+
+ // ********** nullable **********
+
+ public boolean isNullable() {
+ return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable();
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean nullable) {
+ if (this.valuesAreDifferent(this.specifiedNullable, nullable)) {
+ this.getColumnAnnotation().setNullable(nullable);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedNullable_(nullable);
+ }
+ }
+
+ protected void setSpecifiedNullable_(Boolean nullable) {
+ Boolean old = this.specifiedNullable;
+ this.specifiedNullable = nullable;
+ this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected Boolean buildSpecifiedNullable() {
+ return this.getColumnAnnotation().getNullable();
+ }
+
+ public boolean isDefaultNullable() {
+ return this.defaultNullable;
+ }
+
+ protected void setDefaultNullable(boolean nullable) {
+ boolean old = this.defaultNullable;
+ this.defaultNullable = nullable;
+ this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected boolean buildDefaultNullable() {
+ return DEFAULT_NULLABLE;
+ }
+
+
+ // ********** insertable **********
+
+ public boolean isInsertable() {
+ return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable();
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean insertable) {
+ if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) {
+ this.getColumnAnnotation().setInsertable(insertable);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedInsertable_(insertable);
+ }
+ }
+
+ protected void setSpecifiedInsertable_(Boolean insertable) {
+ Boolean old = this.specifiedInsertable;
+ this.specifiedInsertable = insertable;
+ this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected Boolean buildSpecifiedInsertable() {
+ return this.getColumnAnnotation().getInsertable();
+ }
+
+ public boolean isDefaultInsertable() {
+ return this.defaultInsertable;
+ }
+
+ protected void setDefaultInsertable(boolean insertable) {
+ boolean old = this.defaultInsertable;
+ this.defaultInsertable = insertable;
+ this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected boolean buildDefaultInsertable() {
+ return DEFAULT_INSERTABLE;
+ }
+
+
+ // ********** updatable **********
+
+ public boolean isUpdatable() {
+ return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable();
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean updatable) {
+ if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) {
+ this.getColumnAnnotation().setUpdatable(updatable);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedUpdatable_(updatable);
+ }
+ }
+
+ protected void setSpecifiedUpdatable_(Boolean updatable) {
+ Boolean old = this.specifiedUpdatable;
+ this.specifiedUpdatable = updatable;
+ this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected Boolean buildSpecifiedUpdatable() {
+ return this.getColumnAnnotation().getUpdatable();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return this.defaultUpdatable;
+ }
+
+ protected void setDefaultUpdatable(boolean updatable) {
+ boolean old = this.defaultUpdatable;
+ this.defaultUpdatable = updatable;
+ this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected boolean buildDefaultUpdatable() {
+ return DEFAULT_UPDATABLE;
+ }
+
+
+ // ********** misc **********
+
+ protected void initializeFrom(ReadOnlyBaseColumn oldColumn) {
+ super.initializeFrom(oldColumn);
+ this.setSpecifiedTable(oldColumn.getSpecifiedTable());
+ this.setSpecifiedUnique(oldColumn.getSpecifiedUnique());
+ this.setSpecifiedNullable(oldColumn.getSpecifiedNullable());
+ this.setSpecifiedInsertable(oldColumn.getSpecifiedInsertable());
+ this.setSpecifiedUpdatable(oldColumn.getSpecifiedUpdatable());
+ }
+
+ protected void initializeFromVirtual(ReadOnlyBaseColumn virtualColumn) {
+ super.initializeFromVirtual(virtualColumn);
+ this.setSpecifiedTable(virtualColumn.getTable());
+ // ignore other settings?
+ }
+
+ public boolean tableNameIsInvalid() {
+ return this.owner.tableNameIsInvalid(this.getTable());
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.tableTouches(pos, astRoot)) {
+ return this.javaCandidateTableNames(filter);
+ }
+ return null;
+ }
+
+ protected boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return this.getColumnAnnotation().tableTouches(pos, astRoot);
+ }
+
+ protected Iterator<String> javaCandidateTableNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.candidateTableNames(filter));
+ }
+
+ protected Iterator<String> candidateTableNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateTableNames(), filter);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.owner.candidateTableNames();
+ }
+
+ @Override
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaBaseColumnTextRangeResolver(this, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
new file mode 100644
index 0000000000..ea3c1a97e2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> embedded or embedded ID mapping
+ */
+public abstract class AbstractJavaBaseEmbeddedMapping<A extends Annotation>
+ extends AbstractJavaAttributeMapping<A>
+ implements JavaBaseEmbeddedMapping
+{
+ protected final JavaAttributeOverrideContainer attributeOverrideContainer;
+
+ protected Embeddable targetEmbeddable;
+
+
+ protected AbstractJavaBaseEmbeddedMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.attributeOverrideContainer = this.buildAttributeOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.attributeOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.attributeOverrideContainer.update();
+ this.setTargetEmbeddable(this.buildTargetEmbeddable());
+ }
+
+
+ // ********** attribute override container **********
+
+ public JavaAttributeOverrideContainer getAttributeOverrideContainer() {
+ return this.attributeOverrideContainer;
+ }
+
+ protected JavaAttributeOverrideContainer buildAttributeOverrideContainer() {
+ return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildAttributeOverrideContainerOwner());
+ }
+
+ protected JavaAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() {
+ return new AttributeOverrideContainerOwner();
+ }
+
+
+ // ********** target embeddable **********
+
+ public Embeddable getTargetEmbeddable() {
+ return this.targetEmbeddable;
+ }
+
+ protected void setTargetEmbeddable(Embeddable embeddable) {
+ Embeddable old = this.targetEmbeddable;
+ this.targetEmbeddable = embeddable;
+ this.firePropertyChanged(TARGET_EMBEDDABLE_PROPERTY, old, embeddable);
+ }
+
+ protected Embeddable buildTargetEmbeddable() {
+ return this.getPersistentAttribute().getEmbeddable();
+ }
+
+
+ // ********** embedded mappings **********
+
+ @Override
+ public Iterator<String> allOverridableAttributeMappingNames() {
+ return this.isJpa2_0Compatible() ?
+ this.embeddableOverridableAttributeMappingNames() :
+ super.allOverridableAttributeMappingNames();
+ }
+
+ protected Iterator<String> embeddableOverridableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ @Override
+ public Iterator<String> allOverridableAssociationMappingNames() {
+ return this.isJpa2_0Compatible() ?
+ this.embeddableOverridableAssociationMappingNames() :
+ super.allOverridableAssociationMappingNames();
+ }
+
+ protected Iterator<String> embeddableOverridableAssociationMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<String> qualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<String, String>(this.embeddableAttributeMappingNames(transformer), this.buildQualifierTransformer());
+ }
+
+ protected Iterator<String> embeddableAttributeMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new CompositeIterator<String>(this.embeddableAttributeMappingNamesLists(transformer));
+ }
+
+ /**
+ * Return a list of lists; each nested list holds the names for one of the
+ * embedded mapping's target embeddable type mapping's attribute mappings
+ * (attribute or association mappings, depending on the specified transformer).
+ */
+ protected Iterator<Iterator<String>> embeddableAttributeMappingNamesLists(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings(), transformer);
+ }
+
+ /**
+ * Return the target embeddable's attribute mappings.
+ */
+ protected Iterator<AttributeMapping> embeddableAttributeMappings() {
+ return ((this.targetEmbeddable != null) && (this.targetEmbeddable != this.getTypeMapping())) ?
+ this.targetEmbeddable.attributeMappings() :
+ EmptyIterator.<AttributeMapping>instance();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public Column resolveOverriddenColumn(String attributeName) {
+ return this.isJpa2_0Compatible() ? this.resolveOverriddenColumn_(attributeName) : null;
+ }
+
+ protected Column resolveOverriddenColumn_(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName);
+ }
+
+ protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) {
+ return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenColumn(attributeName);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.attributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ if (this.validateTargetEmbeddable(messages, astRoot)) {
+ this.validateOverrides(messages, reporter, astRoot);
+ }
+ }
+
+ protected boolean validateTargetEmbeddable(List<IMessage> messages, CompilationUnit astRoot) {
+ if (this.targetEmbeddable != null) {
+ return true;
+ }
+ String targetEmbeddableTypeName = this.getPersistentAttribute().getTypeName();
+ // if the type isn't resolvable, there will already be a java compile error
+ if (targetEmbeddableTypeName != null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TARGET_NOT_AN_EMBEDDABLE,
+ new String[] {targetEmbeddableTypeName},
+ this,
+ this.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ return false;
+ }
+
+ protected void validateOverrides(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.attributeOverrideContainer.validate(messages, reporter, astRoot);
+ }
+
+
+ // ********** attribute override container owner *********
+
+ protected class AttributeOverrideContainerOwner
+ implements JavaAttributeOverrideContainer.Owner
+ {
+ public JavaResourcePersistentMember getResourcePersistentMember() {
+ return AbstractJavaBaseEmbeddedMapping.this.getResourcePersistentAttribute();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return AbstractJavaBaseEmbeddedMapping.this.getTypeMapping();
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractJavaBaseEmbeddedMapping.this.getTargetEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? this.allOverridableAttributeNames_(typeMapping) : EmptyIterator.<String>instance();
+ }
+
+ /**
+ * pre-condition: type mapping is not <code>null</code>
+ * <p>
+ * NB: Overridden in {@link GenericOrmEmbeddedIdMapping.AttributeOverrideContainerOwner}
+ */
+ protected Iterator<String> allOverridableAttributeNames_(TypeMapping typeMapping) {
+ return typeMapping.allOverridableAttributeNames();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public String getPossiblePrefix() {
+ return null;
+ }
+
+ public String getWritePrefix() {
+ return null;
+ }
+
+ // no maps, so all overrides are relevant
+ public boolean isRelevant(String overrideName) {
+ return true;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return AbstractJavaBaseEmbeddedMapping.this.getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java
new file mode 100644
index 0000000000..1fa555f9cb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java
@@ -0,0 +1,383 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.Association;
+import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java basic mapping
+ */
+public abstract class AbstractJavaBasicMapping
+ extends AbstractJavaAttributeMapping<BasicAnnotation>
+ implements JavaBasicMapping
+{
+ protected final JavaColumn column;
+
+ protected FetchType specifiedFetch;
+ protected FetchType defaultFetch;
+
+ protected Boolean specifiedOptional;
+ protected boolean defaultOptional;
+
+ protected JavaConverter converter; // never null
+
+
+ protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] {
+ JavaEnumeratedConverter.Adapter.instance(),
+ JavaTemporalConverter.Adapter.instance(),
+ JavaLobConverter.Adapter.instance()
+ };
+ protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractJavaBasicMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.column = this.buildColumn();
+ this.specifiedFetch = this.buildSpecifiedFetch();
+ this.specifiedOptional = this.buildSpecifiedOptional();
+ this.converter = this.buildConverter();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ this.setSpecifiedFetch_(this.buildSpecifiedFetch());
+ this.setSpecifiedOptional_(this.buildSpecifiedOptional());
+ this.syncConverter();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ this.setDefaultFetch(this.buildDefaultFetch());
+ this.setDefaultOptional(this.buildDefaultOptional());
+ this.converter.update();
+ }
+
+
+ // ********** column **********
+
+ public JavaColumn getColumn() {
+ return this.column;
+ }
+
+ protected JavaColumn buildColumn() {
+ return this.getJpaFactory().buildJavaColumn(this, this);
+ }
+
+
+ // ********** fetch **********
+
+ public FetchType getFetch() {
+ return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType fetch) {
+ if (this.valuesAreDifferent(fetch, this.specifiedFetch)) {
+ this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch));
+ this.setSpecifiedFetch_(fetch);
+ }
+ }
+
+ protected void setSpecifiedFetch_(FetchType fetch) {
+ FetchType old = this.specifiedFetch;
+ this.specifiedFetch = fetch;
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildSpecifiedFetch() {
+ BasicAnnotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch());
+ }
+
+ public FetchType getDefaultFetch() {
+ return this.defaultFetch;
+ }
+
+ protected void setDefaultFetch(FetchType fetch) {
+ FetchType old = this.defaultFetch;
+ this.defaultFetch = fetch;
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+
+ // ********** optional **********
+
+ public boolean isOptional() {
+ return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.isDefaultOptional();
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean optional) {
+ if (this.valuesAreDifferent(optional, this.specifiedOptional)) {
+ this.getAnnotationForUpdate().setOptional(optional);
+ this.setSpecifiedOptional_(optional);
+ }
+ }
+
+ protected void setSpecifiedOptional_(Boolean optional) {
+ Boolean old = this.specifiedOptional;
+ this.specifiedOptional = optional;
+ this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ protected Boolean buildSpecifiedOptional() {
+ BasicAnnotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getOptional();
+ }
+
+ public boolean isDefaultOptional() {
+ return defaultOptional;
+ }
+
+ protected void setDefaultOptional(boolean optional) {
+ boolean old = this.defaultOptional;
+ this.defaultOptional = optional;
+ this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ protected boolean buildDefaultOptional() {
+ return DEFAULT_OPTIONAL;
+ }
+
+
+ // ********** converter **********
+
+ public JavaConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ this.converter.dispose();
+ JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.retainConverterAnnotation(converterAdapter);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ }
+ }
+
+ protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getJpaFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(JavaConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ /**
+ * Clear all the converter annotations <em>except</em> for the annotation
+ * corresponding to the specified adapter. If the specified adapter is
+ * <code>null</code>, remove <em>all</em> the converter annotations.
+ */
+ protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter != converterAdapter) {
+ adapter.removeConverterAnnotation(resourceAttribute);
+ }
+ }
+ }
+
+ protected JavaConverter buildConverter() {
+ JpaFactory jpaFactory = this.getJpaFactory();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory);
+ if (javaConverter != null) {
+ return javaConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ Association<JavaConverter.Adapter, Annotation> assoc = this.getConverterAnnotation();
+ if (assoc == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ JavaConverter.Adapter adapter = assoc.getKey();
+ Annotation annotation = assoc.getValue();
+ if ((this.converter.getType() == adapter.getConverterType()) &&
+ (this.converter.getConverterAnnotation() == annotation)) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first converter annotation we find along with its corresponding
+ * adapter. Return <code>null</code> if there are no converter annotations.
+ */
+ protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
+ if (annotation != null) {
+ return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation);
+ }
+ }
+ return null;
+ }
+
+ protected JavaConverter buildNullConverter() {
+ return new NullJavaConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected JavaConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<JavaConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return BasicAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+
+ // ********** JavaColumn.Owner implementation **********
+
+ public ColumnAnnotation getColumnAnnotation() {
+ return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeColumnAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ public String getDefaultColumnName() {
+ return this.getName();
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.converter.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.column.validate(messages, reporter, astRoot);
+ this.converter.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java
new file mode 100644
index 0000000000..e9db78d75f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+public abstract class AbstractJavaBasicMappingDefinition
+ implements DefaultJavaAttributeMappingDefinition
+{
+ protected AbstractJavaBasicMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return BasicAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ ColumnAnnotation.ANNOTATION_NAME,
+ LobAnnotation.ANNOTATION_NAME,
+ TemporalAnnotation.ANNOTATION_NAME,
+ EnumeratedAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaBasicMapping(persistentAttribute);
+ }
+
+ public boolean isDefault(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.typeIsBasic();
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java
new file mode 100644
index 0000000000..991d67b0d2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+
+/**
+ * Java embeddable type mapping
+ */
+public abstract class AbstractJavaEmbeddable
+ extends AbstractJavaTypeMapping<EmbeddableAnnotation>
+ implements JavaEmbeddable
+{
+ protected AbstractJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ }
+
+ public String getKey() {
+ return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+ public JavaPersistentType getIdClass() {
+ return null;
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ @Override
+ public boolean validatesAgainstDatabase() {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java
new file mode 100644
index 0000000000..4460a740a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
+
+public abstract class AbstractJavaEmbeddedMappingDefinition
+ implements DefaultJavaAttributeMappingDefinition
+{
+ protected AbstractJavaEmbeddedMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return EmbeddedAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ AttributeOverrideAnnotation.ANNOTATION_NAME,
+ AttributeOverridesAnnotation.ANNOTATION_NAME,
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaEmbeddedMapping(persistentAttribute);
+ }
+
+ public boolean isDefault(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getEmbeddable() != null;
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
new file mode 100644
index 0000000000..11157f3cb5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
@@ -0,0 +1,1816 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.HashBag;
+import org.eclipse.jpt.common.utility.internal.NotNullFilter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported;
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.InheritanceType;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.SecondaryTable;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.DiscriminatorColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTableValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.TableValidator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java entity
+ */
+public abstract class AbstractJavaEntity
+ extends AbstractJavaTypeMapping<EntityAnnotation>
+ implements JavaEntity, JavaCacheableHolder2_0, JavaGeneratorContainer.Owner, JavaQueryContainer.Owner
+{
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected Entity rootEntity;
+ protected final Vector<Entity> descendants = new Vector<Entity>();
+
+ protected final JavaIdClassReference idClassReference;
+
+ protected final JavaTable table;
+ protected boolean specifiedTableIsAllowed;
+ protected boolean tableIsUndefined;
+
+ protected final Vector<JavaSecondaryTable> specifiedSecondaryTables = new Vector<JavaSecondaryTable>();
+ protected final SpecifiedSecondaryTableContainerAdapter specifiedSecondaryTableContainerAdapter = new SpecifiedSecondaryTableContainerAdapter();
+ protected final Table.Owner specifiedSecondaryTableOwner;
+
+ protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner;
+ protected final Vector<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<JavaPrimaryKeyJoinColumn>();
+ protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
+
+ protected InheritanceType specifiedInheritanceStrategy;
+ protected InheritanceType defaultInheritanceStrategy;
+
+ protected String specifiedDiscriminatorValue;
+ protected String defaultDiscriminatorValue;
+ protected boolean specifiedDiscriminatorValueIsAllowed;
+ protected boolean discriminatorValueIsUndefined;
+
+ protected final JavaDiscriminatorColumn discriminatorColumn;
+ protected boolean specifiedDiscriminatorColumnIsAllowed;
+ protected boolean discriminatorColumnIsUndefined;
+
+ protected final JavaAttributeOverrideContainer attributeOverrideContainer;
+ protected final JavaAssociationOverrideContainer associationOverrideContainer;
+
+ protected final JavaGeneratorContainer generatorContainer;
+ protected final JavaQueryContainer queryContainer;
+
+
+ // ********** construction **********
+
+ protected AbstractJavaEntity(JavaPersistentType parent, EntityAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ this.specifiedName = this.mappingAnnotation.getName();
+ this.idClassReference = this.buildIdClassReference();
+ this.table = this.buildTable();
+ this.specifiedSecondaryTableOwner = this.buildSpecifiedSecondaryTableOwner();
+ this.initializeSpecifiedSecondaryTables();
+ this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ this.initializeSpecifiedPrimaryKeyJoinColumns();
+ this.specifiedInheritanceStrategy = this.buildSpecifiedInheritanceStrategy();
+ this.specifiedDiscriminatorValue = this.getDiscriminatorValueAnnotation().getValue();
+ this.discriminatorColumn = this.buildDiscriminatorColumn();
+ // start with the entity as the root - it will be recalculated in update()
+ this.rootEntity = this;
+ this.attributeOverrideContainer = this.buildAttributeOverrideContainer();
+ this.associationOverrideContainer = this.buildAssociationOverrideContainer();
+ this.generatorContainer = this.buildGeneratorContainer();
+ this.queryContainer = this.buildQueryContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedName_(this.mappingAnnotation.getName());
+ this.idClassReference.synchronizeWithResourceModel();
+ this.table.synchronizeWithResourceModel();
+ this.syncSpecifiedSecondaryTables();
+ this.syncSpecifiedPrimaryKeyJoinColumns();
+ this.setSpecifiedInheritanceStrategy_(this.buildSpecifiedInheritanceStrategy());
+ this.setSpecifiedDiscriminatorValue_(this.getDiscriminatorValueAnnotation().getValue());
+ this.discriminatorColumn.synchronizeWithResourceModel();
+ this.attributeOverrideContainer.synchronizeWithResourceModel();
+ this.associationOverrideContainer.synchronizeWithResourceModel();
+ this.generatorContainer.synchronizeWithResourceModel();
+ this.queryContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setDefaultName(this.buildDefaultName());
+
+ // calculate root entity early - other things depend on it
+ this.setRootEntity(this.buildRootEntity());
+ this.updateDescendants();
+
+ this.idClassReference.update();
+
+ this.table.update();
+ this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed());
+ this.setTableIsUndefined(this.buildTableIsUndefined());
+
+ this.updateNodes(this.getSecondaryTables());
+
+ this.updateDefaultPrimaryKeyJoinColumn();
+ this.updateNodes(this.getPrimaryKeyJoinColumns());
+
+ this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy());
+
+ this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue());
+ this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed());
+ this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined());
+
+ this.discriminatorColumn.update();
+ this.setSpecifiedDiscriminatorColumnIsAllowed(this.buildSpecifiedDiscriminatorColumnIsAllowed());
+ this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined());
+
+ this.attributeOverrideContainer.update();
+ this.associationOverrideContainer.update();
+
+ this.generatorContainer.update();
+ this.queryContainer.update();
+ }
+
+
+ // ********** name **********
+
+ @Override
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String name) {
+ this.mappingAnnotation.setName(name);
+ this.setSpecifiedName_(name);
+ }
+
+ protected void setSpecifiedName_(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultName() {
+ return this.getResourcePersistentType().getName();
+ }
+
+
+ // ********** root entity **********
+
+ public Entity getRootEntity() {
+ return this.rootEntity;
+ }
+
+ protected void setRootEntity(Entity entity) {
+ Entity old = this.rootEntity;
+ this.rootEntity = entity;
+ this.firePropertyChanged(ROOT_ENTITY_PROPERTY, old, entity);
+ }
+
+ protected Entity buildRootEntity() {
+ Entity root = this;
+ for (TypeMapping typeMapping : this.getAncestors()) {
+ if (typeMapping instanceof Entity) {
+ root = (Entity) typeMapping;
+ }
+ }
+ return root;
+ }
+
+
+ // ********** descendants **********
+
+ public Iterable<Entity> getDescendants() {
+ return new LiveCloneListIterable<Entity>(this.descendants);
+ }
+
+ protected void updateDescendants() {
+ this.synchronizeCollection(this.buildDescendants(), this.descendants, DESCENDANTS_COLLECTION);
+ }
+
+ protected Iterable<Entity> buildDescendants() {
+ return new FilteringIterable<Entity>(this.getPersistenceUnit().getEntities()) {
+ @Override
+ protected boolean accept(Entity entity) {
+ return AbstractJavaEntity.this.entityIsDescendant(entity);
+ }
+ };
+ }
+
+ /**
+ * Return whether specified entity is a descendant of the entity.
+ */
+ protected boolean entityIsDescendant(Entity entity) {
+ String typeName = this.getPersistentType().getName();
+ String entityTypeName = entity.getPersistentType().getName();
+ String rootEntityTypeName = entity.getRootEntity().getPersistentType().getName();
+ return Tools.valuesAreDifferent(typeName, entityTypeName) &&
+ Tools.valuesAreEqual(typeName, rootEntityTypeName);
+ }
+
+
+ // ********** id class **********
+
+ public JavaIdClassReference getIdClassReference() {
+ return this.idClassReference;
+ }
+
+ protected JavaIdClassReference buildIdClassReference() {
+ return new GenericJavaIdClassReference(this);
+ }
+
+ public JavaPersistentType getIdClass() {
+ return this.idClassReference.getIdClass();
+ }
+
+
+ // ********** table **********
+
+ public JavaTable getTable() {
+ return this.table;
+ }
+
+ protected JavaTable buildTable() {
+ return this.getJpaFactory().buildJavaTable(this, this.buildTableOwner());
+ }
+
+ protected JavaTable.Owner buildTableOwner() {
+ return new TableOwner();
+ }
+
+ public boolean specifiedTableIsAllowed() {
+ return this.specifiedTableIsAllowed;
+ }
+
+ protected void setSpecifiedTableIsAllowed(boolean specifiedTableIsAllowed) {
+ boolean old = this.specifiedTableIsAllowed;
+ this.specifiedTableIsAllowed = specifiedTableIsAllowed;
+ this.firePropertyChanged(SPECIFIED_TABLE_IS_ALLOWED_PROPERTY, old, specifiedTableIsAllowed);
+ }
+
+ protected boolean buildSpecifiedTableIsAllowed() {
+ return ! this.isAbstractTablePerClass() && ! this.isSingleTableDescendant();
+ }
+
+ public boolean tableIsUndefined() {
+ return this.tableIsUndefined;
+ }
+
+ protected void setTableIsUndefined(boolean tableIsUndefined) {
+ boolean old = this.tableIsUndefined;
+ this.tableIsUndefined = tableIsUndefined;
+ this.firePropertyChanged(TABLE_IS_UNDEFINED_PROPERTY, old, tableIsUndefined);
+ }
+
+ protected boolean buildTableIsUndefined() {
+ return this.isAbstractTablePerClass();
+ }
+
+ /**
+ * <ul>
+ * <li>If the entity is part of a single table inheritance hierarchy, the table
+ * name defaults to the root entity's table name.
+ * <li>If the entity is abstract and part of a table per class
+ * inheritance hierarchy, the table name defaults to null, as no table applies.
+ * <li>Otherwise, the table name defaults to the entity name.
+ * </ul>
+ */
+ public String getDefaultTableName() {
+ return this.isSingleTableDescendant() ?
+ this.rootEntity.getTable().getName() :
+ this.isAbstractTablePerClass() ? null : this.getName();
+ }
+
+ /**
+ * @see #getDefaultTableName()
+ */
+ public String getDefaultSchema() {
+ return this.isSingleTableDescendant() ?
+ this.rootEntity.getTable().getSchema() :
+ this.isAbstractTablePerClass() ? null : this.getContextDefaultSchema();
+ }
+
+ /**
+ * @see #getDefaultTableName()
+ */
+ public String getDefaultCatalog() {
+ return this.isSingleTableDescendant() ?
+ this.rootEntity.getTable().getCatalog() :
+ this.isAbstractTablePerClass() ? null : this.getContextDefaultCatalog();
+ }
+
+
+ // ********** secondary tables **********
+
+ public ListIterator<JavaSecondaryTable> secondaryTables() {
+ return this.specifiedSecondaryTables();
+ }
+
+ protected ListIterable<JavaSecondaryTable> getSecondaryTables() {
+ return this.getSpecifiedSecondaryTables();
+ }
+
+ public int secondaryTablesSize() {
+ return this.specifiedSecondaryTablesSize();
+ }
+
+
+ // ********** specified secondary tables **********
+
+ public ListIterator<JavaSecondaryTable> specifiedSecondaryTables() {
+ return this.getSpecifiedSecondaryTables().iterator();
+ }
+
+ protected ListIterable<JavaSecondaryTable> getSpecifiedSecondaryTables() {
+ return new LiveCloneListIterable<JavaSecondaryTable>(this.specifiedSecondaryTables);
+ }
+
+ public int specifiedSecondaryTablesSize() {
+ return this.specifiedSecondaryTables.size();
+ }
+
+ public JavaSecondaryTable addSpecifiedSecondaryTable() {
+ return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size());
+ }
+
+ public JavaSecondaryTable addSpecifiedSecondaryTable(int index) {
+ SecondaryTableAnnotation annotation = this.buildSecondaryTableAnnotation(index);
+ return this.addSpecifiedSecondaryTable_(index, annotation);
+ }
+
+ protected SecondaryTableAnnotation buildSecondaryTableAnnotation(int index) {
+ return (SecondaryTableAnnotation) this.getResourcePersistentType().addAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) {
+ this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ }
+
+ public void removeSpecifiedSecondaryTable(int index) {
+ this.getResourcePersistentType().removeAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ this.removeSpecifiedSecondaryTable_(index);
+ }
+
+ protected void removeSpecifiedSecondaryTable_(int index) {
+ this.removeItemFromList(index, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
+ this.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ protected void initializeSpecifiedSecondaryTables() {
+ for (SecondaryTableAnnotation annotation : this.getSecondaryTableAnnotations()) {
+ this.specifiedSecondaryTables.add(this.buildSecondaryTable(annotation));
+ }
+ }
+
+ protected JavaSecondaryTable buildSecondaryTable(SecondaryTableAnnotation secondaryTableAnnotation) {
+ return this.getJpaFactory().buildJavaSecondaryTable(this, this.specifiedSecondaryTableOwner, secondaryTableAnnotation);
+ }
+
+ protected void syncSpecifiedSecondaryTables() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedSecondaryTableContainerAdapter);
+ }
+
+ protected Iterable<SecondaryTableAnnotation> getSecondaryTableAnnotations() {
+ return new SubIterableWrapper<NestableAnnotation, SecondaryTableAnnotation>(
+ CollectionTools.iterable(this.secondaryTableAnnotations())
+ );
+ }
+
+ protected Iterator<NestableAnnotation> secondaryTableAnnotations() {
+ return this.getResourceAnnotatedElement().annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void moveSpecifiedSecondaryTable_(int index, JavaSecondaryTable secondaryTable) {
+ this.moveItemInList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ protected JavaSecondaryTable addSpecifiedSecondaryTable_(int index, SecondaryTableAnnotation secondaryTableAnnotation) {
+ JavaSecondaryTable secondaryTable = this.buildSecondaryTable(secondaryTableAnnotation);
+ this.addItemToList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ return secondaryTable;
+ }
+
+ protected void removeSpecifiedSecondaryTable_(JavaSecondaryTable secondaryTable) {
+ this.removeSpecifiedSecondaryTable_(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ }
+
+ /**
+ * specified secondary table container adapter
+ */
+ protected class SpecifiedSecondaryTableContainerAdapter
+ implements ContextContainerTools.Adapter<JavaSecondaryTable, SecondaryTableAnnotation>
+ {
+ public Iterable<JavaSecondaryTable> getContextElements() {
+ return AbstractJavaEntity.this.getSpecifiedSecondaryTables();
+ }
+ public Iterable<SecondaryTableAnnotation> getResourceElements() {
+ return AbstractJavaEntity.this.getSecondaryTableAnnotations();
+ }
+ public SecondaryTableAnnotation getResourceElement(JavaSecondaryTable contextElement) {
+ return contextElement.getTableAnnotation();
+ }
+ public void moveContextElement(int index, JavaSecondaryTable element) {
+ AbstractJavaEntity.this.moveSpecifiedSecondaryTable_(index, element);
+ }
+ public void addContextElement(int index, SecondaryTableAnnotation resourceElement) {
+ AbstractJavaEntity.this.addSpecifiedSecondaryTable_(index, resourceElement);
+ }
+ public void removeContextElement(JavaSecondaryTable element) {
+ AbstractJavaEntity.this.removeSpecifiedSecondaryTable_(element);
+ }
+ }
+
+ protected Table.Owner buildSpecifiedSecondaryTableOwner() {
+ return new SecondaryTableOwner();
+ }
+
+
+ // ********** primary key join columns **********
+
+ public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.getPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize();
+ }
+
+
+ // ********** specified primary key join columns **********
+
+ public ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<JavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ }
+
+ public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ }
+
+ public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ PrimaryKeyJoinColumnAnnotation annotation = this.buildPrimaryKeyJoinColumnAnnotation(index);
+ return this.addSpecifiedPrimaryKeyJoinColumn_(index, annotation);
+ }
+
+ protected PrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumnAnnotation(int index) {
+ return (PrimaryKeyJoinColumnAnnotation) this.getResourcePersistentType().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ this.getResourcePersistentType().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ this.removeSpecifiedPrimaryKeyJoinColumn_(index);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ this.getResourcePersistentType().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected void initializeSpecifiedPrimaryKeyJoinColumns() {
+ for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) {
+ this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation));
+ }
+ }
+
+ protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) {
+ return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, primaryKeyJoinColumnAnnotation);
+ }
+
+ protected void syncSpecifiedPrimaryKeyJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
+ return new SubIterableWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(
+ CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations())
+ );
+ }
+
+ protected Iterator<NestableAnnotation> primaryKeyJoinColumnAnnotations() {
+ return this.getResourceAnnotatedElement().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ this.moveItemInList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) {
+ JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = this.buildPrimaryKeyJoinColumn(primaryKeyJoinColumnAnnotation);
+ this.addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ return primaryKeyJoinColumn;
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
+ }
+
+ /**
+ * specified primary key join column container adapter
+ */
+ protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
+ {
+ public Iterable<JavaPrimaryKeyJoinColumn> getContextElements() {
+ return AbstractJavaEntity.this.getSpecifiedPrimaryKeyJoinColumns();
+ }
+ public Iterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
+ return AbstractJavaEntity.this.getPrimaryKeyJoinColumnAnnotations();
+ }
+ public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getColumnAnnotation();
+ }
+ public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) {
+ AbstractJavaEntity.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) {
+ AbstractJavaEntity.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(JavaPrimaryKeyJoinColumn element) {
+ AbstractJavaEntity.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
+ }
+ }
+
+
+ // ********** default primary key join column **********
+
+ public JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
+ return this.defaultPrimaryKeyJoinColumn;
+ }
+
+ protected void setDefaultPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn pkJoinColumn) {
+ JavaPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn;
+ this.defaultPrimaryKeyJoinColumn = pkJoinColumn;
+ this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN_PROPERTY, old, pkJoinColumn);
+ }
+
+ protected ListIterable<JavaPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
+ return (this.defaultPrimaryKeyJoinColumn != null) ?
+ new SingleElementListIterable<JavaPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
+ EmptyListIterable.<JavaPrimaryKeyJoinColumn>instance();
+ }
+
+ protected int defaultPrimaryKeyJoinColumnsSize() {
+ return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultPrimaryKeyJoinColumn() {
+ if (this.buildsDefaultPrimaryKeyJoinColumn()) {
+ if (this.defaultPrimaryKeyJoinColumn == null) {
+ this.setDefaultPrimaryKeyJoinColumn(this.buildDefaultPrimaryKeyJoinColumn());
+ } else {
+ this.defaultPrimaryKeyJoinColumn.update();
+ }
+ } else {
+ this.setDefaultPrimaryKeyJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultPrimaryKeyJoinColumn() {
+ return ! this.hasSpecifiedPrimaryKeyJoinColumns();
+ }
+
+ protected JavaPrimaryKeyJoinColumn buildDefaultPrimaryKeyJoinColumn() {
+ return this.buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.getResourcePersistentType()));
+ }
+
+
+ // ********** inheritance strategy **********
+
+ public InheritanceType getInheritanceStrategy() {
+ return (this.specifiedInheritanceStrategy != null) ? this.specifiedInheritanceStrategy : this.defaultInheritanceStrategy;
+ }
+
+ public InheritanceType getSpecifiedInheritanceStrategy() {
+ return this.specifiedInheritanceStrategy;
+ }
+
+ public void setSpecifiedInheritanceStrategy(InheritanceType inheritanceType) {
+ if (this.valuesAreDifferent(this.specifiedInheritanceStrategy, inheritanceType)) {
+ this.getInheritanceAnnotation().setStrategy(InheritanceType.toJavaResourceModel(inheritanceType));
+ this.removeInheritanceAnnotationIfUnset();
+ this.setSpecifiedInheritanceStrategy_(inheritanceType);
+ }
+ }
+
+ protected void setSpecifiedInheritanceStrategy_(InheritanceType inheritanceType) {
+ InheritanceType old = this.specifiedInheritanceStrategy;
+ this.specifiedInheritanceStrategy = inheritanceType;
+ this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ }
+
+ protected InheritanceType buildSpecifiedInheritanceStrategy() {
+ return InheritanceType.fromJavaResourceModel(this.getInheritanceAnnotation().getStrategy());
+ }
+
+ public InheritanceType getDefaultInheritanceStrategy() {
+ return this.defaultInheritanceStrategy;
+ }
+
+ protected void setDefaultInheritanceStrategy(InheritanceType inheritanceType) {
+ InheritanceType old = this.defaultInheritanceStrategy;
+ this.defaultInheritanceStrategy = inheritanceType;
+ this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ }
+
+ protected InheritanceType buildDefaultInheritanceStrategy() {
+ return this.isRoot() ? InheritanceType.SINGLE_TABLE : this.rootEntity.getInheritanceStrategy();
+ }
+
+
+ // ********** inheritance annotation **********
+
+ protected InheritanceAnnotation getInheritanceAnnotation() {
+ return (InheritanceAnnotation) this.getResourcePersistentType().getNonNullAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removeInheritanceAnnotationIfUnset() {
+ if (this.getInheritanceAnnotation().isUnset()) {
+ this.removeInheritanceAnnotation();
+ }
+ }
+
+ protected void removeInheritanceAnnotation() {
+ this.getResourcePersistentType().removeAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** discriminator value **********
+
+ public String getDiscriminatorValue() {
+ return (this.specifiedDiscriminatorValue != null) ? this.specifiedDiscriminatorValue : this.defaultDiscriminatorValue;
+ }
+
+ public String getSpecifiedDiscriminatorValue() {
+ return this.specifiedDiscriminatorValue;
+ }
+
+ public void setSpecifiedDiscriminatorValue(String discriminatorValue) {
+ if (this.valuesAreDifferent(this.specifiedDiscriminatorValue, discriminatorValue)) {
+ this.getDiscriminatorValueAnnotation().setValue(discriminatorValue);
+ this.removeDiscriminatorValueAnnotationIfUnset();
+ this.setSpecifiedDiscriminatorValue_(discriminatorValue);
+ }
+ }
+
+ protected void setSpecifiedDiscriminatorValue_(String discriminatorValue) {
+ String old = this.specifiedDiscriminatorValue;
+ this.specifiedDiscriminatorValue = discriminatorValue;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ }
+
+ public String getDefaultDiscriminatorValue() {
+ return this.defaultDiscriminatorValue;
+ }
+
+ protected void setDefaultDiscriminatorValue(String discriminatorValue) {
+ String old = this.defaultDiscriminatorValue;
+ this.defaultDiscriminatorValue = discriminatorValue;
+ this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ }
+
+ /**
+ * 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 buildDefaultDiscriminatorValue() {
+ if (this.discriminatorValueIsUndefined) {
+ return null;
+ }
+ return (this.getDiscriminatorType() == DiscriminatorType.STRING) ? this.getName() : null;
+ }
+
+ protected DiscriminatorType getDiscriminatorType() {
+ return this.discriminatorColumn.getDiscriminatorType();
+ }
+
+ public boolean specifiedDiscriminatorValueIsAllowed() {
+ return this.specifiedDiscriminatorValueIsAllowed;
+ }
+
+ protected void setSpecifiedDiscriminatorValueIsAllowed(boolean allowed) {
+ boolean old = this.specifiedDiscriminatorValueIsAllowed;
+ this.specifiedDiscriminatorValueIsAllowed = allowed;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY, old, allowed);
+ }
+
+ protected boolean buildSpecifiedDiscriminatorValueIsAllowed() {
+ return ! this.isTablePerClass() && ! this.isAbstract();
+ }
+
+ public boolean discriminatorValueIsUndefined() {
+ return this.discriminatorValueIsUndefined;
+ }
+
+ protected void setDiscriminatorValueIsUndefined(boolean undefined) {
+ boolean old = this.discriminatorValueIsUndefined;
+ this.discriminatorValueIsUndefined = undefined;
+ this.firePropertyChanged(DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY, old, undefined);
+ }
+
+ protected boolean buildDiscriminatorValueIsUndefined() {
+ return this.isTablePerClass() ||
+ this.isAbstract() ||
+ this.isRootNoDescendantsNoStrategyDefined();
+ }
+
+
+ // ********** discriminator value annotation **********
+
+ protected DiscriminatorValueAnnotation getDiscriminatorValueAnnotation() {
+ return (DiscriminatorValueAnnotation) this.getResourcePersistentType().getNonNullAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removeDiscriminatorValueAnnotationIfUnset() {
+ if (this.getDiscriminatorValueAnnotation().isUnset()) {
+ this.removeDiscriminatorValueAnnotation();
+ }
+ }
+
+ protected void removeDiscriminatorValueAnnotation() {
+ this.getResourcePersistentType().removeAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** discriminator column **********
+
+ public JavaDiscriminatorColumn getDiscriminatorColumn() {
+ return this.discriminatorColumn;
+ }
+
+ protected JavaDiscriminatorColumn buildDiscriminatorColumn() {
+ return this.getJpaFactory().buildJavaDiscriminatorColumn(this, this.buildDiscriminatorColumnOwner());
+ }
+
+ protected JavaDiscriminatorColumn.Owner buildDiscriminatorColumnOwner() {
+ return new DiscriminatorColumnOwner();
+ }
+
+ public boolean specifiedDiscriminatorColumnIsAllowed() {
+ return this.specifiedDiscriminatorColumnIsAllowed;
+ }
+
+ protected void setSpecifiedDiscriminatorColumnIsAllowed(boolean allowed) {
+ boolean old = this.specifiedDiscriminatorColumnIsAllowed;
+ this.specifiedDiscriminatorColumnIsAllowed = allowed;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY, old, allowed);
+ }
+
+ protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() {
+ return ! this.isTablePerClass() && this.isRoot();
+ }
+
+ public boolean discriminatorColumnIsUndefined() {
+ return this.discriminatorColumnIsUndefined;
+ }
+
+ protected void setDiscriminatorColumnIsUndefined(boolean undefined) {
+ boolean old = this.discriminatorColumnIsUndefined;
+ this.discriminatorColumnIsUndefined = undefined;
+ this.firePropertyChanged(DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY, old, undefined);
+ }
+
+ protected boolean buildDiscriminatorColumnIsUndefined() {
+ return this.isTablePerClass() ||
+ this.isRootNoDescendantsNoStrategyDefined();
+ }
+
+
+ // ********** attribute override container **********
+
+ public JavaAttributeOverrideContainer getAttributeOverrideContainer() {
+ return this.attributeOverrideContainer;
+ }
+
+ protected JavaAttributeOverrideContainer buildAttributeOverrideContainer() {
+ return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, new AttributeOverrideContainerOwner());
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType();
+ return (superPersistentType == null) ? null : superPersistentType.getMapping();
+ }
+
+
+ // ********** association override container **********
+
+ public JavaAssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.associationOverrideContainer;
+ }
+
+ protected JavaAssociationOverrideContainer buildAssociationOverrideContainer() {
+ return this.getJpaFactory().buildJavaAssociationOverrideContainer(this, new AssociationOverrideContainerOwner());
+ }
+
+ @Override
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ // check for an override before looking at attribute mappings
+ AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ return (override != null) ? override.getRelationship() : super.resolveOverriddenRelationship(attributeName);
+ }
+
+
+ // ********** generator container **********
+
+ public JavaGeneratorContainer getGeneratorContainer() {
+ return this.generatorContainer;
+ }
+
+ protected JavaGeneratorContainer buildGeneratorContainer() {
+ return this.getJpaFactory().buildJavaGeneratorContainer(this, this);
+ }
+
+ public JavaResourcePersistentMember getResourceAnnotatedElement() {
+ return this.getResourcePersistentType();
+ }
+
+
+ // ********** query container **********
+
+ public JavaQueryContainer getQueryContainer() {
+ return this.queryContainer;
+ }
+
+ protected JavaQueryContainer buildQueryContainer() {
+ return this.getJpaFactory().buildJavaQueryContainer(this, this);
+ }
+
+
+ // ********** associated tables **********
+
+ @Override
+ public Iterator<ReadOnlyTable> associatedTables() {
+ return this.getAssociatedTables().iterator();
+ }
+
+ public Iterable<ReadOnlyTable> getAssociatedTables() {
+ return new CompositeIterable<ReadOnlyTable>(this.table, this.getSecondaryTables());
+ }
+
+ @Override
+ public Iterator<ReadOnlyTable> allAssociatedTables() {
+ return new CompositeIterator<ReadOnlyTable>(this.allAssociatedTablesLists());
+ }
+
+ public Iterable<ReadOnlyTable> getAllAssociatedTables() {
+ return CollectionTools.iterable(this.allAssociatedTables());
+ }
+
+ // TODO eliminate duplicate tables?
+ protected Iterator<Iterator<ReadOnlyTable>> allAssociatedTablesLists() {
+ return new TransformationIterator<TypeMapping, Iterator<ReadOnlyTable>>(this.inheritanceHierarchy(), TypeMappingTools.ASSOCIATED_TABLES_TRANSFORMER);
+ }
+
+ @Override
+ public Iterator<String> allAssociatedTableNames() {
+ return this.getAllAssociatedTableNames().iterator();
+ }
+
+ public Iterable<String> getAllAssociatedTableNames() {
+ return this.convertToNames(this.getAllAssociatedTables());
+ }
+
+ /**
+ * strip out <code>null</code> names
+ */
+ protected Iterable<String> convertToNames(Iterable<ReadOnlyTable> tables) {
+ return new FilteringIterable<String>(this.convertToNames_(tables), NotNullFilter.<String>instance());
+ }
+
+ protected Iterable<String> convertToNames_(Iterable<ReadOnlyTable> tables) {
+ return new TransformationIterable<ReadOnlyTable, String>(tables) {
+ @Override
+ protected String transform(ReadOnlyTable t) {
+ return t.getName();
+ }
+ };
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return ! this.tableNameIsValid(tableName);
+ }
+
+ protected boolean tableNameIsValid(String tableName) {
+ return this.tableIsUndefined || CollectionTools.contains(this.getAllAssociatedTableNames(), tableName);
+ }
+
+
+ // ********** database **********
+
+ @Override
+ public String getPrimaryTableName() {
+ return this.table.getName();
+ }
+
+ @Override
+ public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() {
+ return this.table.getDbTable();
+ }
+
+ @Override
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ // matching database objects and identifiers is database platform-specific
+ return this.getDataSource().selectDatabaseObjectForIdentifier(this.getAllAssociatedDbTables(), tableName);
+ }
+
+ /**
+ * strip out null db tables
+ */
+ protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables() {
+ return new FilteringIterable<org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedDbTables_(), NotNullFilter.<org.eclipse.jpt.jpa.db.Table>instance());
+ }
+
+ protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables_() {
+ return new TransformationIterable<ReadOnlyTable, org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedTables()) {
+ @Override
+ protected org.eclipse.jpt.jpa.db.Table transform(ReadOnlyTable entityTable) {
+ return entityTable.getDbTable();
+ }
+ };
+ }
+
+ @Override
+ public Schema getDbSchema() {
+ return this.table.getDbSchema();
+ }
+
+
+ // ********** primary key **********
+
+ public String getPrimaryKeyColumnName() {
+ return MappingTools.getPrimaryKeyColumnName(this);
+ }
+
+ public PersistentAttribute getIdAttribute() {
+ Iterator<AttributeMapping> idAttributeMappings = this.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY).iterator();
+ if (idAttributeMappings.hasNext()) {
+ PersistentAttribute attribute = idAttributeMappings.next().getPersistentAttribute();
+ return idAttributeMappings.hasNext() ? null /*more than one*/: attribute;
+ }
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ @Override
+ public JavaResourcePersistentType getResourcePersistentType() {
+ return super.getResourcePersistentType();
+ }
+
+
+ // ********** attribute mappings **********
+
+ @Override
+ public Column resolveOverriddenColumn(String attributeName) {
+ // check for an override before looking at attribute mappings
+ AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ return (override != null) ? override.getColumn() : super.resolveOverriddenColumn(attributeName);
+ }
+
+ @Override
+ public Iterator<String> overridableAttributeNames() {
+ return this.isTablePerClass() ?
+ super.overridableAttributeNames() :
+ EmptyIterator.<String>instance();
+ }
+
+ @Override
+ public Iterator<String> overridableAssociationNames() {
+ return this.isTablePerClass() ?
+ super.overridableAssociationNames() :
+ EmptyIterator.<String>instance();
+ }
+
+ public AttributeMapping resolveAttributeMapping(String name) {
+ for (AttributeMapping attributeMapping : CollectionTools.iterable(this.allAttributeMappings())) {
+ AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** inheritance **********
+
+ public Entity getParentEntity() {
+ for (TypeMapping typeMapping : this.getAncestors()) {
+ if (typeMapping instanceof Entity) {
+ return (Entity) typeMapping;
+ }
+ }
+ return null;
+ }
+
+ public boolean isRoot() {
+ return this == this.rootEntity;
+ }
+
+ /**
+ * Return whether the entity is a descendant in (as opposed to the root of)
+ * an inheritance hierarchy.
+ */
+ protected boolean isDescendant() {
+ return ! this.isRoot();
+ }
+
+ /**
+ * Return whether the entity is a descendant of the root entity
+ * of a "single table" inheritance hierarchy.
+ */
+ protected boolean isSingleTableDescendant() {
+ return this.isDescendant() &&
+ (this.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE);
+ }
+
+ /**
+ * Return whether the entity is the top of an inheritance hierarchy
+ * and has no descendants and no specified inheritance strategy has been defined.
+ */
+ protected boolean isRootNoDescendantsNoStrategyDefined() {
+ return this.isRoot() &&
+ this.descendants.isEmpty() &&
+ (this.specifiedInheritanceStrategy == null);
+ }
+
+ /**
+ * Return whether the entity is abstract and is a part of a
+ * "table per class" inheritance hierarchy.
+ */
+ protected boolean isAbstractTablePerClass() {
+ return this.isAbstract() && this.isTablePerClass();
+ }
+
+ /**
+ * Return whether the entity is a part of a "table per class"
+ * inheritance hierarchy.
+ */
+ protected boolean isTablePerClass() {
+ return this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS;
+ }
+
+ /**
+ * Return whether the entity is a part of a "table per class"
+ * inheritance hierarchy.
+ */
+ protected boolean isTablePerClassDescendant() {
+ return this.isTablePerClass() && this.isDescendant();
+ }
+
+ /**
+ * Return whether the type is abstract.
+ */
+ protected boolean isAbstract() {
+ return this.getResourcePersistentType().isAbstract();
+ }
+
+ /**
+ * Return whether the entity's type is final.
+ */
+ protected boolean isFinal() {
+ return this.getResourcePersistentType().isFinal();
+ }
+
+ /**
+ * Return whether the entity's type is a member of another type.
+ */
+ protected boolean isMember() {
+ return this.getResourcePersistentType().isMemberType();
+ }
+
+ /**
+ * Return whether the entity's type is static.
+ */
+ protected boolean isStatic() {
+ return this.getResourcePersistentType().isStatic();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.table.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaSecondaryTable secondaryTable : CollectionTools.iterable(this.secondaryTables())) {
+ result = secondaryTable.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (JavaPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
+ result = pkJoinColumn.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ result = this.attributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.associationOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.discriminatorColumn.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.generatorContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ this.validatePrimaryKey(messages, reporter, astRoot);
+ this.validateTable(messages, reporter, astRoot);
+ for (JavaSecondaryTable secondaryTable : this.getSecondaryTables()) {
+ secondaryTable.validate(messages, reporter, astRoot);
+ }
+ this.validateInheritance(messages, reporter, astRoot);
+ for (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
+ pkJoinColumn.validate(messages, reporter, astRoot);
+ }
+ this.generatorContainer.validate(messages, reporter, astRoot);
+ this.queryContainer.validate(messages, reporter, astRoot);
+ this.attributeOverrideContainer.validate(messages, reporter, astRoot);
+ this.associationOverrideContainer.validate(messages, reporter, astRoot);
+ this.validateEntityName(messages, reporter, astRoot);
+ this.validateDuplicateEntityNames(messages, reporter, astRoot);
+ }
+
+ @Override
+ public boolean validatesAgainstDatabase() {
+ return super.validatesAgainstDatabase() && ! this.isAbstractTablePerClass();
+ }
+
+ protected void validateEntityName(List<IMessage> messages,
+ IReporter reporter, CompilationUnit astRoot) {
+ if (StringTools.stringIsEmpty(this.getName())){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_NAME_MISSING,
+ new String[] {this.getPersistentType().getName()},
+ this,
+ this.getMappingAnnotation().getNameTextRange(astRoot)
+ )
+ );
+ }
+ }
+
+ protected void validateDuplicateEntityNames(List<IMessage> messages,
+ IReporter reporter, CompilationUnit astRoot) {
+ HashBag<String> javaEntityNamesExclOverridden = new HashBag<String>();
+ CollectionTools.addAll(javaEntityNamesExclOverridden, this.getPersistenceUnit().javaEntityNamesExclOverridden());
+ HashBag<String> ormEntityNames = new HashBag<String>();
+ CollectionTools.addAll(ormEntityNames, this.getPersistenceUnit().ormEntityNames());
+ String javaEntityName = this.getName();
+ if ((javaEntityName != null)
+ // Check whether or not this entity name has duplicates among
+ // the java entities that are not overridden by orm entities
+ && ((javaEntityNamesExclOverridden.count(javaEntityName) > 1)
+ //Check whether or not this entity name has duplicates
+ //with the names of orm entities
+ || (ormEntityNames.contains(javaEntityName)))) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_ENTITY_NAME_ATTRIBUTE_MISSING,
+ new String[] {javaEntityName},
+ this,
+ this.getMappingAnnotation().getNameTextRange(astRoot)
+ )
+ );
+ }
+ }
+
+ protected void validatePrimaryKey(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.buildPrimaryKeyValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) {
+ return new GenericEntityPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot));
+ }
+
+ @Override
+ protected EntityTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaEntityTextRangeResolver(this, astRoot);
+ }
+
+ protected void validateTable(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ if (this.isAbstractTablePerClass()) {
+ if (this.table.isSpecifiedInResource()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE,
+ new String[] {this.getName()},
+ this,
+ this.table.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ return;
+ }
+ if (this.isSingleTableDescendant()) {
+ if (this.table.isSpecifiedInResource()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE,
+ new String[] {this.getName()},
+ this,
+ this.table.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ return;
+ }
+ this.table.validate(messages, reporter, astRoot);
+ }
+
+ protected void validateInheritance(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.validateInheritanceStrategy(messages, astRoot);
+ this.validateDiscriminatorColumn(messages, reporter, astRoot);
+ this.validateDiscriminatorValue(messages, astRoot);
+ }
+
+ protected void validateDiscriminatorColumn(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ if (this.specifiedDiscriminatorColumnIsAllowed && ! this.discriminatorColumnIsUndefined) {
+ this.discriminatorColumn.validate(messages, reporter, astRoot);
+ }
+ else if (this.discriminatorColumn.isResourceSpecified()) {
+ if (this.isDescendant()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorColumnTextRange(astRoot)
+ )
+ );
+ }
+ else if (this.isTablePerClass()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorColumnTextRange(astRoot)
+ )
+ );
+ }
+ }
+ }
+
+ protected void validateDiscriminatorValue(List<IMessage> messages, CompilationUnit astRoot) {
+ if (this.discriminatorValueIsUndefined && (this.specifiedDiscriminatorValue != null)) {
+ if (this.isAbstract()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorValueTextRange(astRoot)
+ )
+ );
+ }
+ else if (this.isTablePerClass()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorValueTextRange(astRoot)
+ )
+ );
+ }
+ }
+ }
+
+ protected void validateInheritanceStrategy(List<IMessage> messages, CompilationUnit astRoot) {
+ Supported tablePerConcreteClassInheritanceIsSupported = this.getJpaPlatformVariation().getTablePerConcreteClassInheritanceIsSupported();
+ if (tablePerConcreteClassInheritanceIsSupported == Supported.YES) {
+ return;
+ }
+ if ((this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS) && this.isRoot()) {
+ if (tablePerConcreteClassInheritanceIsSupported == Supported.NO) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM,
+ new String[] {this.getName()},
+ this,
+ this.getInheritanceStrategyTextRange(astRoot)
+ )
+ );
+ }
+ else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM,
+ new String[] {this.getName()},
+ this,
+ this.getInheritanceStrategyTextRange(astRoot)
+ )
+ );
+ }
+ }
+ }
+
+ protected TextRange getDiscriminatorValueTextRange(CompilationUnit astRoot) {
+ return this.getDiscriminatorValueAnnotation().getTextRange(astRoot);
+ }
+
+ protected TextRange getDiscriminatorColumnTextRange(CompilationUnit astRoot) {
+ return this.discriminatorColumn.getValidationTextRange(astRoot);
+ }
+
+ protected TextRange getInheritanceStrategyTextRange(CompilationUnit astRoot) {
+ return this.getInheritanceAnnotation().getStrategyTextRange(astRoot);
+ }
+
+
+ // ********** OrmOverrideContainer.Owner implementation **********
+
+ /**
+ * some common behavior
+ */
+ protected abstract class OverrideContainerOwner
+ implements JavaOverrideContainer.Owner
+ {
+ public JavaResourcePersistentMember getResourcePersistentMember() {
+ return AbstractJavaEntity.this.getResourcePersistentType();
+ }
+
+ public JavaTypeMapping getTypeMapping() {
+ return AbstractJavaEntity.this;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return AbstractJavaEntity.this.getValidationTextRange(astRoot);
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractJavaEntity.this.getOverridableTypeMapping();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? this.allOverridableNames_(typeMapping) : EmptyIterator.<String>instance();
+ }
+
+ /**
+ * pre-condition: <code>typeMapping</code> is not <code>null</code>
+ */
+ protected abstract Iterator<String> allOverridableNames_(TypeMapping typeMapping);
+
+ public String getDefaultTableName() {
+ return AbstractJavaEntity.this.getPrimaryTableName();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return AbstractJavaEntity.this.tableNameIsInvalid(tableName);
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return AbstractJavaEntity.this.resolveDbTable(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return AbstractJavaEntity.this.allAssociatedTableNames();
+ }
+
+ public String getPossiblePrefix() {
+ return null;
+ }
+
+ public String getWritePrefix() {
+ return null;
+ }
+
+ // no maps, so all overrides are relevant
+ public boolean isRelevant(String overrideName) {
+ return true;
+ }
+
+ }
+
+
+ // ********** JavaAttributeOverrideContainer.Owner implementation **********
+
+ protected class AttributeOverrideContainerOwner
+ extends OverrideContainerOwner
+ implements JavaAttributeOverrideContainer.Owner
+ {
+ @Override
+ protected Iterator<String> allOverridableNames_(TypeMapping typeMapping) {
+ final Collection<String> mappedByRelationshipAttributes = CollectionTools.collection(
+ new TransformationIterator<SingleRelationshipMapping2_0, String>(this.getMapsIdRelationships()) {
+ @Override
+ protected String transform(SingleRelationshipMapping2_0 mapping) {
+ return mapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getValue();
+ }
+ });
+ return new FilteringIterator<String>(typeMapping.allOverridableAttributeNames()) {
+ @Override
+ protected boolean accept(String name) {
+ if (mappedByRelationshipAttributes.isEmpty()) {
+ return true;
+ }
+ // overridable names are (usually?) qualified with a container mapping,
+ // which may also be the one mapped by a relationship
+ int index = name.indexOf('.');
+ String qualifier = (index > 0) ? name.substring(0, index) : name;
+ return ! mappedByRelationshipAttributes.contains(qualifier);
+ }
+ };
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getMapsIdRelationships() {
+ return new FilteringIterable<SingleRelationshipMapping2_0>(this.getSingleRelationshipMappings()) {
+ @Override
+ protected boolean accept(SingleRelationshipMapping2_0 mapping) {
+ return mapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy();
+ }
+ };
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getSingleRelationshipMappings() {
+ return new SubIterableWrapper<AttributeMapping, SingleRelationshipMapping2_0>(this.getSingleRelationshipMappings_());
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<AttributeMapping> getSingleRelationshipMappings_() {
+ return new CompositeIterable<AttributeMapping>(
+ this.getTypeMapping().getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY),
+ this.getTypeMapping().getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)
+ );
+ }
+ public Column resolveOverriddenColumn(String attributeName) {
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
+ }
+ }
+
+
+ // ********** JavaAssociationOverrideContainer.Owner implementation **********
+
+ protected class AssociationOverrideContainerOwner
+ extends OverrideContainerOwner
+ implements JavaAssociationOverrideContainer.Owner
+ {
+ @Override
+ protected Iterator<String> allOverridableNames_(TypeMapping typeMapping) {
+ return typeMapping.allOverridableAssociationNames();
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table t, TableTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinTableValidator(override, (JoinTable) t, textRangeResolver);
+ }
+ }
+
+
+ // ********** JavaNamedColumn.Owner implementation **********
+
+ /**
+ * some common behavior
+ */
+ protected abstract class NamedColumnOwner
+ implements JavaNamedColumn.Owner
+ {
+ public TypeMapping getTypeMapping() {
+ return AbstractJavaEntity.this;
+ }
+
+ public String getDefaultTableName() {
+ return AbstractJavaEntity.this.getPrimaryTableName();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return AbstractJavaEntity.this.resolveDbTable(tableName);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return AbstractJavaEntity.this.getValidationTextRange(astRoot);
+ }
+ }
+
+
+ // ********** JavaBaseJoinColumn.Owner implementation **********
+
+ protected class PrimaryKeyJoinColumnOwner
+ extends NamedColumnOwner
+ implements JavaBaseJoinColumn.Owner
+ {
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ Entity parentEntity = AbstractJavaEntity.this.getParentEntity();
+ return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return AbstractJavaEntity.this.primaryKeyJoinColumnsSize();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return AbstractJavaEntity.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public String getDefaultColumnName() {
+ if (this.joinColumnsSize() != 1) {
+ return null;
+ }
+ Entity parentEntity = AbstractJavaEntity.this.getParentEntity();
+ return (parentEntity == null) ? AbstractJavaEntity.this.getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new EntityPrimaryKeyJoinColumnValidator((BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+
+
+ // ********** JavaDiscriminatorColumn.Owner implementation **********
+
+ protected class DiscriminatorColumnOwner
+ extends NamedColumnOwner
+ implements JavaDiscriminatorColumn.Owner
+ {
+ public String getDefaultColumnName() {
+ return this.isDescendant() ?
+ this.getRootDiscriminatorColumn().getName() :
+ this.discriminatorColumnIsUndefined() ? null : DiscriminatorColumn.DEFAULT_NAME;
+ }
+
+ public int getDefaultLength() {
+ return this.isDescendant() ?
+ this.getRootDiscriminatorColumn().getLength() :
+ this.discriminatorColumnIsUndefined() ? 0 : DiscriminatorColumn.DEFAULT_LENGTH;
+ }
+
+ public DiscriminatorType getDefaultDiscriminatorType() {
+ return this.isDescendant() ?
+ this.getRootDiscriminatorColumn().getDiscriminatorType() :
+ this.discriminatorColumnIsUndefined() ? null : DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
+ }
+
+ protected boolean isDescendant() {
+ return AbstractJavaEntity.this.isDescendant();
+ }
+
+ protected DiscriminatorColumn getRootDiscriminatorColumn() {
+ return AbstractJavaEntity.this.rootEntity.getDiscriminatorColumn();
+ }
+
+ protected boolean discriminatorColumnIsUndefined() {
+ return AbstractJavaEntity.this.discriminatorColumnIsUndefined;
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new DiscriminatorColumnValidator(column, textRangeResolver);
+ }
+ }
+
+
+ // ********** table owner **********
+
+ protected class TableOwner implements Table.Owner {
+ public JptValidator buildTableValidator(Table t, TableTextRangeResolver textRangeResolver) {
+ return new TableValidator(t, textRangeResolver);
+ }
+ }
+
+
+ // ********** secondary table owner **********
+
+ protected class SecondaryTableOwner implements Table.Owner {
+ public JptValidator buildTableValidator(Table t, TableTextRangeResolver textRangeResolver) {
+ return new SecondaryTableValidator((SecondaryTable) t, textRangeResolver);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java
new file mode 100644
index 0000000000..cc79849d49
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.java.JavaGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * Java sequence or table generator
+ */
+public abstract class AbstractJavaGenerator<A extends GeneratorAnnotation>
+ extends AbstractJavaJpaContextNode
+ implements JavaGenerator
+{
+ protected final A generatorAnnotation;
+
+ protected String name;
+
+ protected Integer specifiedInitialValue;
+ protected int defaultInitialValue;
+
+ protected Integer specifiedAllocationSize;
+ protected int defaultAllocationSize;
+
+
+ protected AbstractJavaGenerator(JavaJpaContextNode parent, A generatorAnnotation) {
+ super(parent);
+ this.generatorAnnotation = generatorAnnotation;
+ this.name = generatorAnnotation.getName();
+ this.specifiedInitialValue = generatorAnnotation.getInitialValue();
+ this.specifiedAllocationSize = generatorAnnotation.getAllocationSize();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.generatorAnnotation.getName());
+ this.setSpecifiedInitialValue_(this.generatorAnnotation.getInitialValue());
+ this.setSpecifiedAllocationSize_(this.generatorAnnotation.getAllocationSize());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultInitialValue(this.buildDefaultInitialValue());
+ this.setDefaultAllocationSize(this.buildDefaultAllocationSize());
+ this.getPersistenceUnit().addGenerator(this);
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.generatorAnnotation.setName(name);
+ this.setName_(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** initial value **********
+
+ public int getInitialValue() {
+ return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue;
+ }
+
+ public Integer getSpecifiedInitialValue() {
+ return this.specifiedInitialValue;
+ }
+
+ public void setSpecifiedInitialValue(Integer value) {
+ this.generatorAnnotation.setInitialValue(value);
+ this.setSpecifiedInitialValue_(value);
+ }
+
+ protected void setSpecifiedInitialValue_(Integer value) {
+ Integer old = this.specifiedInitialValue;
+ this.specifiedInitialValue = value;
+ this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, value);
+ }
+
+ public int getDefaultInitialValue() {
+ return this.defaultInitialValue;
+ }
+
+ protected void setDefaultInitialValue(int value) {
+ int old = this.defaultInitialValue;
+ this.defaultInitialValue = value;
+ this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, value);
+ }
+
+ protected abstract int buildDefaultInitialValue();
+
+
+ // ********** allocation size **********
+
+ public int getAllocationSize() {
+ return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize;
+ }
+
+ public Integer getSpecifiedAllocationSize() {
+ return this.specifiedAllocationSize;
+ }
+
+ public void setSpecifiedAllocationSize(Integer size) {
+ this.generatorAnnotation.setAllocationSize(size);
+ this.setSpecifiedAllocationSize_(size);
+ }
+
+ protected void setSpecifiedAllocationSize_(Integer size) {
+ Integer old = this.specifiedAllocationSize;
+ this.specifiedAllocationSize = size;
+ this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, size);
+ }
+
+ public int getDefaultAllocationSize() {
+ return this.defaultAllocationSize;
+ }
+
+ protected void setDefaultAllocationSize(int size) {
+ int old = this.defaultAllocationSize;
+ this.defaultAllocationSize = size;
+ this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, size);
+ }
+
+ protected int buildDefaultAllocationSize() {
+ return DEFAULT_ALLOCATION_SIZE;
+ }
+
+
+ // ********** text ranges **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getSelectionTextRange(astRoot);
+ }
+
+ public TextRange getSelectionTextRange(CompilationUnit astRoot) {
+ return this.generatorAnnotation.getTextRange(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.generatorAnnotation.getNameTextRange(astRoot);
+ }
+
+
+ // ********** database stuff **********
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ protected abstract String getSchema();
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ protected abstract String getCatalog();
+
+
+ // ********** JpaNamedContextNode implementation **********
+
+ public boolean overrides(Generator other) {
+ return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST);
+ }
+
+ public boolean duplicates(Generator other) {
+ return MappingTools.nodesAreDuplicates(this, other);
+ }
+
+
+ // ********** misc **********
+
+ public A getGeneratorAnnotation() {
+ return this.generatorAnnotation;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java
new file mode 100644
index 0000000000..ac83d194a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java
@@ -0,0 +1,476 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.Association;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.IdMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java ID mapping
+ */
+public abstract class AbstractJavaIdMapping
+ extends AbstractJavaAttributeMapping<IdAnnotation>
+ implements JavaIdMapping, IdMapping2_0
+{
+ protected final JavaColumn column;
+
+ protected final JavaGeneratorContainer generatorContainer;
+
+ protected JavaGeneratedValue generatedValue;
+
+ protected JavaConverter converter; // never null
+
+ /* 2.0 feature - a relationship may map this id */
+ protected boolean mappedByRelationship;
+
+
+ protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] {
+ JavaTemporalConverter.Adapter.instance(),
+ };
+ protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractJavaIdMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.column = this.buildColumn();
+ this.generatorContainer = this.buildGeneratorContainer();
+ this.generatedValue = this.buildGeneratedValue();
+ this.converter = this.buildConverter();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ this.generatorContainer.synchronizeWithResourceModel();
+ this.syncGeneratedValue();
+ this.syncConverter();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ this.generatorContainer.update();
+ if (this.generatedValue != null) {
+ this.generatedValue.update();
+ }
+ this.converter.update();
+ this.setMappedByRelationship(this.buildMappedByRelationship());
+ }
+
+
+ // ********** column **********
+
+ public JavaColumn getColumn() {
+ return this.column;
+ }
+
+ protected JavaColumn buildColumn() {
+ return this.getJpaFactory().buildJavaColumn(this, this);
+ }
+
+
+ // ********** generator container **********
+
+ public JavaGeneratorContainer getGeneratorContainer() {
+ return this.generatorContainer;
+ }
+
+ private JavaGeneratorContainer buildGeneratorContainer() {
+ return this.getJpaFactory().buildJavaGeneratorContainer(this, this);
+ }
+
+
+ // ********** generated value **********
+
+ public JavaGeneratedValue getGeneratedValue() {
+ return this.generatedValue;
+ }
+
+ public JavaGeneratedValue addGeneratedValue() {
+ if (this.generatedValue != null) {
+ throw new IllegalStateException("generated value already exists: " + this.generatedValue); //$NON-NLS-1$
+ }
+ GeneratedValueAnnotation annotation = this.buildGeneratedValueAnnotation();
+ JavaGeneratedValue value = this.buildGeneratedValue(annotation);
+ this.setGeneratedValue(value);
+ return value;
+ }
+
+ protected GeneratedValueAnnotation buildGeneratedValueAnnotation() {
+ return (GeneratedValueAnnotation) this.getResourcePersistentAttribute().addAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeGeneratedValue() {
+ if (this.generatedValue == null) {
+ throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$
+ }
+ this.getResourcePersistentAttribute().removeAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
+ this.setGeneratedValue(null);
+ }
+
+ protected JavaGeneratedValue buildGeneratedValue() {
+ GeneratedValueAnnotation annotation = this.getGeneratedValueAnnotation();
+ return (annotation == null) ? null : this.buildGeneratedValue(annotation);
+ }
+
+ protected GeneratedValueAnnotation getGeneratedValueAnnotation() {
+ return (GeneratedValueAnnotation) this.getResourcePersistentAttribute().getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
+ }
+
+ protected JavaGeneratedValue buildGeneratedValue(GeneratedValueAnnotation generatedValueAnnotation) {
+ return this.getJpaFactory().buildJavaGeneratedValue(this, generatedValueAnnotation);
+ }
+
+ protected void syncGeneratedValue() {
+ GeneratedValueAnnotation annotation = this.getGeneratedValueAnnotation();
+ if (annotation == null) {
+ if (this.generatedValue != null) {
+ this.setGeneratedValue(null);
+ }
+ }
+ else {
+ if ((this.generatedValue != null) && (this.generatedValue.getGeneratedValueAnnotation() == annotation)) {
+ this.generatedValue.synchronizeWithResourceModel();
+ } else {
+ this.setGeneratedValue(this.buildGeneratedValue(annotation));
+ }
+ }
+ }
+
+ protected void setGeneratedValue(JavaGeneratedValue value) {
+ JavaGeneratedValue old = this.generatedValue;
+ this.generatedValue = value;
+ this.firePropertyChanged(GENERATED_VALUE_PROPERTY, old, value);
+ }
+
+
+ // ********** converter **********
+
+ public JavaConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ this.converter.dispose();
+ JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.retainConverterAnnotation(converterAdapter);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ }
+ }
+
+ protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getJpaFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(JavaConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ /**
+ * Clear all the converter annotations <em>except</em> for the annotation
+ * corresponding to the specified adapter. If the specified adapter is
+ * <code>null</code>, remove <em>all</em> the converter annotations.
+ */
+ protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter != converterAdapter) {
+ adapter.removeConverterAnnotation(resourceAttribute);
+ }
+ }
+ }
+
+ protected JavaConverter buildConverter() {
+ JpaFactory jpaFactory = this.getJpaFactory();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory);
+ if (javaConverter != null) {
+ return javaConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ Association<JavaConverter.Adapter, Annotation> assoc = this.getConverterAnnotation();
+ if (assoc == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ JavaConverter.Adapter adapter = assoc.getKey();
+ Annotation annotation = assoc.getValue();
+ if ((this.converter.getType() == adapter.getConverterType()) &&
+ (this.converter.getConverterAnnotation() == annotation)) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first converter annotation we find along with its corresponding
+ * adapter. Return <code>null</code> if there are no converter annotations.
+ */
+ protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
+ if (annotation != null) {
+ return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation);
+ }
+ }
+ return null;
+ }
+
+ protected JavaConverter buildNullConverter() {
+ return new NullJavaConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected JavaConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<JavaConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** mapped by relationship **********
+
+ public boolean isMappedByRelationship() {
+ return this.mappedByRelationship;
+ }
+
+ protected void setMappedByRelationship(boolean mappedByRelationship) {
+ boolean old = this.mappedByRelationship;
+ this.mappedByRelationship = mappedByRelationship;
+ this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, mappedByRelationship);
+ }
+
+ protected boolean buildMappedByRelationship() {
+ return this.isJpa2_0Compatible() && this.buildMappedByRelationship_();
+ }
+
+ protected boolean buildMappedByRelationship_() {
+ return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.getName());
+ }
+
+ protected Iterable<String> getMappedByRelationshipAttributeNames() {
+ return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return IdAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ public String getPrimaryKeyColumnName() {
+ return this.column.getName();
+ }
+
+ protected boolean columnIsSpecified() {
+ return this.getResourcePersistentAttribute().getAnnotation(ColumnAnnotation.ANNOTATION_NAME) != null;
+ }
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+
+ // ********** JavaGeneratorContainer implementation **********
+
+ public JavaResourcePersistentMember getResourceAnnotatedElement() {
+ return this.getResourcePersistentAttribute();
+ }
+
+
+ // ********** JavaColumn.Owner implementation **********
+
+ public ColumnAnnotation getColumnAnnotation() {
+ return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeColumnAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ public String getDefaultColumnName() {
+ return (this.mappedByRelationship && ! this.columnIsSpecified()) ? null : this.getName();
+ }
+
+ public String getDefaultTableName() {
+ return (this.mappedByRelationship && ! this.columnIsSpecified()) ? null : this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.generatorContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ if (this.generatedValue != null) {
+ result = this.generatedValue.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+
+ result = this.converter.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ // [JPA 2.0] if the column is specified, or if the id is not mapped by a relationship,
+ // then the column is validated.
+ // (In JPA 1.0, the column will always be validated, since the id is never mapped by a
+ // relationship)
+ if (this.columnIsSpecified() || ! this.mappedByRelationship) {
+ this.column.validate(messages, reporter, astRoot);
+ }
+
+ // [JPA 2.0] if the column is specified and the id is mapped by a relationship,
+ // then that is an error
+ // (In JPA 1.0, this will never be the case, since the id is never mapped by a relationship)
+ if (this.columnIsSpecified() && this.mappedByRelationship) {
+ messages.add(
+ this.buildMessage(
+ JpaValidationMessages.ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ this.column.getValidationTextRange(astRoot)
+ )
+ );
+ }
+
+ this.generatorContainer.validate(messages, reporter, astRoot);
+ if (this.generatedValue != null) {
+ this.generatedValue.validate(messages, reporter, astRoot);
+ }
+ this.converter.validate(messages, reporter, astRoot);
+ }
+
+ protected IMessage buildMessage(String msgID, String[] parms, TextRange textRange) {
+ String attributeDescription = NLS.bind(JpaValidationDescriptionMessages.ATTRIBUTE_DESC, this.getPersistentAttribute().getName());
+ parms = ArrayTools.add(parms, 0, attributeDescription);
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ parms,
+ this,
+ textRange
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java
new file mode 100644
index 0000000000..1ba4b92315
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+public abstract class AbstractJavaIdMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ protected AbstractJavaIdMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return IdAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ ColumnAnnotation.ANNOTATION_NAME,
+ GeneratedValueAnnotation.ANNOTATION_NAME,
+ TemporalAnnotation.ANNOTATION_NAME,
+ TableGeneratorAnnotation.ANNOTATION_NAME,
+ SequenceGeneratorAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaIdMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..b133a319f7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
@@ -0,0 +1,348 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractJavaJoinColumnRelationshipStrategy
+ extends AbstractJavaJpaContextNode
+ implements JavaJoinColumnRelationshipStrategy
+{
+ protected final Vector<JavaJoinColumn> specifiedJoinColumns = new Vector<JavaJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final JavaJoinColumn.Owner joinColumnOwner;
+
+ protected JavaJoinColumn defaultJoinColumn;
+
+
+ protected AbstractJavaJoinColumnRelationshipStrategy(JavaJoinColumnRelationship parent) {
+ super(parent);
+ this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ this.initializeSpecifiedJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedJoinColumns();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedJoinColumns());
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<JavaJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<JavaJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public JavaJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ public JavaJoinColumn addSpecifiedJoinColumn() {
+ return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ }
+
+ public JavaJoinColumn addSpecifiedJoinColumn(int index) {
+ JoinColumnAnnotation annotation = this.addJoinColumnAnnotation(index);
+ return this.addSpecifiedJoinColumn_(index, annotation);
+ }
+
+ public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ this.removeJoinColumnAnnotation(index);
+ this.removeSpecifiedJoinColumn_(index);
+ }
+
+ protected void removeSpecifiedJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ this.moveJoinColumnAnnotation(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected void initializeSpecifiedJoinColumns() {
+ for (JoinColumnAnnotation joinColumnAnnotation : this.getJoinColumnAnnotations()) {
+ this.specifiedJoinColumns.add(this.buildJoinColumn(joinColumnAnnotation));
+ }
+ }
+
+ protected void syncSpecifiedJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
+ return CollectionTools.iterable(this.joinColumnAnnotations());
+ }
+
+ protected void moveSpecifiedJoinColumn_(int index, JavaJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaJoinColumn addSpecifiedJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) {
+ JavaJoinColumn joinColumn = this.buildJoinColumn(joinColumnAnnotation);
+ this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
+ return new SpecifiedJoinColumnContainerAdapter();
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaJoinColumn, JoinColumnAnnotation>
+ {
+ public Iterable<JavaJoinColumn> getContextElements() {
+ return AbstractJavaJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<JoinColumnAnnotation> getResourceElements() {
+ return AbstractJavaJoinColumnRelationshipStrategy.this.getJoinColumnAnnotations();
+ }
+ public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
+ return contextElement.getColumnAnnotation();
+ }
+ public void moveContextElement(int index, JavaJoinColumn element) {
+ AbstractJavaJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, JoinColumnAnnotation resourceElement) {
+ AbstractJavaJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(JavaJoinColumn element) {
+ AbstractJavaJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn_(element);
+ }
+ }
+
+ protected abstract JavaJoinColumn.Owner buildJoinColumnOwner();
+
+
+ // ********** default join column **********
+
+ public JavaJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(JavaJoinColumn joinColumn) {
+ JavaJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<JavaJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<JavaJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<JavaJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ if (this.buildsDefaultJoinColumn()) {
+ if (this.defaultJoinColumn == null) {
+ this.setDefaultJoinColumn(this.buildJoinColumn(this.buildNullJoinColumnAnnotation()));
+ } else {
+ this.defaultJoinColumn.update();
+ }
+ } else {
+ this.setDefaultJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultJoinColumn() {
+ return ! this.hasSpecifiedJoinColumns() &&
+ this.getRelationship().mayHaveDefaultJoinColumn();
+ }
+
+
+ // ********** join column annotations **********
+
+ protected abstract Iterator<JoinColumnAnnotation> joinColumnAnnotations();
+
+ protected abstract JoinColumnAnnotation addJoinColumnAnnotation(int index);
+
+ protected abstract void removeJoinColumnAnnotation(int index);
+
+ protected abstract void moveJoinColumnAnnotation(int targetIndex, int sourceIndex);
+
+ protected abstract JoinColumnAnnotation buildNullJoinColumnAnnotation();
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaJoinColumnRelationship getParent() {
+ return (JavaJoinColumnRelationship) super.getParent();
+ }
+
+ public JavaJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnAnnotation) {
+ return this.getJpaFactory().buildJavaJoinColumn(this, this.joinColumnOwner, joinColumnAnnotation);
+ }
+
+ public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldStrategy.specifiedJoinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
+ }
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) {
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualStrategy.joinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
+ }
+ }
+
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ public String getTableName() {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping == null) ? null : typeMapping.getPrimaryTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping == null) ? null : typeMapping.resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping != null) && typeMapping.tableNameIsInvalid(tableName);
+ }
+
+ // subclasses like this to be public
+ public Table getReferencedColumnDbTable() {
+ TypeMapping relationshipTarget = this.getRelationshipTarget();
+ return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
+ }
+
+ protected Iterator<String> candidateTableNames() {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping != null) ? typeMapping.allAssociatedTableNames() : EmptyIterator.<String>instance();
+ }
+
+ public void addStrategy() {
+ if (this.specifiedJoinColumnsSize() == 0) {
+ this.addSpecifiedJoinColumn();
+ }
+ }
+
+ public void removeStrategy() {
+ for (int i = this.specifiedJoinColumns.size(); i-- > 0; ) {
+ this.removeSpecifiedJoinColumn(i);
+ }
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaJoinColumn joinColumn : this.getJoinColumns()) {
+ result = joinColumn.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ for (JavaJoinColumn joinColumn : this.getJoinColumns()) {
+ joinColumn.validate(messages, reporter, astRoot);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..6eafead62c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractJavaJoinTableRelationshipStrategy
+ extends AbstractJavaJpaContextNode
+ implements JavaJoinTableRelationshipStrategy, Table.Owner
+{
+ protected JavaJoinTable joinTable;
+
+
+ protected AbstractJavaJoinTableRelationshipStrategy(JavaJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ if (this.joinTable != null) {
+ this.joinTable.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinTable();
+ }
+
+
+ // ********** join table **********
+
+ public JavaJoinTable getJoinTable() {
+ return this.joinTable;
+ }
+
+ protected void setJoinTable(JavaJoinTable joinTable) {
+ JavaJoinTable old = this.joinTable;
+ this.joinTable = joinTable;
+ this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable);
+ }
+
+ protected void updateJoinTable() {
+ if (this.buildsJoinTable()) {
+ if (this.joinTable == null) {
+ this.setJoinTable(this.buildJoinTable());
+ } else {
+ this.joinTable.update();
+ }
+ } else {
+ if (this.joinTable != null) {
+ this.setJoinTable(null);
+ }
+ }
+ }
+
+ /**
+ * The strategy can have a join table if either the table annotation is present
+ * or the [mapping] relationship supports a default join table.
+ */
+ protected boolean buildsJoinTable() {
+ return this.getJoinTableAnnotation().isSpecified()
+ || this.getRelationship().mayHaveDefaultJoinTable();
+ }
+
+ protected JavaJoinTable buildJoinTable() {
+ return this.getJpaFactory().buildJavaJoinTable(this, this);
+ }
+
+
+ // ********** join table annotation **********
+
+ protected abstract JoinTableAnnotation addJoinTableAnnotation();
+
+ protected abstract void removeJoinTableAnnotation();
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaJoinTableRelationship getParent() {
+ return (JavaJoinTableRelationship) super.getParent();
+ }
+
+ public JavaJoinTableRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) {
+ ReadOnlyJoinTable oldJoinTable = oldStrategy.getJoinTable();
+ if (oldJoinTable != null) {
+ this.addStrategy();
+ this.joinTable.initializeFrom(oldJoinTable);
+ }
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) {
+ ReadOnlyJoinTable oldJoinTable = virtualStrategy.getJoinTable();
+ if (oldJoinTable != null) {
+ this.addStrategy();
+ this.joinTable.initializeFromVirtual(oldJoinTable);
+ }
+ }
+
+ public String getTableName() {
+ return (this.joinTable == null) ? null : this.joinTable.getName();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return (this.joinTable == null) ? null : this.joinTable.getDbTable();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getTableName(), tableName);
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE;
+ }
+
+ public String getJoinTableDefaultName() {
+ return MappingTools.buildJoinTableDefaultName(this.getRelationship());
+ }
+
+ public void addStrategy() {
+ if (this.joinTable == null) {
+ this.addJoinTableAnnotation();
+ this.setJoinTable(this.buildJoinTable());
+ }
+ }
+
+ public void removeStrategy() {
+ if (this.joinTable != null) {
+ this.removeJoinTableAnnotation();
+ this.setJoinTable(null);
+ }
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.joinTable != null) {
+ result = this.joinTable.javaCompletionProposals(pos, filter, astRoot);
+ }
+ return result;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ if (this.joinTable != null) {
+ this.joinTable.validate(messages, reporter, astRoot);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java
new file mode 100644
index 0000000000..92643cc26a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractJavaJpaContextNode
+ extends AbstractJpaContextNode
+ implements JavaJpaContextNode
+{
+ protected AbstractJavaJpaContextNode(JpaContextNode parent) {
+ super(parent);
+ }
+
+ @Override
+ public JptResourceType getResourceType() {
+ return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ }
+
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ if (this.connectionProfileIsActive()) {
+ Iterator<String> result = this.connectedJavaCompletionProposals(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 #javaCompletionProposals(int, Filter, CompilationUnit).
+ */
+ @SuppressWarnings("unused")
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ********** validation **********
+
+ /**
+ * All subclass implementations
+ * should be preceded by a "super" call to this method.
+ */
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ if (reporter.isCancelled()) {
+ throw new ValidationCancelledException();
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java
new file mode 100644
index 0000000000..22c5d8c9e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToManyMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
+
+public abstract class AbstractJavaManyToManyMapping
+ extends AbstractJavaMultiRelationshipMapping<ManyToManyAnnotation>
+ implements JavaManyToManyMapping2_0
+{
+ protected AbstractJavaManyToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ public JavaManyToManyRelationship getRelationship() {
+ return (JavaManyToManyRelationship) super.getRelationship();
+ }
+
+ @Override
+ protected JavaMappingRelationship buildRelationship() {
+ return new GenericJavaManyToManyRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return ManyToManyAnnotation.ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java
new file mode 100644
index 0000000000..9677d6b81e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
+
+public abstract class AbstractJavaManyToManyMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ protected AbstractJavaManyToManyMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return ManyToManyAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ JoinTableAnnotation.ANNOTATION_NAME,
+ MapKeyAnnotation.ANNOTATION_NAME,
+ OrderByAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaManyToManyMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java
new file mode 100644
index 0000000000..42a93b9b37
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToOneMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
+
+public abstract class AbstractJavaManyToOneMapping
+ extends AbstractJavaSingleRelationshipMapping<ManyToOneAnnotation>
+ implements JavaManyToOneMapping2_0
+{
+ protected AbstractJavaManyToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ public JavaManyToOneRelationship getRelationship() {
+ return (JavaManyToOneRelationship) super.getRelationship();
+ }
+
+ @Override
+ protected JavaManyToOneRelationship buildRelationship() {
+ return new GenericJavaManyToOneRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return ManyToOneAnnotation.ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java
new file mode 100644
index 0000000000..9534ff5126
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
+
+public abstract class AbstractJavaManyToOneMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ protected AbstractJavaManyToOneMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return ManyToOneAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ JoinTableAnnotation.ANNOTATION_NAME,
+ JoinColumnAnnotation.ANNOTATION_NAME,
+ JoinColumnsAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaManyToOneMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java
new file mode 100644
index 0000000000..b4255f5a56
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java mapped superclass
+ */
+public abstract class AbstractJavaMappedSuperclass
+ extends AbstractJavaTypeMapping<MappedSuperclassAnnotation>
+ implements JavaMappedSuperclass
+{
+ protected final JavaIdClassReference idClassReference;
+
+
+ protected AbstractJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ this.idClassReference = this.buildIdClassReference();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.idClassReference.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.idClassReference.update();
+ }
+
+
+ // ********** id class **********
+
+ public JavaIdClassReference getIdClassReference() {
+ return this.idClassReference;
+ }
+
+ protected JavaIdClassReference buildIdClassReference() {
+ return new GenericJavaIdClassReference(this);
+ }
+
+ public JavaPersistentType getIdClass() {
+ return this.idClassReference.getIdClass();
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validatePrimaryKey(messages, reporter, astRoot);
+ }
+
+ @Override
+ public boolean validatesAgainstDatabase() {
+ return false;
+ }
+
+ protected void validatePrimaryKey(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.buildPrimaryKeyValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) {
+ return new GenericMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot));
+ // TODO - JPA 2.0 validation
+ }
+
+ @Override
+ protected PrimaryKeyTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaMappedSuperclassTextRangeResolver(this, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java
new file mode 100644
index 0000000000..852474ce29
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
+
+/**
+ * <strong>NB:</strong> Subclasses may want to set the {@link #strategy} at the
+ * end of their constructors; otherwise, it will be <code>null</code> until it
+ * is set during {@link #update()}.
+ */
+public abstract class AbstractJavaMappingRelationship<M extends JavaRelationshipMapping>
+ extends AbstractJavaJpaContextNode
+ implements JavaMappingRelationship
+{
+ protected JavaRelationshipStrategy strategy;
+
+
+ public AbstractJavaMappingRelationship(M parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateStrategy();
+ }
+
+
+ // ********** strategy **********
+
+ public JavaRelationshipStrategy getStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(JavaRelationshipStrategy strategy) {
+ RelationshipStrategy old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected abstract JavaRelationshipStrategy buildStrategy();
+
+ /**
+ * This is called by subclasses when the various supported strategies are
+ * added or removed; allowing the strategy to be set synchronously. (?)
+ */
+ protected void updateStrategy() {
+ this.setStrategy(this.buildStrategy());
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeFrom(ReadOnlyRelationship oldRelationship) {
+ oldRelationship.initializeOn(this);
+ }
+
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ // NOP
+ }
+
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ // NOP
+ }
+
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ // NOP
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public M getParent() {
+ return (M) super.getParent();
+ }
+
+ public JavaRelationshipMapping getMapping() {
+ return this.getParent();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getMapping().getTypeMapping();
+ }
+
+ public Entity getEntity() {
+ TypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public boolean isOverridable() {
+ return this.strategy.isOverridable();
+ }
+
+ public boolean isVirtual() {
+ return this.getMapping().getPersistentAttribute().isVirtual();
+ }
+
+ public boolean isTargetForeignKey() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getMapping().getValidationTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
new file mode 100644
index 0000000000..bb0e245fe8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
@@ -0,0 +1,780 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaMultiRelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaMapKeyColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java multi-relationship (m:m, 1:m) mapping
+ */
+public abstract class AbstractJavaMultiRelationshipMapping<A extends RelationshipMappingAnnotation>
+ extends AbstractJavaRelationshipMapping<A>
+ implements JavaMultiRelationshipMapping, JavaCollectionMapping2_0
+{
+ protected final JavaOrderable orderable;
+
+ protected String specifiedMapKey;
+ protected boolean noMapKey = false;
+ protected boolean pkMapKey = false;
+ protected boolean customMapKey = false;
+
+ protected String specifiedMapKeyClass;
+ protected String defaultMapKeyClass;
+ protected String fullyQualifiedMapKeyClass;
+
+ protected Type valueType;
+ protected Type keyType;
+
+ protected final JavaColumn mapKeyColumn;
+
+ protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer;
+
+
+ protected AbstractJavaMultiRelationshipMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.orderable = this.buildOrderable();
+
+ this.specifiedMapKey = this.buildSpecifiedMapKey();
+ this.noMapKey = this.buildNoMapKey();
+ this.pkMapKey = this.buildPkMapKey();
+ this.customMapKey = this.buildCustomMapKey();
+
+ this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
+
+ this.mapKeyColumn = this.buildMapKeyColumn();
+ this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.orderable.synchronizeWithResourceModel();
+
+ this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
+ this.setNoMapKey_(this.buildNoMapKey());
+ this.setPkMapKey_(this.buildPkMapKey());
+ this.setCustomMapKey_(this.buildCustomMapKey());
+
+ this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
+
+ this.mapKeyColumn.synchronizeWithResourceModel();
+
+ this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.orderable.update();
+
+ this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
+ this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass());
+
+ this.setValueType(this.buildValueType());
+ this.setKeyType(this.buildKeyType());
+
+ this.mapKeyColumn.update();
+
+ this.mapKeyAttributeOverrideContainer.update();
+ }
+
+
+ // ********** orderable **********
+
+ public JavaOrderable getOrderable() {
+ return this.orderable;
+ }
+
+ protected JavaOrderable buildOrderable() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaOrderable(this, this.buildOrderableOwner()) :
+ this.getJpaFactory().buildJavaOrderable(this);
+ }
+
+ protected Orderable2_0.Owner buildOrderableOwner() {
+ return new OrderableOwner();
+ }
+
+ protected class OrderableOwner
+ implements Orderable2_0.Owner
+ {
+ public String getTableName() {
+ return this.getRelationshipStrategy().getTableName();
+ }
+ public Table resolveDbTable(String tableName) {
+ return this.getRelationshipStrategy().resolveDbTable(tableName);
+ }
+ protected JavaRelationshipStrategy getRelationshipStrategy() {
+ return AbstractJavaMultiRelationshipMapping.this.getRelationship().getStrategy();
+ }
+ }
+
+
+ // ********** map key **********
+
+ public String getMapKey() {
+ if (this.noMapKey) {
+ return null;
+ }
+ if (this.pkMapKey) {
+ return this.getTargetEntityIdAttributeName();
+ }
+ if (this.customMapKey) {
+ return this.specifiedMapKey;
+ }
+ throw new IllegalStateException("unknown map key"); //$NON-NLS-1$
+ }
+
+
+ // ********** specified map key **********
+
+ public String getSpecifiedMapKey() {
+ return this.specifiedMapKey;
+ }
+
+ public void setSpecifiedMapKey(String mapKey) {
+ if (mapKey != null) {
+ this.getMapKeyAnnotationForUpdate().setName(mapKey);
+
+ this.setSpecifiedMapKey_(mapKey);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(true);
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setSpecifiedMapKey_(String mapKey) {
+ String old = this.specifiedMapKey;
+ this.specifiedMapKey = mapKey;
+ this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
+ }
+
+ protected String buildSpecifiedMapKey() {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation == null) ? null : mapKeyAnnotation.getName();
+ }
+
+
+ // ********** no map key **********
+
+ public boolean isNoMapKey() {
+ return this.noMapKey;
+ }
+
+ public void setNoMapKey(boolean noMapKey) {
+ if (noMapKey) {
+ if (this.getMapKeyAnnotation() != null) {
+ this.removeMapKeyAnnotation();
+ }
+
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(true);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(false);
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setNoMapKey_(boolean noMapKey) {
+ boolean old = this.noMapKey;
+ this.noMapKey = noMapKey;
+ this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
+ }
+
+ protected boolean buildNoMapKey() {
+ return this.getMapKeyAnnotation() == null;
+ }
+
+
+ // ********** pk map key **********
+
+ public boolean isPkMapKey() {
+ return this.pkMapKey;
+ }
+
+ public void setPkMapKey(boolean pkMapKey) {
+ if (pkMapKey) {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ if (mapKeyAnnotation == null) {
+ mapKeyAnnotation = this.addMapKeyAnnotation();
+ } else {
+ mapKeyAnnotation.setName(null);
+ }
+
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(true);
+ this.setCustomMapKey_(false);
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setPkMapKey_(boolean pkMapKey) {
+ boolean old = this.pkMapKey;
+ this.pkMapKey = pkMapKey;
+ this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
+ }
+
+ protected boolean buildPkMapKey() {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() == null);
+ }
+
+
+ // ********** custom map key **********
+
+ public boolean isCustomMapKey() {
+ return this.customMapKey;
+ }
+
+ public void setCustomMapKey(boolean customMapKey) {
+ if (customMapKey) {
+ this.setSpecifiedMapKey(""); //$NON-NLS-1$
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setCustomMapKey_(boolean customMapKey) {
+ boolean old = this.customMapKey;
+ this.customMapKey = customMapKey;
+ this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
+ }
+
+ protected boolean buildCustomMapKey() {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() != null);
+ }
+
+
+ // ********** map key annotation **********
+
+ protected MapKeyAnnotation getMapKeyAnnotation() {
+ return (MapKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ }
+
+ protected MapKeyAnnotation getMapKeyAnnotationForUpdate() {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation != null) ? mapKeyAnnotation : this.addMapKeyAnnotation();
+ }
+
+ protected MapKeyAnnotation addMapKeyAnnotation() {
+ return (MapKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removeMapKeyAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** map key class **********
+
+ public String getMapKeyClass() {
+ return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass;
+ }
+
+ public String getSpecifiedMapKeyClass() {
+ return this.specifiedMapKeyClass;
+ }
+
+ public void setSpecifiedMapKeyClass(String mapKeyClass) {
+ if (this.valuesAreDifferent(mapKeyClass, this.specifiedMapKeyClass)) {
+ MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation();
+ if (mapKeyClass == null) {
+ if (annotation != null) {
+ this.removeMapKeyClassAnnotation();
+ }
+ } else {
+ if (annotation == null) {
+ annotation = this.addMapKeyClassAnnotation();
+ }
+ annotation.setValue(mapKeyClass);
+ }
+
+ this.setSpecifiedMapKeyClass_(mapKeyClass);
+ }
+ }
+
+ protected void setSpecifiedMapKeyClass_(String mapKeyClass) {
+ String old = this.specifiedMapKeyClass;
+ this.specifiedMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildSpecifiedMapKeyClass() {
+ MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation();
+ return (annotation == null) ? null : annotation.getValue();
+ }
+
+ public String getDefaultMapKeyClass() {
+ return this.defaultMapKeyClass;
+ }
+
+ protected void setDefaultMapKeyClass(String mapKeyClass) {
+ String old = this.defaultMapKeyClass;
+ this.defaultMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildDefaultMapKeyClass() {
+ return this.isJpa2_0Compatible() ? this.getPersistentAttribute().getMultiReferenceMapKeyTypeName() : null;
+ }
+
+ public String getFullyQualifiedMapKeyClass() {
+ return this.fullyQualifiedMapKeyClass;
+ }
+
+ protected void setFullyQualifiedMapKeyClass(String mapKeyClass) {
+ String old = this.fullyQualifiedMapKeyClass;
+ this.fullyQualifiedMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(FULLY_QUALIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildFullyQualifiedMapKeyClass() {
+ return this.isJpa2_0Compatible() ? this.buildFullyQualifiedMapKeyClass_() : null;
+ }
+
+ protected String buildFullyQualifiedMapKeyClass_() {
+ return (this.specifiedMapKeyClass == null) ?
+ this.defaultMapKeyClass :
+ this.getMapKeyClassAnnotation().getFullyQualifiedClassName();
+ }
+
+ public char getMapKeyClassEnclosingTypeSeparator() {
+ return '.';
+ }
+
+
+ // ********** resolved map key embeddable/entity **********
+
+ protected Embeddable getResolvedMapKeyEmbeddable() {
+ return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedMapKeyClass);
+ }
+
+ protected Entity getResolvedMapKeyEntity() {
+ return this.getPersistenceUnit().getEntity(this.fullyQualifiedMapKeyClass);
+ }
+
+
+ // ********** map key class annotation **********
+
+ protected MapKeyClass2_0Annotation getMapKeyClassAnnotation() {
+ return this.isJpa2_0Compatible() ? this.getMapKeyClassAnnotation_() : null;
+ }
+
+ protected MapKeyClass2_0Annotation getMapKeyClassAnnotation_() {
+ return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() {
+ return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected void removeMapKeyClassAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** value type **********
+
+ public Type getValueType() {
+ return this.valueType;
+ }
+
+ protected void setValueType(Type valueType) {
+ Type old = this.valueType;
+ this.valueType = valueType;
+ this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType);
+ }
+
+ protected Type buildValueType() {
+ if (this.getResolvedTargetEntity() != null) {
+ return Type.ENTITY_TYPE;
+ }
+ if (this.getResolvedTargetEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getTargetEntity() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+ protected Embeddable getResolvedTargetEmbeddable() {
+ return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedTargetEntity);
+ }
+
+
+ // ********** key type **********
+
+ public Type getKeyType() {
+ return this.keyType;
+ }
+
+ protected void setKeyType(Type keyType) {
+ Type old = this.keyType;
+ this.keyType = keyType;
+ this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType);
+ }
+
+ protected Type buildKeyType() {
+ if (this.getResolvedMapKeyEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getResolvedMapKeyEntity() != null) {
+ return Type.ENTITY_TYPE;
+ }
+ if (this.getMapKeyClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+
+ // ********** map key column **********
+
+ public JavaColumn getMapKeyColumn() {
+ return this.mapKeyColumn;
+ }
+
+ protected JavaColumn buildMapKeyColumn() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaMapKeyColumn(this, this.buildMapKeyColumnOwner()) :
+ new NullJavaMapKeyColumn2_0(this);
+ }
+
+ protected JavaColumn.Owner buildMapKeyColumnOwner() {
+ return new MapKeyColumnOwner();
+ }
+
+ protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation() {
+ return this.isJpa2_0Compatible() ? this.getMapKeyColumnAnnotation_() : null;
+ }
+
+ protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation_() {
+ return (MapKeyColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected void removeMapKeyColumnAnnotation() {
+ if (this.isJpa2_0Compatible()) {
+ this.removeMapKeyColumnAnnotation_();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ protected void removeMapKeyColumnAnnotation_() {
+ this.getResourcePersistentAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** map key attribute override container **********
+
+ public JavaAttributeOverrideContainer getMapKeyAttributeOverrideContainer() {
+ return this.mapKeyAttributeOverrideContainer;
+ }
+
+ public JavaAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() {
+ return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner());
+ }
+
+ protected JavaAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() {
+ return new MapKeyAttributeOverrideContainerOwner();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected String buildDefaultTargetEntity() {
+ return this.getPersistentAttribute().getMultiReferenceTargetTypeName();
+ }
+
+ @Override
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.orderable.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ if (this.mapKeyNameTouches(pos, astRoot)) {
+ return this.javaCandidateMapKeyNames(filter);
+ }
+
+ result = this.mapKeyColumn.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.mapKeyAttributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return null;
+ }
+
+ protected boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation != null) && mapKeyAnnotation.nameTouches(pos, astRoot);
+ }
+
+ protected Iterator<String> javaCandidateMapKeyNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.candidateMapKeyNames(filter));
+ }
+
+ protected Iterator<String> candidateMapKeyNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateMapKeyNames(), filter);
+ }
+
+ public Iterator<String> candidateMapKeyNames() {
+ return this.allTargetEntityAttributeNames();
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ protected String getMetamodelFieldTypeName() {
+ return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName();
+ }
+
+ @Override
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames);
+ super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ }
+
+ protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) {
+ String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName();
+ if (keyTypeName != null) {
+ typeArgumentNames.add(keyTypeName);
+ }
+ }
+
+ public String getMetamodelFieldMapKeyTypeName() {
+ return MappingTools.getMetamodelFieldMapKeyTypeName(this);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.orderable.validate(messages, reporter, astRoot);
+ this.validateMapKey(messages, reporter, astRoot);
+ }
+
+ protected void validateMapKey(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ if (this.getMapKeyAnnotation() != null) {//If MapKey annotation specified, no other MapKey* annotations can be specified, don't validate them
+ //TODO validate that the map key refers to an existing attribute
+ return;
+ }
+ if (this.getKeyType() == Type.BASIC_TYPE) {
+ this.mapKeyColumn.validate(messages, reporter, astRoot);
+ //validate map key converter
+ }
+ else if (this.getKeyType() == Type.ENTITY_TYPE) {
+ //validate map key join columns
+ }
+ else if (this.getKeyType() == Type.EMBEDDABLE_TYPE) {
+ this.mapKeyAttributeOverrideContainer.validate(messages, reporter, astRoot);
+ //validate map key association overrides - for eclipselink
+ }
+ }
+
+
+ // ********** abstract owner **********
+
+ /**
+ * some common behavior
+ */
+ protected abstract class AbstractOwner
+ {
+ public TypeMapping getTypeMapping() {
+ return AbstractJavaMultiRelationshipMapping.this.getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ return this.getRelationshipStrategy().getTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getRelationshipStrategy().resolveDbTable(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return AbstractJavaMultiRelationshipMapping.this.getValidationTextRange(astRoot);
+ }
+
+ protected RelationshipStrategy getRelationshipStrategy() {
+ return AbstractJavaMultiRelationshipMapping.this.getRelationship().getStrategy();
+ }
+ }
+
+
+ // ********** map key column owner **********
+
+ protected class MapKeyColumnOwner
+ extends AbstractOwner
+ implements JavaColumn.Owner
+ {
+ public MapKeyColumn2_0Annotation getColumnAnnotation() {
+ return AbstractJavaMultiRelationshipMapping.this.getMapKeyColumnAnnotation();
+ }
+
+ public void removeColumnAnnotation() {
+ AbstractJavaMultiRelationshipMapping.this.removeMapKeyColumnAnnotation();
+ }
+
+ public String getDefaultColumnName() {
+ return AbstractJavaMultiRelationshipMapping.this.getName() + "_KEY"; //$NON-NLS-1$
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getRelationshipStrategy().tableNameIsInvalid(tableName);
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy()));
+ }
+ }
+
+
+ // ********** map key attribute override owner **********
+
+ protected class MapKeyAttributeOverrideContainerOwner
+ extends AbstractOwner
+ implements JavaAttributeOverrideContainer.Owner
+ {
+ public JavaResourcePersistentMember getResourcePersistentMember() {
+ return AbstractJavaMultiRelationshipMapping.this.getResourcePersistentAttribute();
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractJavaMultiRelationshipMapping.this.getResolvedMapKeyEmbeddable();
+ }
+
+ /**
+ * If there is a specified table name it needs to be the same
+ * the default table name. the table is always the collection table
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.<String>instance();
+ }
+
+ protected static final String POSSIBLE_PREFIX = "key"; //$NON-NLS-1$
+ public String getPossiblePrefix() {
+ return POSSIBLE_PREFIX;
+ }
+
+ public String getWritePrefix() {
+ return this.getPossiblePrefix();
+ }
+
+ // since only a map's key can be an embeddable on a 1-m or m-m;
+ // all overrides are relevant
+ public boolean isRelevant(String overrideName) {
+ return true;
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy()));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java
new file mode 100644
index 0000000000..fa129f27da
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java<ul>
+ * <li>column
+ * <li>join column
+ * <li>discriminator column
+ * <li>order column
+ * <li>primary key join column
+ * </ul>
+ * <strong>NB:</strong> any subclass that directly holds its column annotation
+ * must:<ul>
+ * <li>call the "super" constructor that takes a column annotation
+ * {@link #AbstractJavaNamedColumn(JavaJpaContextNode, JavaNamedColumn.Owner, NamedColumnAnnotation)}
+ * <li>override {@link #setColumnAnnotation(NamedColumnAnnotation)} to set the column annotation
+ * so it is in place before the column's state (e.g. {@link #specifiedName})
+ * is initialized
+ * </ul>
+ */
+public abstract class AbstractJavaNamedColumn<A extends NamedColumnAnnotation, O extends JavaNamedColumn.Owner>
+ extends AbstractJavaJpaContextNode
+ implements JavaNamedColumn
+{
+ protected final O owner;
+
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String columnDefinition;
+
+
+ protected AbstractJavaNamedColumn(JavaJpaContextNode parent, O owner) {
+ this(parent, owner, null);
+ }
+
+ protected AbstractJavaNamedColumn(JavaJpaContextNode parent, O owner, A columnAnnotation) {
+ super(parent);
+ this.owner = owner;
+ this.setColumnAnnotation(columnAnnotation);
+ this.specifiedName = this.buildSpecifiedName();
+ this.columnDefinition = this.buildColumnDefinition();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedName_(this.buildSpecifiedName());
+ this.setColumnDefinition_(this.buildColumnDefinition());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultName(this.buildDefaultName());
+ }
+
+
+ // ********** column annotation **********
+
+ /**
+ * Return the Java column annotation. Do not return <code>null</code> if the
+ * Java annotation does not exist; return a <em>null</em> column annotation
+ * instead.
+ */
+ public abstract A getColumnAnnotation();
+
+ /**
+ * see class comment... ({@link AbstractJavaNamedColumn})
+ */
+ protected void setColumnAnnotation(A columnAnnotation) {
+ if (columnAnnotation != null) {
+ throw new IllegalArgumentException("this method must be overridden if the column annotation is not null: " + columnAnnotation); //$NON-NLS-1$
+ }
+ }
+
+ protected void removeColumnAnnotationIfUnset() {
+ if (this.getColumnAnnotation().isUnset()) {
+ this.removeColumnAnnotation();
+ }
+ }
+
+ protected abstract void removeColumnAnnotation();
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String name) {
+ if (this.valuesAreDifferent(this.specifiedName, name)) {
+ this.getColumnAnnotation().setName(name);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedName_(name);
+ }
+ }
+
+ protected void setSpecifiedName_(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ return this.getColumnAnnotation().getName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultName() {
+ return this.owner.getDefaultColumnName();
+ }
+
+
+ // ********** column definition **********
+
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ public void setColumnDefinition(String columnDefinition) {
+ if (this.valuesAreDifferent(this.columnDefinition, columnDefinition)) {
+ this.getColumnAnnotation().setColumnDefinition(columnDefinition);
+ this.removeColumnAnnotationIfUnset();
+ this.setColumnDefinition_(columnDefinition);
+ }
+ }
+
+ protected void setColumnDefinition_(String columnDefinition) {
+ String old = this.columnDefinition;
+ this.columnDefinition = columnDefinition;
+ this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
+ }
+
+ public String buildColumnDefinition() {
+ return this.getColumnAnnotation().getColumnDefinition();
+ }
+
+
+ // ********** database stuff **********
+
+ protected Column getDbColumn() {
+ Table table = this.getDbTable();
+ return (table == null) ? null : table.getColumnForIdentifier(this.getName());
+ }
+
+ public Table getDbTable() {
+ return this.owner.resolveDbTable(this.getTable());
+ }
+
+ /**
+ * Return the name of the column's table. This is overridden
+ * in {@link AbstractJavaBaseColumn} where a table can be defined.
+ */
+ public String getTable() {
+ return this.owner.getTypeMapping().getPrimaryTableName();
+ }
+
+ public boolean isResolved() {
+ return this.getDbColumn() != null;
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.nameTouches(pos, astRoot)) {
+ return this.getJavaCandidateNames(filter).iterator();
+ }
+ return null;
+ }
+
+ protected boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.getColumnAnnotation().nameTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateNames(filter));
+ }
+
+ protected Iterable<String> getCandidateNames(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateNames(), filter);
+ }
+
+ protected Iterable<String> getCandidateNames() {
+ Table dbTable = this.getDbTable();
+ return (dbTable != null) ? dbTable.getSortedColumnIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.buildColumnValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected JptValidator buildColumnValidator(CompilationUnit astRoot) {
+ return this.owner.buildColumnValidator(this, buildTextRangeResolver(astRoot));
+ }
+
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaNamedColumnTextRangeResolver(this, astRoot);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.getColumnAnnotation().getTextRange(astRoot);
+ return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.getColumnAnnotation().getNameTextRange(astRoot);
+ return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot);
+ }
+
+
+ // ********** misc **********
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ protected void initializeFrom(ReadOnlyNamedColumn oldColumn) {
+ this.setSpecifiedName(oldColumn.getSpecifiedName());
+ this.setColumnDefinition(oldColumn.getColumnDefinition());
+ }
+
+ protected void initializeFromVirtual(ReadOnlyNamedColumn virtualColumn) {
+ this.setSpecifiedName(virtualColumn.getName());
+ this.setColumnDefinition(virtualColumn.getColumnDefinition());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ String table = this.getTable();
+ if (table != null) {
+ sb.append(table);
+ sb.append('.');
+ }
+ sb.append(this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java
new file mode 100644
index 0000000000..a7614b8d84
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToManyMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
+
+public abstract class AbstractJavaOneToManyMapping
+ extends AbstractJavaMultiRelationshipMapping<OneToManyAnnotation>
+ implements JavaOneToManyMapping2_0, JavaOrphanRemovalHolder2_0
+{
+ protected final JavaOrphanRemovable2_0 orphanRemoval;
+
+
+ protected AbstractJavaOneToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.orphanRemoval = this.buildOrphanRemoval();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.orphanRemoval.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.orphanRemoval.update();
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ public JavaOneToManyRelationship getRelationship() {
+ return (JavaOneToManyRelationship) super.getRelationship();
+ }
+
+ @Override
+ protected JavaMappingRelationship buildRelationship() {
+ return new GenericJavaOneToManyRelationship(this, this.isJpa2_0Compatible());
+ }
+
+
+ // ********** orphan removal **********
+
+ public JavaOrphanRemovable2_0 getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ protected JavaOrphanRemovable2_0 buildOrphanRemoval() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaOrphanRemoval(this) :
+ new NullJavaOrphanRemoval2_0(this);
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return OneToManyAnnotation.ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java
new file mode 100644
index 0000000000..fbc1bffffd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
+
+public abstract class AbstractJavaOneToManyMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ protected AbstractJavaOneToManyMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return OneToManyAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ JoinTableAnnotation.ANNOTATION_NAME,
+ MapKeyAnnotation.ANNOTATION_NAME,
+ OrderByAnnotation.ANNOTATION_NAME,
+ JoinColumnAnnotation.ANNOTATION_NAME,
+ JoinColumnsAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaOneToManyMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java
new file mode 100644
index 0000000000..1fca5e88aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToOneMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
+
+
+public abstract class AbstractJavaOneToOneMapping
+ extends AbstractJavaSingleRelationshipMapping<OneToOneAnnotation>
+ implements JavaOneToOneMapping2_0, JavaOrphanRemovalHolder2_0
+{
+ protected final JavaOrphanRemovable2_0 orphanRemoval;
+
+
+ protected AbstractJavaOneToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.orphanRemoval = this.buildOrphanRemoval();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.orphanRemoval.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.orphanRemoval.update();
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ public JavaOneToOneRelationship getRelationship() {
+ return (JavaOneToOneRelationship) super.getRelationship();
+ }
+
+ @Override
+ protected JavaOneToOneRelationship buildRelationship() {
+ return new GenericJavaOneToOneRelationship(this);
+ }
+
+
+ // ********** orphan removal **********
+
+ public JavaOrphanRemovable2_0 getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ protected JavaOrphanRemovable2_0 buildOrphanRemoval() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaOrphanRemoval(this) :
+ new NullJavaOrphanRemoval2_0(this);
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return OneToOneAnnotation.ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java
new file mode 100644
index 0000000000..e5df782d91
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+
+public abstract class AbstractJavaOneToOneMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ protected AbstractJavaOneToOneMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return OneToOneAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ JoinTableAnnotation.ANNOTATION_NAME,
+ JoinColumnAnnotation.ANNOTATION_NAME,
+ JoinColumnsAnnotation.ANNOTATION_NAME,
+ PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
+ PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaOneToOneMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java
new file mode 100644
index 0000000000..f460c8dbfa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Specified Java override
+ */
+public abstract class AbstractJavaOverride<C extends JavaOverrideContainer, A extends OverrideAnnotation>
+ extends AbstractJavaJpaContextNode
+ implements JavaOverride
+{
+ protected final A overrideAnnotation;
+
+ protected String name;
+
+
+ protected AbstractJavaOverride(C parent, A overrideAnnotation) {
+ super(parent);
+ this.overrideAnnotation = overrideAnnotation;
+ this.name = this.buildName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.buildName());
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Strip the prefix (if necessary) before storing the name in the context
+ * model. Pass the unchanged name to the annotation.
+ */
+ public void setName(String name) {
+ this.overrideAnnotation.setName(name);
+ this.setName_(this.stripPrefix(name));
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ /**
+ * Strip the prefix (if necessary) from the name taken from the annotation
+ * before storing it in the context model.
+ */
+ protected String buildName() {
+ return this.stripPrefix(this.overrideAnnotation.getName());
+ }
+
+ protected String stripPrefix(String rawName) {
+ if (rawName == null) {
+ return null;
+ }
+ String prefix = this.getPossiblePrefix();
+ if (prefix == null) {
+ return rawName;
+ }
+ int prefixLength = prefix.length();
+ if ((rawName.length() > prefixLength) &&
+ (rawName.charAt(prefixLength) == '.') &&
+ rawName.startsWith(prefix)) {
+ return rawName.substring(prefixLength + 1);
+ }
+ return rawName;
+ }
+
+ protected String getPossiblePrefix() {
+ return this.getContainer().getPossiblePrefix();
+ }
+
+
+ // ********** specified/virtual **********
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ public JavaVirtualOverride convertToVirtual() {
+ return this.getContainer().convertOverrideToVirtual(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public C getParent() {
+ return (C) super.getParent();
+ }
+
+ public C getContainer() {
+ return this.getParent();
+ }
+
+ public A getOverrideAnnotation() {
+ return this.overrideAnnotation;
+ }
+
+ protected void initializeFrom(ReadOnlyOverride oldOverride) {
+ this.setName(this.prefix(oldOverride.getName()));
+ }
+
+ protected void initializeFromVirtual(ReadOnlyOverride virtualOverride) {
+ this.setName(this.prefix(virtualOverride.getName()));
+ }
+
+ protected String prefix(String oldName) {
+ if (oldName == null) {
+ return null;
+ }
+ String prefix = this.getWritePrefix();
+ return (prefix == null) ? oldName : (prefix + '.' + oldName);
+ }
+
+ protected String getWritePrefix() {
+ return this.getContainer().getWritePrefix();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.nameTouches(pos, astRoot)) {
+ return this.javaCandidateNames(filter);
+ }
+ return null;
+ }
+
+ protected boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.overrideAnnotation.nameTouches(pos, astRoot);
+ }
+
+ protected Iterator<String> javaCandidateNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.candidateNames(filter));
+ }
+
+ private Iterator<String> candidateNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateNames(), filter);
+ }
+
+ protected abstract Iterator<String> candidateNames();
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.buildValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected JptValidator buildValidator(CompilationUnit astRoot) {
+ return this.getContainer().buildValidator(this, buildTextRangeResolver(astRoot));
+ }
+
+ protected OverrideTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaOverrideTextRangeResolver(this, astRoot);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.overrideAnnotation.getTextRange(astRoot);
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.overrideAnnotation.getNameTextRange(astRoot);
+ return (textRange != null) ? textRange : this.getValidationTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
new file mode 100644
index 0000000000..10d11930cd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
@@ -0,0 +1,816 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.ReflectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.CollectionMapping;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaStructureNodes;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java persistent attributes
+ */
+public abstract class AbstractJavaPersistentAttribute
+ extends AbstractJavaJpaContextNode
+ implements JavaPersistentAttribute2_0
+{
+ protected final JavaResourcePersistentAttribute resourcePersistentAttribute;
+
+ protected String name;
+
+ protected AccessType defaultAccess;
+
+ protected JavaAttributeMapping mapping; // never null
+ protected String defaultMappingKey;
+
+
+ protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ super(parent);
+ this.resourcePersistentAttribute = resourcePersistentAttribute;
+ this.name = resourcePersistentAttribute.getName();
+
+ // this is determined directly from the resource model
+ this.defaultAccess = this.buildDefaultAccess();
+
+ // keep non-null at all times
+ this.mapping = this.buildMapping();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName(this.resourcePersistentAttribute.getName());
+ // this is determined directly from the resource model
+ this.setDefaultAccess(this.buildDefaultAccess());
+ this.syncMapping();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateMapping();
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ protected void setName(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** access **********
+
+ /**
+ * Subclasses determine the specified access.
+ */
+ public AccessType getAccess() {
+ AccessType access = this.getSpecifiedAccess();
+ return (access != null) ? access : this.defaultAccess;
+ }
+
+ public abstract AccessType getSpecifiedAccess();
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType access) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = access;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildDefaultAccess() {
+ return this.resourcePersistentAttribute.isField() ? AccessType.FIELD : AccessType.PROPERTY;
+ }
+
+
+ // ********** mapping **********
+
+ public JavaAttributeMapping getMapping() {
+ return this.mapping;
+ }
+
+ /**
+ * Clients do not set the mapping directly.
+ * @see #setMappingKey(String)
+ */
+ protected void setMapping(JavaAttributeMapping mapping) {
+ JavaAttributeMapping old = this.mapping;
+ this.mapping = mapping;
+ this.firePropertyChanged(MAPPING_PROPERTY, old, mapping);
+ }
+
+ public String getMappingKey() {
+ return this.mapping.getKey();
+ }
+
+ /**
+ * Possible transitions:
+ * <table border>
+ * <th>
+ * <th>null mapping/default<br>
+ * <code>key = null</code>
+ * <th>specified mapping A<br>
+ * <code>key = "A"</code>
+ * <th>specified mapping B<br>
+ * <code>key = "B"</code>
+ * <tr>
+ * <th>[default] null mapping
+ * <td>do nothing
+ * <td>add annotation A<br>
+ * set new mapping A
+ * <td>add annotation B<br>
+ * set new mapping B
+ * <tr>
+ * <th>default mapping A
+ * <td>do nothing
+ * <td>add annotation A<br>
+ * <em>re-use</em> default mapping A
+ * <td>add annotation B<br>
+ * set new mapping B
+ * <tr>
+ * <th>specified mapping A
+ * <td>remove annotation A<br>
+ * set new default or null mapping
+ * <td>do nothing
+ * <td>remove annotation A<br>
+ * add annotation B<br>
+ * set new mapping B
+ * </table>
+ * The "do nothing" transitions are handled in this method.
+ */
+ public JavaAttributeMapping setMappingKey(String key) {
+ if (this.mapping.isDefault()) {
+ if (key == null) {
+ // leave the default mapping unchanged
+ } else {
+ this.setMappingKey_(key); // replace the default mapping
+ }
+ } else {
+ if (this.valuesAreEqual(key, this.mapping.getKey())) {
+ // leave the specified mapping unchanged
+ } else {
+ this.setMappingKey_(key); // replace the specified mapping
+ }
+ }
+ return this.mapping;
+ }
+
+ /**
+ * We have either:<ul>
+ * <li>a <em>default</em> mapping and a non-<code>null</code> key
+ * </ul>or<ul>
+ * <li>a <em>specified</em> mapping and a different (possibly
+ * <code>null</code>) key
+ * </ul>
+ */
+ protected void setMappingKey_(String key) {
+ JavaAttributeMappingDefinition definition = this.getSpecifiedMappingDefinition(key);
+ if (definition == null) {
+ // our mapping is "specified" and the key is null;
+ // check for a default definition
+ definition = this.getDefaultMappingDefinition();
+ Iterable<String> supportingAnnotationNames = (definition != null) ? definition.getSupportingAnnotationNames() : EmptyIterable.<String>instance();
+ // clear any mapping annotation(s);
+ // leave the "default" mapping's supporting annotations;
+ // if there is no "default" mapping, clear all supporting annotations too(?)
+ this.setMappingAnnotation(null, supportingAnnotationNames);
+ } else {
+ this.setMappingAnnotation(definition);
+ }
+ // note: 'definition' can still be null (if the key is null and there is no "default" mapping)
+ this.setMapping(this.buildMapping(definition));
+ }
+
+ /**
+ * pre-condition: definition is not <code>null</code>
+ */
+ protected void setMappingAnnotation(JavaAttributeMappingDefinition definition) {
+ this.setMappingAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames());
+ }
+
+ protected void setMappingAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
+ this.resourcePersistentAttribute.setPrimaryAnnotation(primaryAnnotationName, supportingAnnotationNames);
+ }
+
+ protected JavaAttributeMapping buildMapping(JavaAttributeMappingDefinition definition) {
+ return (definition == null) ? this.buildNullMapping() : this.buildMapping_(definition);
+ }
+
+ protected JavaAttributeMapping buildNullMapping() {
+ return this.getJpaFactory().buildJavaNullAttributeMapping(this);
+ }
+
+ /**
+ * pre-condition: definition is not null
+ * <p>
+ * If we are converting a <em>default</em> mapping to its <em>specified</em>
+ * manifestation, we just keep the same mapping and create its annotation.
+ * We do <em>not</em> do the same thing when converting a <em>specified</em>
+ * mapping to its <em>default</em> manifestation. We rebuild the
+ * entire mapping, simplifying the clearing of all its state. We do this
+ * because we allow clients to modify a <em>default</em> mapping (or any of
+ * its components) directly,
+ * modifying its state and triggering a conversion to a <em>specified</em>
+ * mapping. The only way to convert a <em>specified</em> mapping to a
+ * <em>default</em> mapping is by {@link #setMappingKey(String) setting the
+ * mapping key} to <code>null</code>.
+ */
+ protected JavaAttributeMapping buildMapping_(JavaAttributeMappingDefinition definition) {
+ // 'mapping' is null during construction
+ if ((this.mapping != null) && this.mapping.isDefault() && Tools.valuesAreEqual(this.mapping.getKey(), definition.getKey())) {
+ this.mapping.updateDefault(); // since nothing here changes, we need to update the mapping's flag
+ return this.mapping;
+ }
+ return definition.buildMapping(this, this.getJpaFactory());
+ }
+
+ /**
+ * We only look for a <em>specified</em> mapping here.
+ * We look for a default mapping during <em>update</em>.
+ */
+ protected JavaAttributeMapping buildMapping() {
+ return this.buildMapping(this.getSpecifiedMappingDefinition());
+ }
+
+ /**
+ * Look for a <em>specified</em> mapping and sync our mapping.
+ */
+ protected void syncMapping() {
+ JavaAttributeMappingDefinition definition = this.getSpecifiedMappingDefinition();
+ if (definition == null) {
+ if (this.mapping.isDefault()) {
+ // null/default => null/default
+ this.mapping.synchronizeWithResourceModel();
+ } else {
+ // specified => null/default
+ definition = this.getDefaultMappingDefinition();
+ this.setMapping(this.buildMapping(definition));
+ }
+ } else {
+ if (this.mapping.isDefault()) {
+ // null/default => specified
+ this.setMapping(this.buildMapping(definition));
+ } else {
+ // specified => specified
+ if (this.valuesAreEqual(definition.getKey(), this.mapping.getKey())) {
+ this.mapping.synchronizeWithResourceModel();
+ } else {
+ this.setMapping(this.buildMapping(definition));
+ }
+ }
+ }
+ }
+
+ /**
+ * Return the "specified" mapping definition for the specified key.
+ */
+ protected JavaAttributeMappingDefinition getSpecifiedMappingDefinition(String key) {
+ if (key == null) {
+ return null;
+ }
+ for (JavaAttributeMappingDefinition definition : this.getSpecifiedMappingDefinitions()) {
+ if (Tools.valuesAreEqual(definition.getKey(), key)) {
+ return definition;
+ }
+ }
+ throw new IllegalArgumentException("invalid mapping key: " + key); //$NON-NLS-1$
+ }
+
+ /**
+ * Return the mapping definition for the mapping currently specified in the
+ * source code.
+ */
+ protected JavaAttributeMappingDefinition getSpecifiedMappingDefinition() {
+ for (JavaAttributeMappingDefinition definition : this.getSpecifiedMappingDefinitions()) {
+ if (definition.isSpecified(this)) {
+ return definition;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<JavaAttributeMappingDefinition> getSpecifiedMappingDefinitions() {
+ return this.getJpaPlatform().getSpecifiedJavaAttributeMappingDefinitions();
+ }
+
+
+ // ********** default mapping **********
+
+ public String getDefaultMappingKey() {
+ return this.defaultMappingKey;
+ }
+
+ protected void setDefaultMappingKey(String mappingKey) {
+ String old = this.defaultMappingKey;
+ this.defaultMappingKey = mappingKey;
+ this.firePropertyChanged(DEFAULT_MAPPING_KEY_PROPERTY, old, mappingKey);
+ }
+
+ /**
+ * If a mapping annotation is specified, we would have already set a
+ * <em>specified</em> mapping in {@link #syncMapping()}. We need only check
+ * for changes to the <em>default</em> mapping.
+ */
+ protected void updateMapping() {
+ JavaAttributeMappingDefinition definition = this.getDefaultMappingDefinition();
+ String newDefaultKey = (definition == null) ? null : definition.getKey();
+ if (this.mapping.isDefault() && Tools.valuesAreDifferent(this.mapping.getKey(), newDefaultKey)) {
+ this.setMapping(this.buildMapping(definition)); // the default mapping has changed
+ } else {
+ this.mapping.update();
+ }
+ this.setDefaultMappingKey(newDefaultKey);
+ }
+
+ protected JavaAttributeMappingDefinition getDefaultMappingDefinition() {
+ for (DefaultJavaAttributeMappingDefinition definition : this.getDefaultMappingDefinitions()) {
+ if (definition.isDefault(this)) {
+ return definition;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<DefaultJavaAttributeMappingDefinition> getDefaultMappingDefinitions() {
+ return this.getJpaPlatform().getDefaultJavaAttributeMappingDefinitions();
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return JavaStructureNodes.PERSISTENT_ATTRIBUTE_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ return this;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.getSelectionTextRange(this.buildASTRoot());
+ }
+
+ protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
+ return this.resourcePersistentAttribute.getNameTextRange(astRoot);
+ }
+
+ protected CompilationUnit buildASTRoot() {
+ return this.resourcePersistentAttribute.getJavaResourceCompilationUnit().buildASTRoot();
+ }
+
+ public void dispose() {
+ // nothing to dispose
+ }
+
+
+ // ********** type **********
+
+ /**
+ * From the JPA spec, when the basic mapping applies:<br>
+ * If the type of the attribute (field or property) is one of the following
+ * it must be mapped as <code>@javax.persistence.Basic</code>:<ul>
+ * <li><code>byte[]</code>
+ * <li><code>java.lang.Byte[]</code>
+ * <li><code>char[]</code>
+ * <li><code>java.lang.Character[]</code>
+ * <li>primitive types (except <code>void</code>)
+ * <li>primitive wrappers (except <code>java.lang.Void</code>)
+ * <li><code>java.lang.String</code>
+ * <li><code>java.math.BigInteger</code>
+ * <li><code>java.math.BigDecimal</code>
+ * <li><code>java.util.Date</code>
+ * <li><code>java.util.Calendar</code>
+ * <li><code>java.sql.Date</code>
+ * <li><code>java.sql.Time</code>
+ * <li><code>java.sql.Timestamp</code>
+ * <li><code>enum</code>s
+ * <li>any other type that implements <code>java.io.Serializable</code>
+ * </ul>
+ */
+ public boolean typeIsBasic() {
+ // 'typeName' may include array brackets but not generic type arguments
+ String typeName = this.getTypeName();
+ if (typeName == null) {
+ return false;
+ }
+
+ int arrayDepth = ReflectionTools.getArrayDepthForTypeDeclaration(typeName);
+ if (arrayDepth > 1) {
+ return false; // multi-dimensional arrays are not supported
+ }
+
+ if (arrayDepth == 1) {
+ String elementTypeName = ReflectionTools.getElementTypeNameForTypeDeclaration(typeName, 1);
+ return this.elementTypeIsValidForBasicArray(elementTypeName);
+ }
+
+ // arrayDepth == 0
+ if (ClassName.isVariablePrimitive(typeName)) {
+ return true; // any primitive but 'void'
+ }
+ if (ClassName.isVariablePrimitiveWrapper(typeName)) {
+ return true; // any primitive wrapper but 'java.lang.Void'
+ }
+ if (this.typeIsOtherValidBasicType(typeName)) {
+ return true;
+ }
+ if (this.resourcePersistentAttribute.typeIsEnum()) {
+ return true;
+ }
+ if (this.resourcePersistentAttribute.typeIsSubTypeOf(SERIALIZABLE_TYPE_NAME)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return whether the specified type is a valid element type for
+ * a one-dimensional array that can default to a basic mapping:<ul>
+ * <li><code>byte</code>
+ * <li><code>java.lang.Byte</code>
+ * <li><code>char</code>
+ * <li><code>java.lang.Character</code>
+ * </ul>
+ */
+ protected boolean elementTypeIsValidForBasicArray(String elementTypeName) {
+ return ArrayTools.contains(VALID_BASIC_ARRAY_ELEMENT_TYPE_NAMES, elementTypeName);
+ }
+
+ protected static final String[] VALID_BASIC_ARRAY_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 among the various "other" types
+ * that can default to a basic mapping.
+ */
+ protected boolean typeIsOtherValidBasicType(String typeName) {
+ return ArrayTools.contains(OTHER_VALID_BASIC_TYPE_NAMES, typeName);
+ }
+
+ protected static final String[] OTHER_VALID_BASIC_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(),
+ };
+
+ protected static final String SERIALIZABLE_TYPE_NAME = java.io.Serializable.class.getName();
+
+ public String getSingleReferenceTargetTypeName() {
+ // 'typeName' may include array brackets ("[]")
+ // but not generic type arguments (e.g. "<java.lang.String>")
+ String typeName = this.getTypeName();
+ if (typeName == null) {
+ return null;
+ }
+ if (ReflectionTools.getArrayDepthForTypeDeclaration(typeName) != 0) {
+ return null; // arrays cannot be entities
+ }
+ if (this.typeIsContainer(typeName)) {
+ return null; // "containers" cannot be entities
+ }
+ return typeName;
+ }
+
+ public String getMultiReferenceTargetTypeName() {
+ return this.getJpaContainerDefinition().getMultiReferenceTargetTypeName(this.resourcePersistentAttribute);
+ }
+
+ public String getMultiReferenceMapKeyTypeName() {
+ return this.getJpaContainerDefinition().getMultiReferenceMapKeyTypeName(this.resourcePersistentAttribute);
+ }
+
+ /**
+ * return whether the specified type is one of the container
+ * types allowed by the JPA spec
+ */
+ protected boolean typeIsContainer(String typeName) {
+ return this.getJpaContainerDefinition(typeName).isContainer();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public PersistentType getParent() {
+ return (PersistentType) super.getParent();
+ }
+
+ public PersistentType getOwningPersistentType() {
+ return this.getParent();
+ }
+
+ public TypeMapping getOwningTypeMapping() {
+ return this.getOwningPersistentType().getMapping();
+ }
+
+ public JavaPersistentAttribute getJavaPersistentAttribute() {
+ return this;
+ }
+
+ public JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.resourcePersistentAttribute;
+ }
+
+ public String getPrimaryKeyColumnName() {
+ return this.getMapping().getPrimaryKeyColumnName();
+ }
+
+ public String getTypeName() {
+ return this.resourcePersistentAttribute.getTypeName();
+ }
+
+ /**
+ * Java attributes always correspond to attributes in the source code.
+ */
+ public boolean isVirtual() {
+ return false;
+ }
+
+ public boolean contains(int offset, CompilationUnit astRoot) {
+ TextRange fullTextRange = this.getFullTextRange(astRoot);
+ // 'fullTextRange' will be null if the attribute no longer exists in the java;
+ // the context model can be out of synch with the resource model
+ // when a selection event occurs before the context model has a
+ // chance to synch with the resource model via the update thread
+ return (fullTextRange == null) ? false : fullTextRange.includes(offset);
+ }
+
+ protected TextRange getFullTextRange(CompilationUnit astRoot) {
+ return this.resourcePersistentAttribute.getTextRange(astRoot);
+ }
+
+ public Embeddable getEmbeddable() {
+ String typeName = this.getTypeName();
+ return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName);
+ }
+
+ public boolean isField() {
+ return this.resourcePersistentAttribute.isField();
+ }
+
+ public boolean isProperty() {
+ return this.resourcePersistentAttribute.isProperty();
+ }
+
+ public boolean isPublic() {
+ return Modifier.isPublic(this.resourcePersistentAttribute.getModifiers());
+ }
+
+ public boolean isFinal() {
+ return Modifier.isFinal(this.resourcePersistentAttribute.getModifiers());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getSelectionTextRange(astRoot);
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ this.validateAttribute(messages, reporter, astRoot);
+
+ this.getMapping().validate(messages, reporter, astRoot);
+ }
+
+ protected void validateAttribute(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.buildAttibuteValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected abstract JptValidator buildAttibuteValidator(CompilationUnit astRoot);
+
+ protected PersistentAttributeTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaPersistentAttributeTextRangeResolver(this, astRoot);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return this.getMapping().javaCompletionProposals(pos, filter, astRoot);
+ }
+
+
+ // ********** metamodel **********
+
+ public String getMetamodelContainerFieldTypeName() {
+ return this.getJpaContainerDefinition().getMetamodelContainerFieldTypeName();
+ }
+
+ public String getMetamodelContainerFieldMapKeyTypeName() {
+ return this.getJpaContainerDefinition().getMetamodelContainerFieldMapKeyTypeName((CollectionMapping) this.getMapping());
+ }
+
+ public String getMetamodelTypeName() {
+ String typeName = this.getTypeName();
+ if (typeName == null) {
+ return MetamodelField.DEFAULT_TYPE_NAME;
+ }
+ if (ClassName.isPrimitive(typeName)) {
+ return ClassName.getWrapperClassName(typeName); // ???
+ }
+ return typeName;
+ }
+
+
+ // ********** JPA container definition **********
+
+ public JpaContainerDefinition getJpaContainerDefinition() {
+ // 'typeName' may include array brackets ("[]")
+ // but not generic type arguments (e.g. "<java.lang.String>")
+ return this.getJpaContainerDefinition(this.resourcePersistentAttribute.getTypeName());
+ }
+
+ /**
+ * Return the JPA container definition corresponding to the specified type;
+ * return a "null" definition if the specified type is not one of the
+ * container types allowed by the JPA spec.
+ */
+ protected JpaContainerDefinition getJpaContainerDefinition(String typeName) {
+ for (JpaContainerDefinition definition : this.getJpaContainerDefinitions()) {
+ if (definition.getTypeName().equals(typeName)) {
+ return definition;
+ }
+ }
+ return JpaContainerDefinition.Null.instance();
+ }
+
+ protected Iterable<JpaContainerDefinition> getJpaContainerDefinitions() {
+ return JPA_CONTAINER_DEFINITIONS;
+ }
+
+ protected static final JpaContainerDefinition[] JPA_CONTAINER_DEFINITION_ARRAY = new JpaContainerDefinition[] {
+ new CollectionJpaContainerDefinition(java.util.Collection.class, JPA2_0.COLLECTION_ATTRIBUTE),
+ new CollectionJpaContainerDefinition(java.util.Set.class, JPA2_0.SET_ATTRIBUTE),
+ new CollectionJpaContainerDefinition(java.util.List.class, JPA2_0.LIST_ATTRIBUTE),
+ new MapJpaContainerDefinition(java.util.Map.class, JPA2_0.MAP_ATTRIBUTE)
+ };
+
+ protected static final Iterable<JpaContainerDefinition> JPA_CONTAINER_DEFINITIONS = new ArrayIterable<JpaContainerDefinition>(JPA_CONTAINER_DEFINITION_ARRAY);
+
+
+ /**
+ * Abstract JPA container definition
+ */
+ protected abstract static class AbstractJpaContainerDefinition
+ implements JpaContainerDefinition
+ {
+ protected final String typeName;
+ protected final String metamodelContainerFieldTypeName;
+
+ protected AbstractJpaContainerDefinition(Class<?> containerClass, String metamodelContainerFieldTypeName) {
+ this(containerClass.getName(), metamodelContainerFieldTypeName);
+ }
+
+ protected AbstractJpaContainerDefinition(String typeName, String metamodelContainerFieldTypeName) {
+ super();
+ if ((typeName == null) || (metamodelContainerFieldTypeName == null)) {
+ throw new NullPointerException();
+ }
+ this.typeName = typeName;
+ this.metamodelContainerFieldTypeName = metamodelContainerFieldTypeName;
+ }
+
+ public String getTypeName() {
+ return this.typeName;
+ }
+
+ public boolean isContainer() {
+ return true;
+ }
+
+ public String getMetamodelContainerFieldTypeName() {
+ return this.metamodelContainerFieldTypeName;
+ }
+
+ }
+
+ /**
+ * Collection JPA container definition
+ */
+ protected static class CollectionJpaContainerDefinition
+ extends AbstractJpaContainerDefinition
+ {
+ protected CollectionJpaContainerDefinition(Class<?> collectionClass, String staticMetamodelTypeDeclarationTypeName) {
+ super(collectionClass, staticMetamodelTypeDeclarationTypeName);
+ }
+
+ public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 1) ?
+ resourcePersistentAttribute.getTypeTypeArgumentName(0) :
+ null;
+ }
+
+ public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ return null;
+ }
+
+ public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) {
+ return null;
+ }
+
+ public boolean isMap() {
+ return false;
+ }
+ }
+
+ /**
+ * Map JPA container definition
+ */
+ protected static class MapJpaContainerDefinition
+ extends AbstractJpaContainerDefinition
+ {
+ protected MapJpaContainerDefinition(Class<?> mapClass, String staticMetamodelTypeDeclarationTypeName) {
+ super(mapClass, staticMetamodelTypeDeclarationTypeName);
+ }
+
+ public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 2) ?
+ resourcePersistentAttribute.getTypeTypeArgumentName(1) :
+ null;
+ }
+
+ public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 2) ?
+ resourcePersistentAttribute.getTypeTypeArgumentName(0) :
+ null;
+ }
+
+ public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) {
+ return mapping.getMetamodelFieldMapKeyTypeName();
+ }
+
+ public boolean isMap() {
+ return true;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
new file mode 100644
index 0000000000..3891dcca22
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
@@ -0,0 +1,722 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaStructureNodes;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java persistent type:<ul>
+ * <li>name
+ * <li>access
+ * <li>mapping
+ * <li>attributes
+ * <li>super persistent type
+ * </ul>
+ */
+public abstract class AbstractJavaPersistentType
+ extends AbstractJavaJpaContextNode
+ implements JavaPersistentType
+{
+ protected final JavaResourcePersistentType resourcePersistentType;
+
+ protected String name;
+
+ protected PersistentType superPersistentType;
+
+ protected AccessType specifiedAccess;
+ protected AccessType defaultAccess; // never null
+
+ protected JavaTypeMapping mapping; // never null
+
+ protected final Vector<JavaPersistentAttribute> attributes = new Vector<JavaPersistentAttribute>();
+ protected final AttributeContainerAdapter attributeContainerAdapter = new AttributeContainerAdapter();
+
+
+ protected AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType resourcePersistentType) {
+ super(parent);
+ this.resourcePersistentType = resourcePersistentType;
+ this.name = resourcePersistentType.getQualifiedName();
+ this.specifiedAccess = this.buildSpecifiedAccess();
+
+ // keep this non-null
+ this.defaultAccess = AccessType.FIELD;
+
+ this.mapping = this.buildMapping();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName(this.resourcePersistentType.getQualifiedName());
+ this.setSpecifiedAccess_(this.buildSpecifiedAccess());
+ this.syncMapping();
+ this.synchronizeNodesWithResourceModel(this.getAttributes());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setSuperPersistentType(this.buildSuperPersistentType());
+ this.setDefaultAccess(this.buildDefaultAccess());
+ this.mapping.update();
+ this.updateAttributes();
+ this.registerRootStructureNode();
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getSimpleName(){
+ return ClassName.getSimpleName(this.name);
+ }
+
+ protected void setName(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** super persistent type **********
+
+ public PersistentType getSuperPersistentType() {
+ return this.superPersistentType;
+ }
+
+ protected void setSuperPersistentType(PersistentType superPersistentType) {
+ PersistentType old = this.superPersistentType;
+ this.superPersistentType = superPersistentType;
+ this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType);
+ }
+
+ protected PersistentType buildSuperPersistentType() {
+ HashSet<JavaResourcePersistentType> visited = new HashSet<JavaResourcePersistentType>();
+ visited.add(this.resourcePersistentType);
+ PersistentType spt = this.resolveSuperPersistentType(this.resourcePersistentType.getSuperclassQualifiedName(), visited);
+ if (spt == null) {
+ return null;
+ }
+ if (CollectionTools.contains(spt.inheritanceHierarchy(), this)) {
+ return null; // short-circuit in this case, we have circular inheritance
+ }
+ return spt.isMapped() ? spt : spt.getSuperPersistentType();
+ }
+
+ /**
+ * The JPA spec allows non-persistent types in a persistent type's
+ * inheritance hierarchy. We check for a persistent type with the
+ * specified name in the persistence unit. If it is not found we use
+ * resource persistent type and look for <em>its</em> super type.
+ * <p>
+ * The <code>visited</code> collection is used to detect a cycle in the
+ * <em>resource</em> type inheritance hierarchy and prevent the resulting
+ * stack overflow. Any cycles in the <em>context</em> type inheritance
+ * hierarchy are handled in {@link #buildSuperPersistentType()}.
+ */
+ protected PersistentType resolveSuperPersistentType(String typeName, Collection<JavaResourcePersistentType> visited) {
+ if (typeName == null) {
+ return null;
+ }
+ JavaResourcePersistentType resourceType = this.getJpaProject().getJavaResourcePersistentType(typeName);
+ if ((resourceType == null) || visited.contains(resourceType)) {
+ return null;
+ }
+ visited.add(resourceType);
+ PersistentType spt = this.resolvePersistentType(typeName);
+ return (spt != null) ? spt : this.resolveSuperPersistentType(resourceType.getSuperclassQualifiedName(), visited); // recurse
+ }
+
+ protected PersistentType resolvePersistentType(String typeName) {
+ return this.getPersistenceUnit().getPersistentType(typeName);
+ }
+
+
+ // ********** access **********
+
+ public AccessType getAccess() {
+ return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
+ }
+
+ public AccessType getSpecifiedAccess() {
+ return this.specifiedAccess;
+ }
+
+ protected void setSpecifiedAccess_(AccessType access) {
+ AccessType old = this.specifiedAccess;
+ this.specifiedAccess = access;
+ this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access);
+ }
+
+ /**
+ * Build an access type based on annotations from the resource model.
+ * (This is JPA platform-dependent.)
+ */
+ protected abstract AccessType buildSpecifiedAccess();
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType access) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = access;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access);
+ }
+
+ /**
+ * Check the access "specified" by the Java resource model:<ul>
+ * <li>Check Java annotations first
+ * <li>If <code>null</code>, check XML mapping specified access
+ * <li>If still <code>null</code>, check {@link #superPersistentType} access
+ * <li>If still <code>null</code>, check <code>entity-mappings</code>
+ * specified access setting if the corresponding <code>persistent-type</code>
+ * is listed in a mapping (<code>orm.xml</code>) file
+ * <li>If still <code>null</code>, check the <code>persistence-unit</code>
+ * default Access
+ * <li>Default to {@link AccessType#FIELD FIELD} if all else fails.
+ * </ul>
+ */
+ protected AccessType buildDefaultAccess() {
+ AccessType accessType = AccessType.fromJavaResourceModel(JavaResourcePersistentType.Tools.buildAccess(this.resourcePersistentType));
+ if (accessType != null) {
+ return accessType;
+ }
+ accessType = this.getOwnerOverrideAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+
+ if (this.superPersistentType != null) {
+ accessType = this.superPersistentType.getAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+ }
+
+ accessType = this.getOwnerDefaultAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+
+ // last ditch attempt to allow the user to annotate *something*
+ return AccessType.FIELD;
+ }
+
+
+ // ********** mapping **********
+
+ public JavaTypeMapping getMapping() {
+ return this.mapping;
+ }
+
+ public String getMappingKey() {
+ return this.mapping.getKey();
+ }
+
+ public void setMappingKey(String key) {
+ if (this.valuesAreDifferent(key, this.getMappingKey())) {
+ this.setMapping(this.buildMapping(key));
+ }
+ }
+
+ protected JavaTypeMapping buildMapping(String key) {
+ for (JavaTypeMappingDefinition definition : this.getMappingDefinitions()) {
+ if (Tools.valuesAreEqual(definition.getKey(), key)) {
+ Annotation annotation = this.resourcePersistentType.setPrimaryAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames());
+ return definition.buildMapping(this, annotation, this.getJpaFactory());
+ }
+ }
+ this.resourcePersistentType.setPrimaryAnnotation(null, EmptyIterable.<String>instance());
+ return this.buildNullMapping();
+ }
+
+ /**
+ * Clients do not set the mapping directly.
+ * @see #setMappingKey(String)
+ */
+ protected void setMapping(JavaTypeMapping mapping) {
+ JavaTypeMapping old = this.mapping;
+ this.mapping = mapping;
+ this.firePropertyChanged(MAPPING_PROPERTY, old, mapping);
+ }
+
+ protected JavaTypeMapping buildMapping() {
+ for (JavaTypeMappingDefinition definition : this.getMappingDefinitions()) {
+ Annotation annotation = this.resourcePersistentType.getAnnotation(definition.getAnnotationName());
+ if (annotation != null) {
+ return definition.buildMapping(this, annotation, this.getJpaFactory());
+ }
+ }
+ return this.buildNullMapping();
+ }
+
+ protected void syncMapping() {
+ JavaTypeMappingDefinition definition = null;
+ Annotation annotation = null;
+ for (Iterator<JavaTypeMappingDefinition> stream = this.mappingDefinitions(); stream.hasNext(); ) {
+ definition = stream.next();
+ annotation = this.resourcePersistentType.getAnnotation(definition.getAnnotationName());
+ if (annotation != null) {
+ break;
+ }
+ }
+ // 'annotation' can still be null when we get here
+ if (this.mapping.getMappingAnnotation() == annotation) {
+ this.mapping.synchronizeWithResourceModel();
+ } else {
+ this.setMapping(this.buildMapping(annotation, definition));
+ }
+ }
+
+ protected JavaTypeMapping buildMapping(Annotation annotation, JavaTypeMappingDefinition definition) {
+ return (annotation != null) ?
+ definition.buildMapping(this, annotation, this.getJpaFactory()) :
+ this.buildNullMapping();
+ }
+
+ protected Iterator<JavaTypeMappingDefinition> mappingDefinitions() {
+ return this.getMappingDefinitions().iterator();
+ }
+
+ protected Iterable<JavaTypeMappingDefinition> getMappingDefinitions() {
+ return this.getJpaPlatform().getJavaTypeMappingDefinitions();
+ }
+
+ protected JavaTypeMapping buildNullMapping() {
+ return this.getJpaFactory().buildJavaNullTypeMapping(this);
+ }
+
+ public boolean isMapped() {
+ return this.mapping.isMapped();
+ }
+
+
+ // ********** attributes **********
+
+ public ListIterator<JavaPersistentAttribute> attributes() {
+ return this.getAttributes().iterator();
+ }
+
+ protected ListIterable<JavaPersistentAttribute> getAttributes() {
+ return new LiveCloneListIterable<JavaPersistentAttribute>(this.attributes);
+ }
+
+ public int attributesSize() {
+ return this.attributes.size();
+ }
+
+ public Iterator<String> attributeNames() {
+ return this.getAttributeNames().iterator();
+ }
+
+ protected Iterable<String> getAttributeNames() {
+ return this.convertToNames(this.getAttributes());
+ }
+
+ public JavaPersistentAttribute getAttributeNamed(String attributeName) {
+ Iterator<JavaPersistentAttribute> stream = this.getAttributesNamed(attributeName).iterator();
+ return stream.hasNext() ? stream.next() : null;
+ }
+
+ public JavaPersistentAttribute getAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute) {
+ for (JavaPersistentAttribute javaAttribute : this.getAttributes()) {
+ if (javaAttribute.getResourcePersistentAttribute() == javaResourceAttribute) {
+ return javaAttribute;
+ }
+ }
+ return null;
+ }
+
+ public Iterator<ReadOnlyPersistentAttribute> allAttributes() {
+ return this.getAllAttributes().iterator();
+ }
+
+ protected Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
+ return new CompositeIterable<ReadOnlyPersistentAttribute>(
+ new TransformationIterable<PersistentType, Iterable<ReadOnlyPersistentAttribute>>(this.getInheritanceHierarchy()) {
+ @Override
+ protected Iterable<ReadOnlyPersistentAttribute> transform(PersistentType pt) {
+ return new SnapshotCloneIterable<ReadOnlyPersistentAttribute>(pt.attributes());
+ }
+ }
+ );
+ }
+
+ public Iterator<String> allAttributeNames() {
+ return this.getAllAttributeNames().iterator();
+ }
+
+ protected Iterable<String> getAllAttributeNames() {
+ return this.convertToNames(this.getAllAttributes());
+ }
+
+ protected Iterable<JavaPersistentAttribute> getAttributesNamed(final String attributeName) {
+ return new FilteringIterable<JavaPersistentAttribute>(this.getAttributes()) {
+ @Override
+ protected boolean accept(JavaPersistentAttribute attribute) {
+ return Tools.valuesAreEqual(attributeName, attribute.getName());
+ }
+ };
+ }
+
+ public ReadOnlyPersistentAttribute resolveAttribute(String attributeName) {
+ Iterator<JavaPersistentAttribute> stream = this.getAttributesNamed(attributeName).iterator();
+ if (stream.hasNext()) {
+ JavaPersistentAttribute attribute = stream.next();
+ // return null if we have more than one
+ return stream.hasNext() ? null : attribute;
+ }
+ // recurse
+ return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
+ }
+
+ protected Iterable<String> convertToNames(Iterable<? extends ReadOnlyPersistentAttribute> attrs) {
+ return new TransformationIterable<ReadOnlyPersistentAttribute, String>(attrs) {
+ @Override
+ protected String transform(ReadOnlyPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ protected Iterator<JavaResourcePersistentAttribute> resourceAttributes() {
+ return (this.getAccess() == AccessType.PROPERTY) ?
+ this.resourcePersistentType.persistableProperties() :
+ this.resourcePersistentType.persistableFields();
+ }
+
+ protected Iterable<JavaResourcePersistentAttribute> getResourceAttributes() {
+ return CollectionTools.iterable(this.resourceAttributes());
+ }
+
+ protected JavaPersistentAttribute buildAttribute(JavaResourcePersistentAttribute resourceAttribute) {
+ return this.getJpaFactory().buildJavaPersistentAttribute(this, resourceAttribute);
+ }
+
+ public boolean hasAnyAnnotatedAttributes() {
+ return this.resourcePersistentType.hasAnyAnnotatedAttributes();
+ }
+
+ /**
+ * The attributes are synchronized during the <em>update</em> because
+ * the list of resource attributes is determined by the access type
+ * which can be controlled in a number of different places....
+ */
+ protected void updateAttributes() {
+ ContextContainerTools.update(this.attributeContainerAdapter);
+ }
+
+ protected void moveAttribute(int index, JavaPersistentAttribute attribute) {
+ this.moveItemInList(index, attribute, this.attributes, ATTRIBUTES_LIST);
+ }
+
+ protected void addAttribute(int index, JavaResourcePersistentAttribute resourceAttribute) {
+ this.addItemToList(index, this.buildAttribute(resourceAttribute), this.attributes, ATTRIBUTES_LIST);
+ }
+
+ protected void removeAttribute(JavaPersistentAttribute attribute) {
+ this.removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST);
+ }
+
+ /**
+ * attribute container adapter
+ */
+ protected class AttributeContainerAdapter
+ implements ContextContainerTools.Adapter<JavaPersistentAttribute, JavaResourcePersistentAttribute>
+ {
+ public Iterable<JavaPersistentAttribute> getContextElements() {
+ return AbstractJavaPersistentType.this.getAttributes();
+ }
+ public Iterable<JavaResourcePersistentAttribute> getResourceElements() {
+ return AbstractJavaPersistentType.this.getResourceAttributes();
+ }
+ public JavaResourcePersistentAttribute getResourceElement(JavaPersistentAttribute contextElement) {
+ return contextElement.getResourcePersistentAttribute();
+ }
+ public void moveContextElement(int index, JavaPersistentAttribute element) {
+ AbstractJavaPersistentType.this.moveAttribute(index, element);
+ }
+ public void addContextElement(int index, JavaResourcePersistentAttribute resourceElement) {
+ AbstractJavaPersistentType.this.addAttribute(index, resourceElement);
+ }
+ public void removeContextElement(JavaPersistentAttribute element) {
+ AbstractJavaPersistentType.this.removeAttribute(element);
+ }
+ }
+
+
+ // ********** inheritance **********
+
+ public Iterator<PersistentType> inheritanceHierarchy() {
+ return this.getInheritanceHierarchy().iterator();
+ }
+
+ public Iterable<PersistentType> getInheritanceHierarchy() {
+ return this.getInheritanceHierarchyOf(this);
+ }
+
+ public Iterator<PersistentType> ancestors() {
+ return this.getAncestors().iterator();
+ }
+
+ public Iterable<PersistentType> getAncestors() {
+ return this.getInheritanceHierarchyOf(this.superPersistentType);
+ }
+
+ protected Iterable<PersistentType> getInheritanceHierarchyOf(PersistentType start) {
+ // using a chain iterable to traverse up the inheritance tree
+ return new ChainIterable<PersistentType>(start) {
+ @Override
+ protected PersistentType nextLink(PersistentType persistentType) {
+ return persistentType.getSuperPersistentType();
+ }
+ };
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return JavaStructureNodes.PERSISTENT_TYPE_ID;
+ }
+
+ // it would be nice if the we passed in an astRoot here, but then we
+ // would need to pass it to the XML structure nodes too...
+ public JpaStructureNode getStructureNode(int offset) {
+ CompilationUnit astRoot = this.buildASTRoot();
+
+ if (this.contains(offset, astRoot)) {
+ for (JavaPersistentAttribute persistentAttribute : this.getAttributes()) {
+ if (persistentAttribute.contains(offset, astRoot)) {
+ return persistentAttribute;
+ }
+ }
+ return this;
+ }
+ return null;
+ }
+
+ protected boolean contains(int offset, CompilationUnit astRoot) {
+ TextRange fullTextRange = this.getFullTextRange(astRoot);
+ // 'fullTextRange' will be null if the type no longer exists in the java;
+ // the context model can be out of synch with the resource model
+ // when a selection event occurs before the context model has a
+ // chance to synch with the resource model via the update thread
+ return (fullTextRange == null) ? false : fullTextRange.includes(offset);
+ }
+
+ protected TextRange getFullTextRange(CompilationUnit astRoot) {
+ return this.resourcePersistentType.getTextRange(astRoot);
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.getSelectionTextRange(this.buildASTRoot());
+ }
+
+ protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
+ return this.resourcePersistentType.getNameTextRange(astRoot);
+ }
+
+ public void dispose() {
+ this.unregisterRootStructureNode();
+ }
+
+ protected void registerRootStructureNode() {
+ JpaFile jpaFile = this.getJpaFile();
+ // the JPA file can be null if the resource type is "external"
+ if (jpaFile != null) {
+ jpaFile.addRootStructureNode(this.name, this);
+ }
+ }
+
+ protected void unregisterRootStructureNode() {
+ JpaFile jpaFile = this.getJpaFile();
+ // the JPA file can be null if the .java file was deleted
+ // or the resource type is "external"
+ if (jpaFile != null) {
+ jpaFile.removeRootStructureNode(this.name, this);
+ }
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ Iterator<String> values = this.mapping.javaCompletionProposals(pos, filter, astRoot);
+ if (values != null) {
+ return values;
+ }
+ for (JavaPersistentAttribute attribute : this.getAttributes()) {
+ values = attribute.javaCompletionProposals(pos, filter, astRoot);
+ if (values != null) {
+ return values;
+ }
+ }
+ return EmptyIterator.instance();
+ }
+
+
+ // ********** validation **********
+
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ if (reporter.isCancelled()) {
+ throw new ValidationCancelledException();
+ }
+ // TODO temporary hack since we don't know yet where to put
+ // any messages for types in another project (e.g. referenced by
+ // persistence.xml)
+ IFile file = this.resourcePersistentType.getFile();
+ // 'file' will be null if the type is "external" and binary;
+ // the file will be in a different project if the type is "external" and source;
+ // the type will be binary if it is in a JAR in the current project
+ if ((file != null) && file.getProject().equals(this.getJpaProject().getProject()) &&
+ (this.resourcePersistentType instanceof SourceNode)) {
+ // build the AST root here to pass down
+ this.validate(messages, reporter, this.buildASTRoot());
+ }
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateMapping(messages, reporter, astRoot);
+ this.validateAttributes(messages, reporter, astRoot);
+ }
+
+ protected void validateMapping(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ try {
+ this.mapping.validate(messages, reporter, astRoot);
+ } catch(Throwable t) {
+ JptJpaCorePlugin.log(t);
+ }
+ }
+
+ protected void validateAttributes(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ for (JavaPersistentAttribute attribute : this.getAttributes()) {
+ this.validateAttribute(attribute, reporter, messages, astRoot);
+ }
+ }
+
+ protected void validateAttribute(JavaPersistentAttribute attribute, IReporter reporter, List<IMessage> messages, CompilationUnit astRoot) {
+ try {
+ attribute.validate(messages, reporter, astRoot);
+ } catch(Throwable t) {
+ JptJpaCorePlugin.log(t);
+ }
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getSelectionTextRange(astRoot);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public PersistentType.Owner getParent() {
+ return (PersistentType.Owner) super.getParent();
+ }
+
+ @Override
+ public IResource getResource() {
+ return this.resourcePersistentType.getFile();
+ }
+
+ public JavaResourcePersistentType getResourcePersistentType() {
+ return this.resourcePersistentType;
+ }
+
+ public AccessType getOwnerOverrideAccess() {
+ return this.getParent().getOverridePersistentTypeAccess();
+ }
+
+ public AccessType getOwnerDefaultAccess() {
+ return this.getParent().getDefaultPersistentTypeAccess();
+ }
+
+ protected CompilationUnit buildASTRoot() {
+ return this.resourcePersistentType.getJavaResourceCompilationUnit().buildASTRoot();
+ }
+
+ protected JpaFile getJpaFile() {
+ return this.getJpaFile(this.resourcePersistentType.getFile());
+ }
+
+ public boolean isFor(String typeName) {
+ return Tools.valuesAreEqual(typeName, this.getName());
+ }
+
+ public boolean isIn(IPackageFragment packageFragment) {
+ return Tools.valuesAreEqual(packageFragment.getElementName(), this.getPackageName());
+ }
+
+ protected String getPackageName() {
+ return this.getResourcePersistentType().getPackageName();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java
new file mode 100644
index 0000000000..9f92fa8592
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.QueryHint;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+
+/**
+ * Java query
+ */
+public abstract class AbstractJavaQuery<A extends QueryAnnotation>
+ extends AbstractJavaJpaContextNode
+ implements JavaQuery
+{
+ protected final A queryAnnotation;
+
+ protected String name;
+
+ protected String query;
+
+ protected final Vector<JavaQueryHint> hints = new Vector<JavaQueryHint>();
+ protected final HintContainerAdapter hintContainerAdapter = new HintContainerAdapter();
+
+
+ protected AbstractJavaQuery(JavaJpaContextNode parent, A queryAnnotation) {
+ super(parent);
+ this.queryAnnotation = queryAnnotation;
+ this.name = queryAnnotation.getName();
+ this.query = queryAnnotation.getQuery();
+ this.initializeHints();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.queryAnnotation.getName());
+ this.setQuery_(this.queryAnnotation.getQuery());
+ this.syncHints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getHints());
+ this.getPersistenceUnit().addQuery(this);
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.queryAnnotation.setName(name);
+ this.setName_(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** query **********
+
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String query) {
+ this.queryAnnotation.setQuery(query);
+ this.setQuery_(query);
+ }
+
+ protected void setQuery_(String query) {
+ String old = this.query;
+ this.query = query;
+ this.firePropertyChanged(QUERY_PROPERTY, old, query);
+ }
+
+
+ // ********** hints **********
+
+ public ListIterable<JavaQueryHint> getHints() {
+ return new LiveCloneListIterable<JavaQueryHint>(this.hints);
+ }
+
+ public int getHintsSize() {
+ return this.hints.size();
+ }
+
+ public JavaQueryHint addHint() {
+ return this.addHint(this.hints.size());
+ }
+
+ public JavaQueryHint addHint(int index) {
+ QueryHintAnnotation annotation = this.queryAnnotation.addHint(index);
+ return this.addHint_(index, annotation);
+ }
+
+ public void removeHint(QueryHint hint) {
+ this.removeHint(this.hints.indexOf(hint));
+ }
+
+ public void removeHint(int index) {
+ this.queryAnnotation.removeHint(index);
+ this.removeHint_(index);
+ }
+
+ protected void removeHint_(int index) {
+ this.removeItemFromList(index, this.hints, HINTS_LIST);
+ }
+
+ public void moveHint(int targetIndex, int sourceIndex) {
+ this.queryAnnotation.moveHint(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.hints, HINTS_LIST);
+ }
+
+ protected void initializeHints() {
+ for (Iterator<QueryHintAnnotation> stream = this.queryAnnotation.hints(); stream.hasNext(); ) {
+ this.hints.add(this.buildHint(stream.next()));
+ }
+ }
+
+ protected JavaQueryHint buildHint(QueryHintAnnotation hintAnnotation) {
+ return this.getJpaFactory().buildJavaQueryHint(this, hintAnnotation);
+ }
+
+ protected void syncHints() {
+ ContextContainerTools.synchronizeWithResourceModel(this.hintContainerAdapter);
+ }
+
+ protected Iterable<QueryHintAnnotation> getHintAnnotations() {
+ return CollectionTools.iterable(this.queryAnnotation.hints());
+ }
+
+ protected void moveHint_(int index, JavaQueryHint hint) {
+ this.moveItemInList(index, hint, this.hints, HINTS_LIST);
+ }
+
+ protected JavaQueryHint addHint_(int index, QueryHintAnnotation hintAnnotation) {
+ JavaQueryHint hint = this.buildHint(hintAnnotation);
+ this.addItemToList(index, hint, this.hints, HINTS_LIST);
+ return hint;
+ }
+
+ protected void removeHint_(JavaQueryHint hint) {
+ this.removeHint_(this.hints.indexOf(hint));
+ }
+
+ /**
+ * hint container adapter
+ */
+ protected class HintContainerAdapter
+ implements ContextContainerTools.Adapter<JavaQueryHint, QueryHintAnnotation>
+ {
+ public Iterable<JavaQueryHint> getContextElements() {
+ return AbstractJavaQuery.this.getHints();
+ }
+ public Iterable<QueryHintAnnotation> getResourceElements() {
+ return AbstractJavaQuery.this.getHintAnnotations();
+ }
+ public QueryHintAnnotation getResourceElement(JavaQueryHint contextElement) {
+ return contextElement.getQueryHintAnnotation();
+ }
+ public void moveContextElement(int index, JavaQueryHint element) {
+ AbstractJavaQuery.this.moveHint_(index, element);
+ }
+ public void addContextElement(int index, QueryHintAnnotation resourceElement) {
+ AbstractJavaQuery.this.addHint_(index, resourceElement);
+ }
+ public void removeContextElement(JavaQueryHint element) {
+ AbstractJavaQuery.this.removeHint_(element);
+ }
+ }
+
+
+ // ********** misc **********
+
+ public A getQueryAnnotation() {
+ return this.queryAnnotation;
+ }
+
+ public boolean overrides(Query other) {
+ return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST);
+ }
+
+ public boolean duplicates(Query other) {
+ return MappingTools.nodesAreDuplicates(this, other);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.queryAnnotation.getTextRange(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.queryAnnotation.getNameTextRange(astRoot);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java
new file mode 100644
index 0000000000..053fe6fb83
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyUniqueConstraint;
+
+public abstract class AbstractJavaReadOnlyUniqueConstraint
+ extends AbstractJavaJpaContextNode
+ implements JavaReadOnlyUniqueConstraint
+{
+ protected final Vector<String> columnNames = new Vector<String>();
+
+
+ public AbstractJavaReadOnlyUniqueConstraint(JavaJpaContextNode parent) {
+ super(parent);
+ }
+
+
+ // ********** column names **********
+
+ public Iterable<String> getColumnNames() {
+ return new LiveCloneIterable<String>(this.columnNames);
+ }
+
+ public int getColumnNamesSize() {
+ return this.columnNames.size();
+ }
+
+ public String getColumnName(int index) {
+ return this.columnNames.get(index);
+ }
+
+ protected void syncColumnNames() {
+ this.synchronizeList(this.getResourceColumnNames(), this.columnNames, COLUMN_NAMES_LIST);
+ }
+
+ protected abstract Iterable<String> getResourceColumnNames();
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.columnNames);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
new file mode 100644
index 0000000000..95788f0127
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
@@ -0,0 +1,347 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaCascade;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaCascade;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java relationship mapping (1:1, 1:m, m:1, m:m)
+ */
+public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMappingAnnotation>
+ extends AbstractJavaAttributeMapping<A>
+ implements JavaRelationshipMapping
+{
+ protected String specifiedTargetEntity;
+ protected String defaultTargetEntity;
+ protected String fullyQualifiedTargetEntity;
+
+ protected final JavaMappingRelationship relationship;
+
+ protected final JavaCascade cascade;
+
+ protected FetchType specifiedFetch;
+ protected FetchType defaultFetch;
+
+
+ protected AbstractJavaRelationshipMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.specifiedTargetEntity = this.buildSpecifiedTargetEntity();
+ this.relationship = this.buildRelationship();
+ this.cascade = this.buildCascade();
+ this.specifiedFetch = this.buildSpecifiedFetch();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTargetEntity_(this.buildSpecifiedTargetEntity());
+ this.relationship.synchronizeWithResourceModel();
+ this.cascade.synchronizeWithResourceModel();
+ this.setSpecifiedFetch_(this.buildSpecifiedFetch());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
+ this.setFullyQualifiedTargetEntity(this.buildFullyQualifiedTargetEntity());
+ this.relationship.update();
+ this.cascade.update();
+ this.setDefaultFetch(this.buildDefaultFetch());
+ }
+
+
+ // ********** target entity **********
+
+ public String getTargetEntity() {
+ return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
+ }
+
+ public String getSpecifiedTargetEntity() {
+ return this.specifiedTargetEntity;
+ }
+
+ public void setSpecifiedTargetEntity(String entity) {
+ if (this.valuesAreDifferent(entity, this.specifiedTargetEntity)) {
+ this.getAnnotationForUpdate().setTargetEntity(entity);
+ this.setSpecifiedTargetEntity_(entity);
+ }
+ }
+
+ protected void setSpecifiedTargetEntity_(String entity) {
+ String old = this.specifiedTargetEntity;
+ this.specifiedTargetEntity = entity;
+ this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity);
+ }
+
+ protected String buildSpecifiedTargetEntity() {
+ A annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getTargetEntity();
+ }
+
+ public String getDefaultTargetEntity() {
+ return this.defaultTargetEntity;
+ }
+
+ protected void setDefaultTargetEntity(String entity) {
+ String old = this.defaultTargetEntity;
+ this.defaultTargetEntity = entity;
+ this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity);
+ }
+
+ protected abstract String buildDefaultTargetEntity();
+
+ public String getFullyQualifiedTargetEntity() {
+ return this.fullyQualifiedTargetEntity;
+ }
+
+ protected void setFullyQualifiedTargetEntity(String entity) {
+ String old = this.fullyQualifiedTargetEntity;
+ this.fullyQualifiedTargetEntity = entity;
+ this.firePropertyChanged(FULLY_QUALIFIED_TARGET_ENTITY_PROPERTY, old, entity);
+ }
+
+ protected String buildFullyQualifiedTargetEntity() {
+ return (this.specifiedTargetEntity == null) ?
+ this.defaultTargetEntity :
+ this.getMappingAnnotation().getFullyQualifiedTargetEntityClassName();
+ }
+
+ public Entity getResolvedTargetEntity() {
+ return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetEntity);
+ }
+
+ // sub-classes like this to be public
+ public PersistentType getResolvedTargetType() {
+ return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetEntity);
+ }
+
+ public char getTargetEntityEnclosingTypeSeparator() {
+ return '.';
+ }
+
+
+ // ********** relationship reference **********
+
+ public JavaMappingRelationship getRelationship() {
+ return this.relationship;
+ }
+
+ protected abstract JavaMappingRelationship buildRelationship();
+
+
+ // ********** cascade **********
+
+ public JavaCascade getCascade() {
+ return this.cascade;
+ }
+
+ protected JavaCascade buildCascade() {
+ // NB: we don't use the platform
+ return new GenericJavaCascade(this);
+ }
+
+
+ // ********** fetch **********
+
+ public FetchType getFetch() {
+ return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType fetch) {
+ if (this.valuesAreDifferent(fetch, this.specifiedFetch)) {
+ this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch));
+ this.setSpecifiedFetch_(fetch);
+ }
+ }
+
+ protected void setSpecifiedFetch_(FetchType fetch) {
+ FetchType old = this.specifiedFetch;
+ this.specifiedFetch = fetch;
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildSpecifiedFetch() {
+ A annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch());
+ }
+
+ public FetchType getDefaultFetch() {
+ return this.defaultFetch;
+ }
+
+ protected void setDefaultFetch(FetchType fetch) {
+ FetchType old = this.defaultFetch;
+ this.defaultFetch = fetch;
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected abstract FetchType buildDefaultFetch();
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isRelationshipOwner() {
+ return this.relationship.isOwner();
+ }
+
+ @Override
+ public boolean isOwnedBy(AttributeMapping mapping) {
+ return mapping.isRelationshipOwner() &&
+ this.relationship.isOwnedBy((RelationshipMapping) mapping);
+ }
+
+ public RelationshipMapping getRelationshipOwner() {
+ Entity entity = this.getResolvedTargetEntity();
+ if (entity == null) {
+ return null;
+ }
+ for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(entity.getPersistentType().allAttributes())) {
+ AttributeMapping mapping = attribute.getMapping();
+ if (this.isOwnedBy(mapping)) {
+ return (RelationshipMapping) mapping;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isOverridableAssociationMapping() {
+ return this.relationship.isOverridable();
+ }
+
+ public Iterator<String> allTargetEntityAttributeNames() {
+ return new CompositeIterator<String>(this.allTargetEntityAttributeNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> allTargetEntityAttributeNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.allTargetEntityAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<AttributeMapping> allTargetEntityAttributeMappings() {
+ Entity entity = this.getResolvedTargetEntity();
+ return (entity != null) ? entity.allAttributeMappings() : EmptyIterator.<AttributeMapping> instance();
+ }
+
+ protected String getTargetEntityIdAttributeName() {
+ PersistentAttribute attribute = this.getTargetEntityIdAttribute();
+ return (attribute == null) ? null : attribute.getName();
+ }
+
+ protected PersistentAttribute getTargetEntityIdAttribute() {
+ Entity entity = this.getResolvedTargetEntity();
+ return (entity == null) ? null : entity.getIdAttribute();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.relationship.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return null;
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ public String getMetamodelTypeName() {
+ return (this.fullyQualifiedTargetEntity != null) ? this.fullyQualifiedTargetEntity : MetamodelField.DEFAULT_TYPE_NAME;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateTargetEntity(messages, astRoot);
+ this.relationship.validate(messages, reporter, astRoot);
+ }
+
+ protected void validateTargetEntity(List<IMessage> messages, CompilationUnit astRoot) {
+ if (this.getTargetEntity() == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ else if (this.getResolvedTargetEntity() == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY,
+ new String[] {this.getTargetEntity(), this.getName()},
+ this,
+ this.getTargetEntityTextRange(astRoot)
+ )
+ );
+ }
+ }
+
+ protected TextRange getTargetEntityTextRange(CompilationUnit astRoot) {
+ A annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : this.getTextRange(annotation.getTargetEntityTextRange(astRoot), astRoot);
+ }
+
+ protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) {
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java
new file mode 100644
index 0000000000..c81dbb41b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.db.Schema;
+
+/**
+ * Java sequence generator
+ */
+public abstract class AbstractJavaSequenceGenerator<A extends SequenceGeneratorAnnotation>
+ extends AbstractJavaGenerator<A>
+ implements JavaSequenceGenerator
+{
+ protected String specifiedSequenceName;
+ protected String defaultSequenceName;
+
+
+ protected AbstractJavaSequenceGenerator(JavaJpaContextNode parent, A generatorAnnotation) {
+ super(parent, generatorAnnotation);
+ this.specifiedSequenceName = generatorAnnotation.getSequenceName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedSequenceName_(this.generatorAnnotation.getSequenceName());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultSequenceName(this.buildDefaultSequenceName());
+ }
+
+
+ // ********** initial value **********
+
+ @Override
+ protected int buildDefaultInitialValue() {
+ return DEFAULT_INITIAL_VALUE;
+ }
+
+
+ // ********** sequence name **********
+
+ public String getSequenceName() {
+ return (this.specifiedSequenceName != null) ? this.specifiedSequenceName : this.defaultSequenceName;
+ }
+
+ public String getSpecifiedSequenceName() {
+ return this.specifiedSequenceName;
+ }
+
+ public void setSpecifiedSequenceName(String name) {
+ this.generatorAnnotation.setSequenceName(name);
+ this.setSpecifiedSequenceName_(name);
+ }
+
+ protected void setSpecifiedSequenceName_(String name) {
+ String old = this.specifiedSequenceName;
+ this.specifiedSequenceName = name;
+ this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, name);
+ }
+
+ public String getDefaultSequenceName() {
+ return this.defaultSequenceName;
+ }
+
+ protected void setDefaultSequenceName(String name) {
+ String old = this.defaultSequenceName;
+ this.defaultSequenceName = name;
+ this.firePropertyChanged(DEFAULT_SEQUENCE_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultSequenceName() {
+ return null; // TODO the default sequence name is determined by the runtime provider...
+ }
+
+
+ // ********** Java completion proposals **********
+
+ /**
+ * called if the database is connected:
+ * sequenceName
+ */
+ @Override
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.sequenceNameTouches(pos, astRoot)) {
+ return this.getJavaCandidateSequences(filter).iterator();
+ }
+ return null;
+ }
+
+ protected boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
+ return this.generatorAnnotation.sequenceNameTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateSequences(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateSequences(filter));
+ }
+
+ protected Iterable<String> getCandidateSequences(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateSequences(), filter);
+ }
+
+ protected Iterable<String> getCandidateSequences() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema != null) ? dbSchema.getSortedSequenceIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
new file mode 100644
index 0000000000..38ee6dc2c2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.java.SingleRelationshipMappingAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java single relationship mapping (1:1, m:1)
+ */
+public abstract class AbstractJavaSingleRelationshipMapping<A extends SingleRelationshipMappingAnnotation>
+ extends AbstractJavaRelationshipMapping<A>
+ implements JavaSingleRelationshipMapping2_0
+{
+ protected Boolean specifiedOptional;
+ protected boolean defaultOptional;
+
+ protected final JavaDerivedIdentity2_0 derivedIdentity;
+
+
+ protected AbstractJavaSingleRelationshipMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.specifiedOptional = this.buildSpecifiedOptional();
+ this.derivedIdentity = this.buildDerivedIdentity();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedOptional_(this.buildSpecifiedOptional());
+ this.derivedIdentity.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultOptional(this.buildDefaultOptional());
+ this.derivedIdentity.update();
+ }
+
+
+ // ********** optional **********
+
+ public boolean isOptional() {
+ return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.defaultOptional;
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean optional) {
+ if (this.valuesAreDifferent(optional, this.specifiedOptional)) {
+ this.getAnnotationForUpdate().setOptional(optional);
+ this.setSpecifiedOptional_(optional);
+ }
+ }
+
+ protected void setSpecifiedOptional_(Boolean optional) {
+ Boolean old = this.specifiedOptional;
+ this.specifiedOptional = optional;
+ this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ protected Boolean buildSpecifiedOptional() {
+ A annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getOptional();
+ }
+
+ public boolean isDefaultOptional() {
+ return this.defaultOptional;
+ }
+
+ protected void setDefaultOptional(boolean optional) {
+ boolean old = this.defaultOptional;
+ this.defaultOptional = optional;
+ this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ protected boolean buildDefaultOptional() {
+ return DEFAULT_OPTIONAL;
+ }
+
+
+ // ********** derived identity **********
+
+ public JavaDerivedIdentity2_0 getDerivedIdentity() {
+ return this.derivedIdentity;
+ }
+
+ protected JavaDerivedIdentity2_0 buildDerivedIdentity() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaDerivedIdentity(this) :
+ new NullJavaDerivedIdentity2_0(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+ @Override
+ protected String buildDefaultTargetEntity() {
+ return this.getPersistentAttribute().getSingleReferenceTargetTypeName();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.derivedIdentity.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.derivedIdentity.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java
new file mode 100644
index 0000000000..302f4af238
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java
@@ -0,0 +1,584 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.NameTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java table, secondary table, join table, or collection table
+ * <p>
+ * <strong>NB:</strong> any subclass that directly holds its table
+ * annotation must:<ul>
+ * <li>call the "super" constructor that takes a table annotation
+ * {@link #AbstractJavaTable(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, BaseTableAnnotation)}
+ * <li>override {@link #setTableAnnotation(BaseTableAnnotation)} to set the table
+ * annotation so it is in place before the table's state
+ * (e.g. {@link #specifiedName}) is initialized
+ * </ul>
+ */
+public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
+ extends AbstractJavaJpaContextNode
+ implements JavaTable, UniqueConstraint.Owner
+{
+ protected final Owner owner;
+
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected final Vector<JavaUniqueConstraint> uniqueConstraints = new Vector<JavaUniqueConstraint>();
+ protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+
+
+ protected AbstractJavaTable(JavaJpaContextNode parent, Owner owner) {
+ this(parent, owner, null);
+ }
+
+ protected AbstractJavaTable(JavaJpaContextNode parent, Owner owner, A tableAnnotation) {
+ super(parent);
+ this.owner = owner;
+ this.setTableAnnotation(tableAnnotation);
+ this.specifiedName = this.buildSpecifiedName();
+ this.specifiedSchema = this.buildSpecifiedSchema();
+ this.specifiedCatalog = this.buildSpecifiedCatalog();
+ this.initializeUniqueConstraints();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedName_(this.buildSpecifiedName());
+ this.setSpecifiedSchema_(this.buildSpecifiedSchema());
+ this.setSpecifiedCatalog_(this.buildSpecifiedCatalog());
+ this.syncUniqueConstraints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultName(this.buildDefaultName());
+ this.setDefaultSchema(this.buildDefaultSchema());
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.updateNodes(this.getUniqueConstraints());
+ }
+
+
+ // ********** table annotation **********
+
+ /**
+ * Return the Java table annotation. Do not return <code>null</code> if the
+ * Java annotation does not exist; return a <em>null</em> table annotation
+ * instead.
+ */
+ public abstract A getTableAnnotation();
+
+ /**
+ * see class comment... ({@link AbstractJavaTable})
+ */
+ protected void setTableAnnotation(A tableAnnotation) {
+ if (tableAnnotation != null) {
+ throw new IllegalArgumentException("this method must be overridden if the table annotation is not null: " + tableAnnotation); //$NON-NLS-1$
+ }
+ }
+
+ protected void removeTableAnnotationIfUnset() {
+ if (this.getTableAnnotation().isUnset()) {
+ this.removeTableAnnotation();
+ }
+ }
+
+ protected abstract void removeTableAnnotation();
+
+ public boolean isSpecifiedInResource() {
+ return this.getTableAnnotation().isSpecified();
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String name) {
+ if (this.valuesAreDifferent(this.specifiedName, name)) {
+ this.getTableAnnotation().setName(name);
+ this.removeTableAnnotationIfUnset();
+ this.setSpecifiedName_(name);
+ }
+ }
+
+ protected void setSpecifiedName_(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ return this.getTableAnnotation().getName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected abstract String buildDefaultName();
+
+
+ // ********** schema **********
+
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ if (this.valuesAreDifferent(this.specifiedSchema, schema)) {
+ this.getTableAnnotation().setSchema(schema);
+ this.removeTableAnnotationIfUnset();
+ this.setSpecifiedSchema_(schema);
+ }
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildSpecifiedSchema() {
+ return this.getTableAnnotation().getSchema();
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected abstract String buildDefaultSchema();
+
+
+ // ********** catalog **********
+
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ if (this.valuesAreDifferent(this.specifiedCatalog, catalog)) {
+ this.getTableAnnotation().setCatalog(catalog);
+ this.removeTableAnnotationIfUnset();
+ this.setSpecifiedCatalog_(catalog);
+ }
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildSpecifiedCatalog() {
+ return this.getTableAnnotation().getCatalog();
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected abstract String buildDefaultCatalog();
+
+
+ // ********** unique constraints **********
+
+ public ListIterator<JavaUniqueConstraint> uniqueConstraints() {
+ return this.getUniqueConstraints().iterator();
+ }
+
+ protected ListIterable<JavaUniqueConstraint> getUniqueConstraints() {
+ return new LiveCloneListIterable<JavaUniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public JavaUniqueConstraint getUniqueConstraint(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public JavaUniqueConstraint addUniqueConstraint() {
+ return this.addUniqueConstraint(this.uniqueConstraints.size());
+ }
+
+ public JavaUniqueConstraint addUniqueConstraint(int index) {
+ UniqueConstraintAnnotation annotation = this.getTableAnnotation().addUniqueConstraint(index);
+ return this.addUniqueConstraint_(index, annotation);
+ }
+
+ public void removeUniqueConstraint(UniqueConstraint constraint) {
+ this.removeUniqueConstraint(this.uniqueConstraints.indexOf(constraint));
+ }
+
+ public void removeUniqueConstraint(int index) {
+ this.getTableAnnotation().removeUniqueConstraint(index);
+ this.removeTableAnnotationIfUnset();
+ this.removeUniqueConstraint_(index);
+ }
+
+ protected void removeUniqueConstraint_(int index) {
+ this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ this.getTableAnnotation().moveUniqueConstraint(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected void initializeUniqueConstraints() {
+ for (Iterator<UniqueConstraintAnnotation> stream = this.getTableAnnotation().uniqueConstraints(); stream.hasNext(); ) {
+ this.uniqueConstraints.add(this.buildUniqueConstraint(stream.next()));
+ }
+ }
+
+ protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
+ return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
+ }
+
+ protected void syncUniqueConstraints() {
+ ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
+ }
+
+ protected Iterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
+ return CollectionTools.iterable(this.getTableAnnotation().uniqueConstraints());
+ }
+
+ protected void moveUniqueConstraint_(int index, JavaUniqueConstraint constraint) {
+ this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected JavaUniqueConstraint addUniqueConstraint_(int index, UniqueConstraintAnnotation constraintAnnotation) {
+ JavaUniqueConstraint constraint = this.buildUniqueConstraint(constraintAnnotation);
+ this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ return constraint;
+ }
+
+ protected void removeUniqueConstraint_(JavaUniqueConstraint constraint) {
+ this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(constraint));
+ }
+
+ /**
+ * unique constraint container adapter
+ */
+ protected class UniqueConstraintContainerAdapter
+ implements ContextContainerTools.Adapter<JavaUniqueConstraint, UniqueConstraintAnnotation>
+ {
+ public Iterable<JavaUniqueConstraint> getContextElements() {
+ return AbstractJavaTable.this.getUniqueConstraints();
+ }
+ public Iterable<UniqueConstraintAnnotation> getResourceElements() {
+ return AbstractJavaTable.this.getUniqueConstraintAnnotations();
+ }
+ public UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
+ return contextElement.getUniqueConstraintAnnotation();
+ }
+ public void moveContextElement(int index, JavaUniqueConstraint element) {
+ AbstractJavaTable.this.moveUniqueConstraint_(index, element);
+ }
+ public void addContextElement(int index, UniqueConstraintAnnotation resourceElement) {
+ AbstractJavaTable.this.addUniqueConstraint_(index, resourceElement);
+ }
+ public void removeContextElement(JavaUniqueConstraint element) {
+ AbstractJavaTable.this.removeUniqueConstraint_(element);
+ }
+ }
+
+
+ // ********** database stuff **********
+
+ public org.eclipse.jpt.jpa.db.Table getDbTable() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
+ }
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ public boolean isResolved() {
+ return this.getDbTable() != null;
+ }
+
+ public boolean schemaIsResolved() {
+ return this.getDbSchema() != null;
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public boolean catalogIsResolved() {
+ String catalog = this.getCatalog();
+ return (catalog == null) || (this.resolveDbCatalog(catalog) != null);
+ }
+
+
+ // ********** UniqueConstraint.Owner implementation **********
+
+ public Iterator<String> candidateUniqueConstraintColumnNames() {
+ org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
+ return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.<String>instance();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaUniqueConstraint constraint : CollectionTools.iterable(this.uniqueConstraints())) {
+ result = constraint.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * called if the database is connected:
+ * name, schema, catalog
+ */
+ @Override
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.nameTouches(pos, astRoot)) {
+ return this.getJavaCandidateNames(filter).iterator();
+ }
+ if (this.schemaTouches(pos, astRoot)) {
+ return this.getJavaCandidateSchemata(filter).iterator();
+ }
+ if (this.catalogTouches(pos, astRoot)) {
+ return this.getJavaCandidateCatalogs(filter).iterator();
+ }
+ return null;
+ }
+
+ protected boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.getTableAnnotation().nameTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateNames(filter));
+ }
+
+ protected Iterable<String> getCandidateNames(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateNames(), filter);
+ }
+
+ protected Iterable<String> getCandidateNames() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema != null) ? dbSchema.getSortedTableIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+ protected boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return this.getTableAnnotation().schemaTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateSchemata(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateSchemata(filter));
+ }
+
+ protected Iterable<String> getCandidateSchemata(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateSchemata(), filter);
+ }
+
+ protected Iterable<String> getCandidateSchemata() {
+ return this.getDbSchemaContainer().getSortedSchemaIdentifiers();
+ }
+
+ protected boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return this.getTableAnnotation().catalogTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateCatalogs(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateCatalogs(filter));
+ }
+
+ protected Iterable<String> getCandidateCatalogs(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateCatalogs(), filter);
+ }
+
+ protected Iterable<String> getCandidateCatalogs() {
+ Database db = this.getDatabase();
+ return (db != null) ? db.getSortedCatalogIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.buildTableValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected JptValidator buildTableValidator(CompilationUnit astRoot) {
+ return this.owner.buildTableValidator(this, buildTextRangeResolver(astRoot));
+ }
+
+ protected TableTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaTableTextRangeResolver(this, astRoot);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getTextRange(this.getTableAnnotation().getTextRange(astRoot), astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getTextRange(this.getTableAnnotation().getNameTextRange(astRoot), astRoot);
+ }
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ return this.getTextRange(this.getTableAnnotation().getSchemaTextRange(astRoot), astRoot);
+ }
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ return this.getTextRange(this.getTableAnnotation().getCatalogTextRange(astRoot), astRoot);
+ }
+
+ protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) {
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaJpaContextNode getParent() {
+ return (JavaJpaContextNode) super.getParent();
+ }
+
+ protected void initializeFrom(ReadOnlyTable oldTable) {
+ this.setSpecifiedName(oldTable.getSpecifiedName());
+ this.setSpecifiedCatalog(oldTable.getSpecifiedCatalog());
+ this.setSpecifiedSchema(oldTable.getSpecifiedSchema());
+ for (ReadOnlyUniqueConstraint constraint : CollectionTools.iterable(oldTable.uniqueConstraints())) {
+ this.addUniqueConstraint().initializeFrom(constraint);
+ }
+ }
+
+ protected void initializeFromVirtual(ReadOnlyTable virtualTable) {
+ this.setSpecifiedName(virtualTable.getName());
+ // ignore other settings?
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.buildQualifiedName());
+ }
+
+ protected String buildQualifiedName() {
+ return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java
new file mode 100644
index 0000000000..7aeada737c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.NotNullFilter;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java type mapping
+ */
+public abstract class AbstractJavaTypeMapping<A extends Annotation>
+ extends AbstractJavaJpaContextNode
+ implements JavaTypeMapping
+{
+ // this can be null for a "null" type mapping
+ protected final A mappingAnnotation;
+
+
+ protected AbstractJavaTypeMapping(JavaPersistentType parent, A mappingAnnotation) {
+ super(parent);
+ this.mappingAnnotation = mappingAnnotation;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaPersistentType getParent() {
+ return (JavaPersistentType) super.getParent();
+ }
+
+ public JavaPersistentType getPersistentType() {
+ return this.getParent();
+ }
+
+ public JavaResourcePersistentType getResourcePersistentType() {
+ return this.getPersistentType().getResourcePersistentType();
+ }
+
+ public String getName() {
+ return this.getPersistentType().getName();
+ }
+
+ public A getMappingAnnotation() {
+ return this.mappingAnnotation;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getPersistentType().getName());
+ }
+
+
+ // ********** tables **********
+
+ public String getPrimaryTableName() {
+ return null;
+ }
+
+ public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() {
+ return null;
+ }
+
+ public Schema getDbSchema() {
+ return null;
+ }
+
+ public Iterator<ReadOnlyTable> associatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ReadOnlyTable> allAssociatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> allAssociatedTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return null;
+ }
+
+
+ // ********** inheritance **********
+
+ public TypeMapping getSuperTypeMapping() {
+ PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType();
+ return (superPersistentType == null) ? null : superPersistentType.getMapping();
+ }
+
+ public Iterator<TypeMapping> inheritanceHierarchy() {
+ return this.convertToMappings(this.getPersistentType().inheritanceHierarchy());
+ }
+
+ protected Iterable<TypeMapping> getInheritanceHierarchy() {
+ return CollectionTools.iterable(this.inheritanceHierarchy());
+ }
+
+ /**
+ * Return the type mapping's "persistence" ancestors,
+ * <em>excluding</em> the type mapping itself.
+ * The returned iterator will return elements infinitely if the hierarchy
+ * has a loop.
+ */
+ protected Iterator<TypeMapping> ancestors() {
+ return this.convertToMappings(this.getPersistentType().ancestors());
+ }
+
+ protected Iterable<TypeMapping> getAncestors() {
+ return CollectionTools.iterable(this.ancestors());
+ }
+
+ protected Iterator<TypeMapping> convertToMappings(Iterator<PersistentType> types) {
+ return new TransformationIterator<PersistentType, TypeMapping>(types) {
+ @Override
+ protected TypeMapping transform(PersistentType type) {
+ return type.getMapping();
+ }
+ };
+ }
+
+
+ // ********** attribute mappings **********
+
+ public Iterator<JavaAttributeMapping> attributeMappings() {
+ return new TransformationIterator<JavaPersistentAttribute, JavaAttributeMapping>(this.getPersistentType().attributes()) {
+ @Override
+ protected JavaAttributeMapping transform(JavaPersistentAttribute attribute) {
+ return attribute.getMapping();
+ }
+ };
+ }
+
+ public Iterable<JavaAttributeMapping> getAttributeMappings(final String mappingKey) {
+ return new FilteringIterable<JavaAttributeMapping>(CollectionTools.collection(this.attributeMappings())) {
+ @Override
+ protected boolean accept(JavaAttributeMapping o) {
+ return Tools.valuesAreEqual(o.getKey(), mappingKey);
+ }
+ };
+ }
+
+ public Iterator<AttributeMapping> allAttributeMappings() {
+ return new CompositeIterator<AttributeMapping>(this.allAttributeMappingsLists());
+ }
+
+ protected Iterator<Iterator<AttributeMapping>> allAttributeMappingsLists() {
+ return new TransformationIterator<TypeMapping, Iterator<AttributeMapping>>(this.nonNullInheritanceHierarchy(), TypeMappingTools.ATTRIBUTE_MAPPINGS_TRANSFORMER);
+ }
+
+ protected Iterator<TypeMapping> nonNullInheritanceHierarchy() {
+ return new FilteringIterator<TypeMapping>(this.inheritanceHierarchy(), NotNullFilter.<TypeMapping>instance());
+ }
+
+ public Iterable<AttributeMapping> getAllAttributeMappings(final String mappingKey) {
+ return new FilteringIterable<AttributeMapping>(CollectionTools.collection(this.allAttributeMappings())) {
+ @Override
+ protected boolean accept(AttributeMapping o) {
+ return Tools.valuesAreEqual(o.getKey(), mappingKey);
+ }
+ };
+ }
+
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return true;
+ }
+
+
+ // ********** attribute overrides **********
+
+ public Iterator<String> overridableAttributeNames() {
+ return new CompositeIterator<String>(this.overridableAttributeNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> overridableAttributeNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return new CompositeIterator<String>(this.allOverridableAttributeNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> allOverridableAttributeNamesLists() {
+ return new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER);
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) {
+ Column column = attributeMapping.resolveOverriddenColumn(attributeName);
+ if (column != null) {
+ return column;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** association overrides **********
+
+ public Iterator<String> overridableAssociationNames() {
+ return new CompositeIterator<String>(this.overridableAssociationNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> overridableAssociationNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ public Iterator<String> allOverridableAssociationNames() {
+ return new CompositeIterator<String>(this.allOverridableAssociationNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> allOverridableAssociationNamesLists() {
+ return new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER);
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) {
+ Relationship relationship = attributeMapping.resolveOverriddenRelationship(attributeName);
+ if (relationship != null) {
+ return relationship;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateType(messages, reporter, astRoot);
+ }
+
+ protected void validateType(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.buildTypeMappingValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) {
+ return new GenericTypeMappingValidator(this, this.getResourcePersistentType(), buildTextRangeResolver(astRoot));
+ }
+
+ protected TypeMappingTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaTypeMappingTextRangeResolver(this, astRoot);
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.getPersistenceUnit().validatesAgainstDatabase();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.mappingAnnotation.getTextRange(astRoot);
+ return (textRange != null) ? textRange : this.getPersistentType().getValidationTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java
new file mode 100644
index 0000000000..b88646d9e0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.Association;
+import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java version mapping
+ */
+public abstract class AbstractJavaVersionMapping
+ extends AbstractJavaAttributeMapping<VersionAnnotation>
+ implements JavaVersionMapping
+{
+ protected final JavaColumn column;
+
+ protected JavaConverter converter; // never null
+
+
+ // the spec does not list Temporal explicitly,
+ // but it is included in the orm.xml schema...
+ protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] {
+ JavaTemporalConverter.Adapter.instance(),
+ };
+ protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractJavaVersionMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.column = this.buildColumn();
+ this.converter = this.buildConverter();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ this.syncConverter();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ this.converter.update();
+ }
+
+
+ // ********** column **********
+
+ public JavaColumn getColumn() {
+ return this.column;
+ }
+
+ protected JavaColumn buildColumn() {
+ return this.getJpaFactory().buildJavaColumn(this, this);
+ }
+
+
+ // ********** converter **********
+
+ public JavaConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ this.converter.dispose();
+ JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.retainConverterAnnotation(converterAdapter);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ }
+ }
+
+ protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getJpaFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(JavaConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ /**
+ * Clear all the converter annotations <em>except</em> for the annotation
+ * corresponding to the specified adapter. If the specified adapter is
+ * <code>null</code>, remove <em>all</em> the converter annotations.
+ */
+ protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter != converterAdapter) {
+ adapter.removeConverterAnnotation(resourceAttribute);
+ }
+ }
+ }
+
+ protected JavaConverter buildConverter() {
+ JpaFactory jpaFactory = this.getJpaFactory();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory);
+ if (javaConverter != null) {
+ return javaConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ Association<JavaConverter.Adapter, Annotation> assoc = this.getConverterAnnotation();
+ if (assoc == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ JavaConverter.Adapter adapter = assoc.getKey();
+ Annotation annotation = assoc.getValue();
+ if ((this.converter.getType() == adapter.getConverterType()) &&
+ (this.converter.getConverterAnnotation() == annotation)) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first converter annotation we find along with its corresponding
+ * adapter. Return <code>null</code> if there are no converter annotations.
+ */
+ protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
+ if (annotation != null) {
+ return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation);
+ }
+ }
+ return null;
+ }
+
+ protected JavaConverter buildNullConverter() {
+ return new NullJavaConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected JavaConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<JavaConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return VersionAnnotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** JavaColumn.Owner implementation **********
+
+ public ColumnAnnotation getColumnAnnotation() {
+ return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeColumnAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ public String getDefaultColumnName() {
+ return this.getName();
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.converter.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.column.validate(messages, reporter, astRoot);
+ this.converter.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java
new file mode 100644
index 0000000000..5c62ad3ecc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
+
+public abstract class AbstractJavaVersionMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ protected AbstractJavaVersionMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return VersionAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ ColumnAnnotation.ANNOTATION_NAME,
+ TemporalAnnotation.ANNOTATION_NAME,
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaVersionMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java
new file mode 100644
index 0000000000..a28099d901
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
+import org.eclipse.jpt.jpa.core.context.VirtualBaseColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+
+public abstract class AbstractJavaVirtualBaseColumn<O extends ReadOnlyNamedColumn.Owner, C extends BaseColumn>
+ extends AbstractJavaVirtualNamedColumn<O, C>
+ implements VirtualBaseColumn
+{
+ protected String specifiedTable;
+ protected String defaultTable;
+
+ protected Boolean specifiedUnique;
+ protected boolean defaultUnique;
+
+ protected Boolean specifiedNullable;
+ protected boolean defaultNullable;
+
+ protected Boolean specifiedInsertable;
+ protected boolean defaultInsertable;
+
+ protected Boolean specifiedUpdatable;
+ protected boolean defaultUpdatable;
+
+
+ protected AbstractJavaVirtualBaseColumn(JavaJpaContextNode parent, O owner) {
+ super(parent, owner);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedTable(this.buildSpecifiedTable());
+ this.setDefaultTable(this.buildDefaultTable());
+
+ this.setSpecifiedUnique(this.buildSpecifiedUnique());
+ this.setDefaultUnique(this.buildDefaultUnique());
+
+ this.setSpecifiedNullable(this.buildSpecifiedNullable());
+ this.setDefaultNullable(this.buildDefaultNullable());
+
+ this.setSpecifiedInsertable(this.buildSpecifiedInsertable());
+ this.setDefaultInsertable(this.buildDefaultInsertable());
+
+ this.setSpecifiedUpdatable(this.buildSpecifiedUpdatable());
+ this.setDefaultUpdatable(this.buildDefaultUpdatable());
+ }
+
+
+ // ********** table **********
+
+ public String getTable() {
+ return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ protected void setSpecifiedTable(String table) {
+ String old = this.specifiedTable;
+ this.specifiedTable = table;
+ this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildSpecifiedTable() {
+ return this.getOverriddenColumn().getSpecifiedTable();
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String table) {
+ String old = this.defaultTable;
+ this.defaultTable = table;
+ this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildDefaultTable() {
+ return this.owner.getDefaultTableName();
+ }
+
+
+ // ********** unique **********
+
+ public boolean isUnique() {
+ return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique();
+ }
+
+ public Boolean getSpecifiedUnique() {
+ return this.specifiedUnique;
+ }
+
+ protected void setSpecifiedUnique(Boolean unique) {
+ Boolean old = this.specifiedUnique;
+ this.specifiedUnique = unique;
+ this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique);
+ }
+
+ protected Boolean buildSpecifiedUnique() {
+ return this.getOverriddenColumn().getSpecifiedUnique();
+ }
+
+ public boolean isDefaultUnique() {
+ return this.defaultUnique;
+ }
+
+ protected void setDefaultUnique(boolean unique) {
+ boolean old = this.defaultUnique;
+ this.defaultUnique = unique;
+ this.firePropertyChanged(DEFAULT_UNIQUE_PROPERTY, old, unique);
+ }
+
+ protected boolean buildDefaultUnique() {
+ return DEFAULT_UNIQUE;
+ }
+
+
+ // ********** nullable **********
+
+ public boolean isNullable() {
+ return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable();
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ protected void setSpecifiedNullable(Boolean nullable) {
+ Boolean old = this.specifiedNullable;
+ this.specifiedNullable = nullable;
+ this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected Boolean buildSpecifiedNullable() {
+ return this.getOverriddenColumn().getSpecifiedNullable();
+ }
+
+ public boolean isDefaultNullable() {
+ return this.defaultNullable;
+ }
+
+ protected void setDefaultNullable(boolean nullable) {
+ boolean old = this.defaultNullable;
+ this.defaultNullable = nullable;
+ this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected boolean buildDefaultNullable() {
+ return DEFAULT_NULLABLE;
+ }
+
+
+ // ********** insertable **********
+
+ public boolean isInsertable() {
+ return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable();
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ protected void setSpecifiedInsertable(Boolean insertable) {
+ Boolean old = this.specifiedInsertable;
+ this.specifiedInsertable = insertable;
+ this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected Boolean buildSpecifiedInsertable() {
+ return this.getOverriddenColumn().getSpecifiedInsertable();
+ }
+
+ public boolean isDefaultInsertable() {
+ return this.defaultInsertable;
+ }
+
+ protected void setDefaultInsertable(boolean insertable) {
+ boolean old = this.defaultInsertable;
+ this.defaultInsertable = insertable;
+ this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected boolean buildDefaultInsertable() {
+ return DEFAULT_INSERTABLE;
+ }
+
+
+ // ********** updatable **********
+
+ public boolean isUpdatable() {
+ return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable();
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ protected void setSpecifiedUpdatable(Boolean updatable) {
+ Boolean old = this.specifiedUpdatable;
+ this.specifiedUpdatable = updatable;
+ this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected Boolean buildSpecifiedUpdatable() {
+ return this.getOverriddenColumn().getSpecifiedUpdatable();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return this.defaultUpdatable;
+ }
+
+ protected void setDefaultUpdatable(boolean updatable) {
+ boolean old = this.defaultUpdatable;
+ this.defaultUpdatable = updatable;
+ this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected boolean buildDefaultUpdatable() {
+ return DEFAULT_UPDATABLE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
new file mode 100644
index 0000000000..517dbeab97
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
+import org.eclipse.jpt.jpa.core.context.VirtualNamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+
+/**
+ * Java virtual<ul>
+ * <li>column
+ * <li>join column
+ * </ul>
+ * <strong>NB:</strong> all state is sync'ed/updated in {@link #update()}
+ * because <em>all</em> of its derived from the context model (i.e. none of it
+ * is derived from the resource model).
+ */
+public abstract class AbstractJavaVirtualNamedColumn<O extends ReadOnlyNamedColumn.Owner, C extends NamedColumn>
+ extends AbstractJavaJpaContextNode
+ implements VirtualNamedColumn
+{
+ protected final O owner;
+
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String columnDefinition;
+
+
+ protected AbstractJavaVirtualNamedColumn(JavaJpaContextNode parent, O owner) {
+ super(parent);
+ this.owner = owner;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedName(this.buildSpecifiedName());
+ this.setDefaultName(this.buildDefaultName());
+
+ this.setColumnDefinition(this.buildColumnDefinition());
+ }
+
+
+ // ********** column **********
+
+ /**
+ * This should never return <code>null</code>.
+ */
+ public abstract C getOverriddenColumn();
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ protected void setSpecifiedName(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ return this.getOverriddenColumn().getSpecifiedName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultName() {
+ return this.owner.getDefaultColumnName();
+ }
+
+
+ // ********** column definition **********
+
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ protected void setColumnDefinition(String columnDefinition) {
+ String old = this.columnDefinition;
+ this.columnDefinition = columnDefinition;
+ this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
+ }
+
+ protected String buildColumnDefinition() {
+ return this.getOverriddenColumn().getColumnDefinition();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null; // not sure this column is validated...
+ }
+
+
+ // ********** misc **********
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ String table = this.getTable();
+ if (table != null) {
+ sb.append(table);
+ sb.append('.');
+ }
+ sb.append(this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java
new file mode 100644
index 0000000000..6f589efad7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride;
+
+/**
+ * Virtual Java override
+ */
+public abstract class AbstractJavaVirtualOverride<C extends JavaOverrideContainer>
+ extends AbstractJavaJpaContextNode
+ implements JavaVirtualOverride
+{
+ protected final String name; // never null
+
+
+ protected AbstractJavaVirtualOverride(C parent, String name) {
+ super(parent);
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ public JavaOverride convertToSpecified() {
+ return this.getContainer().convertOverrideToSpecified(this);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public C getParent() {
+ return (C) super.getParent();
+ }
+
+ public C getContainer() {
+ return this.getParent();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getParent().getValidationTextRange(astRoot);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
new file mode 100644
index 0000000000..ec4d5b507f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReferenceTable;
+import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+
+public abstract class AbstractJavaVirtualReferenceTable<T extends ReferenceTable>
+ extends AbstractJavaVirtualTable<T>
+ implements VirtualReferenceTable
+{
+ protected final Vector<JavaVirtualJoinColumn> specifiedJoinColumns = new Vector<JavaVirtualJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final ReadOnlyJoinColumn.Owner joinColumnOwner;
+
+ protected JavaVirtualJoinColumn defaultJoinColumn;
+
+
+ protected AbstractJavaVirtualReferenceTable(JavaJpaContextNode parent) {
+ super(parent);
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSpecifiedJoinColumns();
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<JavaVirtualJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<JavaVirtualJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ protected void updateSpecifiedJoinColumns() {
+ ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumn> getOverriddenJoinColumns() {
+ return CollectionTools.iterable(this.getOverriddenTable().specifiedJoinColumns());
+ }
+
+ protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) {
+ JavaVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
+ this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return virtualJoinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) {
+ this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaVirtualJoinColumn, JoinColumn>
+ {
+ public Iterable<JavaVirtualJoinColumn> getContextElements() {
+ return AbstractJavaVirtualReferenceTable.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<JoinColumn> getResourceElements() {
+ return AbstractJavaVirtualReferenceTable.this.getOverriddenJoinColumns();
+ }
+ public JoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, JavaVirtualJoinColumn element) {
+ AbstractJavaVirtualReferenceTable.this.moveSpecifiedJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JoinColumn element) {
+ AbstractJavaVirtualReferenceTable.this.addSpecifiedJoinColumn(index, element);
+ }
+ public void removeContextElement(JavaVirtualJoinColumn element) {
+ AbstractJavaVirtualReferenceTable.this.removeSpecifiedJoinColumn(element);
+ }
+ }
+
+
+ // ********** default join column **********
+
+ public JavaVirtualJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(JavaVirtualJoinColumn joinColumn) {
+ JavaVirtualJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<JavaVirtualJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<JavaVirtualJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ if (this.buildsDefaultJoinColumn()) {
+ if (this.defaultJoinColumn == null) {
+ this.setDefaultJoinColumn(this.buildJoinColumn(this.getOverriddenTable().getDefaultJoinColumn()));
+ } else {
+ this.defaultJoinColumn.update();
+ }
+ } else {
+ this.setDefaultJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultJoinColumn() {
+ return ! this.hasSpecifiedJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ protected JavaVirtualJoinColumn buildJoinColumn(JoinColumn joinColumn) {
+ return this.buildJoinColumn(this.joinColumnOwner, joinColumn);
+ }
+
+ protected JavaVirtualJoinColumn buildJoinColumn(ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) {
+ return this.getJpaFactory().buildJavaVirtualJoinColumn(this, owner, joinColumn);
+ }
+
+ protected abstract ReadOnlyJoinColumn.Owner buildJoinColumnOwner();
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java
new file mode 100644
index 0000000000..466112abe3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.NameTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.VirtualTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+public abstract class AbstractJavaVirtualTable<T extends Table>
+ extends AbstractJavaJpaContextNode
+ implements VirtualTable
+{
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected final Vector<JavaVirtualUniqueConstraint> uniqueConstraints = new Vector<JavaVirtualUniqueConstraint>();
+ protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+
+
+ protected AbstractJavaVirtualTable(JavaJpaContextNode parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedName(this.buildSpecifiedName());
+ this.setDefaultName(this.buildDefaultName());
+
+ this.setSpecifiedSchema(this.buildSpecifiedSchema());
+ this.setDefaultSchema(this.buildDefaultSchema());
+
+ this.setSpecifiedCatalog(this.buildSpecifiedCatalog());
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+
+ this.updateUniqueConstraints();
+ }
+
+
+ // ********** table **********
+
+ /**
+ * This should never return <code>null</code>.
+ */
+ public abstract T getOverriddenTable();
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ protected void setSpecifiedName(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ return this.getOverriddenTable().getSpecifiedName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected abstract String buildDefaultName();
+
+
+ // ********** schema **********
+
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ protected void setSpecifiedSchema(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildSpecifiedSchema() {
+ return this.getOverriddenTable().getSchema();
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected abstract String buildDefaultSchema();
+
+
+ // ********** catalog **********
+
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ protected void setSpecifiedCatalog(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildSpecifiedCatalog() {
+ return this.getOverriddenTable().getCatalog();
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected abstract String buildDefaultCatalog();
+
+
+ // ********** unique constraints **********
+
+ public ListIterator<JavaVirtualUniqueConstraint> uniqueConstraints() {
+ return this.getUniqueConstraints().iterator();
+ }
+
+ protected ListIterable<JavaVirtualUniqueConstraint> getUniqueConstraints() {
+ return new LiveCloneListIterable<JavaVirtualUniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public JavaVirtualUniqueConstraint getUniqueConstraint(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ protected void updateUniqueConstraints() {
+ ContextContainerTools.update(this.uniqueConstraintContainerAdapter);
+ }
+
+ protected Iterable<UniqueConstraint> getOverriddenUniqueConstraints() {
+ return CollectionTools.iterable(this.getOverriddenTable().uniqueConstraints());
+ }
+
+ protected void moveUniqueConstraint(int index, JavaVirtualUniqueConstraint constraint) {
+ this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected JavaVirtualUniqueConstraint addUniqueConstraint(int index, UniqueConstraint uniqueConstraint) {
+ JavaVirtualUniqueConstraint virtualConstraint = this.buildUniqueConstraint(uniqueConstraint);
+ this.addItemToList(index, virtualConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ return virtualConstraint;
+ }
+
+ protected JavaVirtualUniqueConstraint buildUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ return this.getJpaFactory().buildJavaVirtualUniqueConstraint(this, uniqueConstraint);
+ }
+
+ protected void removeUniqueConstraint(JavaVirtualUniqueConstraint constraint) {
+ this.removeItemFromList(constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ /**
+ * unique constraint container adapter
+ */
+ protected class UniqueConstraintContainerAdapter
+ implements ContextContainerTools.Adapter<JavaVirtualUniqueConstraint, UniqueConstraint>
+ {
+ public Iterable<JavaVirtualUniqueConstraint> getContextElements() {
+ return AbstractJavaVirtualTable.this.getUniqueConstraints();
+ }
+ public Iterable<UniqueConstraint> getResourceElements() {
+ return AbstractJavaVirtualTable.this.getOverriddenUniqueConstraints();
+ }
+ public UniqueConstraint getResourceElement(JavaVirtualUniqueConstraint contextElement) {
+ return contextElement.getOverriddenUniqueConstraint();
+ }
+ public void moveContextElement(int index, JavaVirtualUniqueConstraint element) {
+ AbstractJavaVirtualTable.this.moveUniqueConstraint(index, element);
+ }
+ public void addContextElement(int index, UniqueConstraint resourceElement) {
+ AbstractJavaVirtualTable.this.addUniqueConstraint(index, resourceElement);
+ }
+ public void removeContextElement(JavaVirtualUniqueConstraint element) {
+ AbstractJavaVirtualTable.this.removeUniqueConstraint(element);
+ }
+ }
+
+
+ // ********** database stuff **********
+
+ public org.eclipse.jpt.jpa.db.Table getDbTable() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
+ }
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ protected boolean isResolved() {
+ return this.getDbTable() != null;
+ }
+
+ protected boolean hasResolvedSchema() {
+ return this.getDbSchema() != null;
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ protected boolean hasResolvedCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) || (this.resolveDbCatalog(catalog) != null);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.buildQualifiedName());
+ }
+
+ protected String buildQualifiedName() {
+ return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
new file mode 100644
index 0000000000..b4a89125dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java ID class reference
+ */
+public class GenericJavaIdClassReference
+ extends AbstractJavaJpaContextNode
+ implements JavaIdClassReference
+{
+ protected String idClassName;
+ protected String fullyQualifiedIdClassName;
+ // the ref holds the type directly because the ref is the type's parent
+ protected JavaPersistentType idClass;
+
+
+ public GenericJavaIdClassReference(JavaTypeMapping parent) {
+ super(parent);
+ this.idClassName = this.buildIdClassName();
+ // 'idClass' is resolved in the update
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setIdClassName_(this.buildIdClassName());
+ if (this.idClass != null) {
+ this.idClass.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setFullyQualifiedIdClassName(this.buildFullyQualifiedIdClassName());
+ this.updateIdClass();
+ }
+
+
+ // ********** id class name **********
+
+ public String getIdClassName() {
+ return this.getSpecifiedIdClassName();
+ }
+
+ public String getSpecifiedIdClassName() {
+ return this.idClassName;
+ }
+
+ public void setSpecifiedIdClassName(String name) {
+ if (this.valuesAreDifferent(name, this.idClassName)) {
+ this.getIdClassAnnotationForUpdate().setValue(name);
+ this.removeIdClassAnnotationIfUnset();
+ this.setIdClassName_(name);
+ }
+ }
+
+ protected void setIdClassName_(String name) {
+ String old = this.idClassName;
+ this.idClassName = name;
+ this.firePropertyChanged(SPECIFIED_ID_CLASS_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildIdClassName() {
+ IdClassAnnotation annotation = this.getIdClassAnnotation();
+ return (annotation == null) ? null : annotation.getValue();
+ }
+
+ public String getDefaultIdClassName() {
+ return null;
+ }
+
+ public boolean isSpecified() {
+ return this.idClassName != null;
+ }
+
+
+ // ********** id class annotation **********
+
+ /**
+ * Return <code>null</code> if the annotation does not exists.
+ */
+ protected IdClassAnnotation getIdClassAnnotation() {
+ return (IdClassAnnotation) this.getResourcePersistentType().getAnnotation(this.getIdClassAnnotationName());
+ }
+
+ /**
+ * Build the annotation if it does not exist.
+ */
+ protected IdClassAnnotation getIdClassAnnotationForUpdate() {
+ IdClassAnnotation annotation = this.getIdClassAnnotation();
+ return (annotation != null) ? annotation : this.buildIdClassAnnotation();
+ }
+
+ protected IdClassAnnotation buildIdClassAnnotation() {
+ return (IdClassAnnotation) this.getResourcePersistentType().addAnnotation(this.getIdClassAnnotationName());
+ }
+
+ protected void removeIdClassAnnotationIfUnset() {
+ if (this.getIdClassAnnotation().isUnset()) {
+ this.removeIdClassAnnotation();
+ }
+ }
+
+ protected void removeIdClassAnnotation() {
+ this.getResourcePersistentType().removeAnnotation(this.getIdClassAnnotationName());
+ }
+
+ protected String getIdClassAnnotationName() {
+ return IdClassAnnotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** fully-qualified id class name **********
+
+ public String getFullyQualifiedIdClassName() {
+ return this.fullyQualifiedIdClassName;
+ }
+
+ protected void setFullyQualifiedIdClassName(String name) {
+ String old = this.fullyQualifiedIdClassName;
+ this.fullyQualifiedIdClassName = name;
+ this.firePropertyChanged(FULLY_QUALIFIED_ID_CLASS_PROPERTY, old, name);
+ }
+
+ protected String buildFullyQualifiedIdClassName() {
+ IdClassAnnotation annotation = this.getIdClassAnnotation();
+ return (annotation == null) ? null : annotation.getFullyQualifiedClassName();
+ }
+
+
+ // ********** id class **********
+
+ public JavaPersistentType getIdClass() {
+ return this.idClass;
+ }
+
+ protected void setIdClass(JavaPersistentType idClass) {
+ JavaPersistentType old = this.idClass;
+ this.idClass = idClass;
+ this.firePropertyChanged(ID_CLASS_PROPERTY, old, idClass);
+ }
+
+ protected void updateIdClass() {
+ JavaResourcePersistentType resourceIdClass = this.resolveResourceIdClass();
+ if (resourceIdClass == null) {
+ if (this.idClass != null) {
+ this.idClass.dispose();
+ this.setIdClass(null);
+ }
+ } else {
+ if (this.idClass == null) {
+ this.setIdClass(this.buildIdClass(resourceIdClass));
+ } else {
+ if (this.idClass.getResourcePersistentType() == resourceIdClass) {
+ this.idClass.update();
+ } else {
+ this.idClass.dispose();
+ this.setIdClass(this.buildIdClass(resourceIdClass));
+ }
+ }
+ }
+ }
+
+ protected JavaResourcePersistentType resolveResourceIdClass() {
+ return (this.fullyQualifiedIdClassName == null) ?
+ null : this.getJpaProject().getJavaResourcePersistentType(this.fullyQualifiedIdClassName);
+ }
+
+ protected JavaPersistentType buildIdClass(JavaResourcePersistentType resourceClass) {
+ return this.getJpaFactory().buildJavaPersistentType(this, resourceClass);
+ }
+
+ public char getIdClassEnclosingTypeSeparator() {
+ return '.';
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaTypeMapping getParent() {
+ return (JavaTypeMapping) super.getParent();
+ }
+
+ protected JavaTypeMapping getTypeMapping() {
+ return this.getParent();
+ }
+
+ protected JavaPersistentType getPersistentType() {
+ return this.getTypeMapping().getPersistentType();
+ }
+
+ protected JavaResourcePersistentType getResourcePersistentType() {
+ return this.getPersistentType().getResourcePersistentType();
+ }
+
+
+ // ********** PersistentType.Owner implementation **********
+
+ public AccessType getOverridePersistentTypeAccess() {
+ return this.getPersistentType().getAccess();
+ }
+
+ public AccessType getDefaultPersistentTypeAccess() {
+ // this shouldn't be needed, since we've specified an override access, but just to be safe ...
+ return this.getPersistentType().getAccess();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ IdClassAnnotation annotation = this.getIdClassAnnotation();
+ return (annotation == null) ?
+ this.getTypeMapping().getValidationTextRange(astRoot) :
+ annotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java
new file mode 100644
index 0000000000..acbd82eeb9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaManyToManyRelationship
+ extends AbstractJavaMappingRelationship<JavaManyToManyMapping>
+ implements JavaManyToManyRelationship
+{
+ protected final JavaMappedByRelationshipStrategy mappedByStrategy;
+
+ protected final JavaJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericJavaManyToManyRelationship(JavaManyToManyMapping parent) {
+ super(parent);
+ this.mappedByStrategy = this.buildMappedByStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mappedByStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.mappedByStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected JavaRelationshipStrategy buildStrategy() {
+ if (this.mappedByStrategy.getMappedByAttribute() != null) {
+ return this.mappedByStrategy;
+ }
+ return this.joinTableStrategy;
+ }
+
+
+ // ********** mapped by strategy **********
+
+ public JavaMappedByRelationshipStrategy getMappedByStrategy() {
+ return this.mappedByStrategy;
+ }
+
+ public boolean strategyIsMappedBy() {
+ return this.strategy == this.mappedByStrategy;
+ }
+
+ public void setStrategyToMappedBy() {
+ this.mappedByStrategy.addStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayBeMappedBy(AttributeMapping mapping) {
+ return mapping.getKey() == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ protected JavaMappedByRelationshipStrategy buildMappedByStrategy() {
+ return new GenericJavaMappedByRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public JavaJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public void setStrategyToJoinTable() {
+ // join table is default option, so no need to add to resource
+ this.mappedByStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return this.getMappedByStrategy().getMappedByAttribute() == null;
+ }
+
+ protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return new GenericJavaMappingJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromMappedByRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ }
+
+ @Override
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ super.initializeFromMappedByRelationship(oldRelationship);
+ this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaManyToManyMapping getMapping() {
+ return this.getParent();
+ }
+
+ public OwnableRelationshipMappingAnnotation getMappingAnnotation() {
+ return this.getMapping().getMappingAnnotation();
+ }
+
+ public OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate() {
+ return this.getMapping().getAnnotationForUpdate();
+ }
+
+ public boolean isOwner() {
+ return this.mappedByStrategy.getMappedByAttribute() == null;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.mappedByStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.mappedByStrategy.validate(messages, reporter, astRoot);
+ this.joinTableStrategy.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java
new file mode 100644
index 0000000000..c0ad6c945b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToOneRelationship2_0;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaManyToOneRelationship
+ extends AbstractJavaMappingRelationship<JavaManyToOneMapping>
+ implements JavaManyToOneRelationship2_0
+{
+ protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy;
+
+ // JPA 2.0
+ protected final JavaJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericJavaManyToOneRelationship(JavaManyToOneMapping parent) {
+ super(parent);
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected JavaRelationshipStrategy buildStrategy() {
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinTableStrategy.getJoinTable() != null) {
+ return this.joinTableStrategy;
+ }
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** join table strategy **********
+
+ public JavaJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public final void setStrategyToJoinTable() {
+ this.joinTableStrategy.addStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return false;
+ }
+
+ protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return this.isJpa2_0Compatible() ?
+ new GenericJavaMappingJoinTableRelationshipStrategy(this) :
+ new NullJavaJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** join column strategy **********
+
+ public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ // join column strategy is the default; so no need to add stuff,
+ // just remove all the others
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return this.joinTableStrategy.getJoinTable() == null;
+ }
+
+ protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericJavaMappingJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ super.initializeFromJoinColumnRelationship(oldRelationship);
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaManyToOneMapping getMapping() {
+ return this.getParent();
+ }
+
+ public boolean isOwner() {
+ return true;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return false;
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.joinColumnStrategy.validate(messages, reporter, astRoot);
+ this.joinTableStrategy.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java
new file mode 100644
index 0000000000..f682c69d90
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaMappedByRelationshipStrategy
+ extends AbstractJavaJpaContextNode
+ implements JavaMappedByRelationshipStrategy
+{
+ protected String mappedByAttribute;
+
+
+ public GenericJavaMappedByRelationshipStrategy(JavaMappedByRelationship parent) {
+ super(parent);
+ this.mappedByAttribute = this.buildMappedByAttribute();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setMappedByAttribute_(this.buildMappedByAttribute());
+ }
+
+
+ // ********** mapped by attribute **********
+
+ public String getMappedByAttribute() {
+ return this.mappedByAttribute;
+ }
+
+ public void setMappedByAttribute(String mappedByAttribute) {
+ if (this.valuesAreDifferent(mappedByAttribute, this.mappedByAttribute)) {
+ this.getMappingAnnotationForUpdate().setMappedBy(mappedByAttribute);
+ this.setMappedByAttribute_(mappedByAttribute);
+ }
+ }
+
+ protected void setMappedByAttribute_(String mappedByAttribute) {
+ String old = this.mappedByAttribute;
+ this.mappedByAttribute = mappedByAttribute;
+ this.firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, old, mappedByAttribute);
+ }
+
+ protected String buildMappedByAttribute() {
+ OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getMappedBy();
+ }
+
+
+ // ********** misc **********
+
+ protected OwnableRelationshipMappingAnnotation getMappingAnnotation() {
+ return this.getRelationship().getMappingAnnotation();
+ }
+
+ protected OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate() {
+ return this.getRelationship().getMappingAnnotationForUpdate();
+ }
+
+ @Override
+ public JavaMappedByRelationship getParent() {
+ return (JavaMappedByRelationship) super.getParent();
+ }
+
+ public JavaMappedByRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ public void initializeFrom(MappedByRelationshipStrategy oldStrategy) {
+ this.setMappedByAttribute(oldStrategy.getMappedByAttribute());
+ }
+
+ public String getTableName() {
+ RelationshipMapping owner = this.getRelationshipOwner();
+ return (owner == null) ? null : owner.getRelationship().getStrategy().getTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ RelationshipMapping owner = this.getRelationshipOwner();
+ return (owner == null) ? null : owner.getRelationship().getStrategy().resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ RelationshipMapping owner = this.getRelationshipOwner();
+ return (owner != null) && owner.getRelationship().getStrategy().tableNameIsInvalid(tableName);
+ }
+
+ public String getColumnTableNotValidDescription() {
+ //this will not be called if getRelationshipOwner() is null
+ return this.getRelationshipOwner().getRelationship().getStrategy().getColumnTableNotValidDescription();
+ }
+
+ protected RelationshipMapping getRelationshipOwner() {
+ return this.getRelationshipMapping().getRelationshipOwner();
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ public boolean relationshipIsOwnedBy(RelationshipMapping otherMapping) {
+ String thisEntityName = this.getEntityName();
+ Entity otherEntity = otherMapping.getResolvedTargetEntity();
+ String otherEntityName = (otherEntity == null) ? null : otherEntity.getName();
+ return Tools.valuesAreEqual(thisEntityName, otherEntityName) &&
+ Tools.valuesAreEqual(this.mappedByAttribute, otherMapping.getName());
+ }
+
+ protected String getEntityName() {
+ Entity entity = this.getRelationship().getEntity();
+ return (entity == null) ? null : entity.getName();
+ }
+
+ public void addStrategy() {
+ if (this.mappedByAttribute == null) {
+ this.setMappedByAttribute(""); //$NON-NLS-1$
+ }
+ }
+
+ public void removeStrategy() {
+ if (this.mappedByAttribute != null) {
+ this.setMappedByAttribute(null);
+ }
+ }
+
+
+ // ********** java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ if ((annotation != null) && annotation.mappedByTouches(pos, astRoot)) {
+ result = this.javaCandidateMappedByAttributeNames(filter);
+ }
+ return result;
+ }
+
+ public Iterator<String> candidateMappedByAttributeNames() {
+ return this.getRelationshipMapping().allTargetEntityAttributeNames();
+ }
+
+ protected Iterator<String> candidateMappedByAttributeNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateMappedByAttributeNames(), filter);
+ }
+
+ protected Iterator<String> javaCandidateMappedByAttributeNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.candidateMappedByAttributeNames(filter));
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getMappedByTextRange(astRoot);
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ if (this.mappedByAttribute == null) {
+ return;
+ }
+
+ Entity targetEntity = this.getRelationshipMapping().getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return; // null target entity is validated elsewhere
+ }
+
+ AttributeMapping mappedByMapping = targetEntity.resolveAttributeMapping(this.mappedByAttribute);
+
+ if (mappedByMapping == null) {
+ messages.add(
+ this.buildMessage(
+ JpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
+ new String[] {this.mappedByAttribute},
+ astRoot
+ )
+ );
+ return;
+ }
+
+ if ( ! this.getRelationship().mayBeMappedBy(mappedByMapping)) {
+ messages.add(
+ this.buildMessage(
+ JpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
+ new String[] {this.mappedByAttribute},
+ astRoot
+ )
+ );
+ return;
+ }
+
+ // if mappedByMapping is not a relationship owner, then it should have
+ // been flagged in above rule (mappedByIsValid)
+ if ( ! ((RelationshipMapping) mappedByMapping).isRelationshipOwner()) {
+ messages.add(
+ this.buildMessage(
+ JpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
+ new String[] {this.mappedByAttribute},
+ astRoot
+ )
+ );
+ }
+ }
+
+ protected IMessage buildMessage(String msgID, String[] parms, CompilationUnit astRoot) {
+ PersistentAttribute attribute = this.getRelationshipMapping().getPersistentAttribute();
+ String attributeDescription = NLS.bind(JpaValidationDescriptionMessages.ATTRIBUTE_DESC, attribute.getName());
+ parms = ArrayTools.add(parms, 0, attributeDescription);
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ parms,
+ this,
+ this.getValidationTextRange(astRoot)
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..79b88ac1c5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+
+public class GenericJavaMappingJoinColumnRelationshipStrategy
+ extends AbstractJavaJoinColumnRelationshipStrategy
+{
+ protected final boolean targetForeignKey;
+
+
+ /**
+ * The default strategy is for a "source" foreign key.
+ */
+ public GenericJavaMappingJoinColumnRelationshipStrategy(JavaMappingJoinColumnRelationship parent) {
+ this(parent, false);
+ }
+
+ public GenericJavaMappingJoinColumnRelationshipStrategy(JavaMappingJoinColumnRelationship parent, boolean targetForeignKey) {
+ super(parent);
+ this.targetForeignKey = targetForeignKey;
+ }
+
+
+ // ********** join column annotations **********
+
+ @Override
+ protected Iterator<JoinColumnAnnotation> joinColumnAnnotations() {
+ return new SubIteratorWrapper<NestableAnnotation, JoinColumnAnnotation>(this.joinColumnAnnotations_());
+ }
+
+ protected Iterator<NestableAnnotation> joinColumnAnnotations_() {
+ return this.getResourcePersistentAttribute().annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected JoinColumnAnnotation addJoinColumnAnnotation(int index) {
+ return (JoinColumnAnnotation) this.getResourcePersistentAttribute().addAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected void removeJoinColumnAnnotation(int index) {
+ this.getResourcePersistentAttribute().removeAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected void moveJoinColumnAnnotation(int targetIndex, int sourceIndex) {
+ this.getResourcePersistentAttribute().moveAnnotation(targetIndex, sourceIndex, JoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected JoinColumnAnnotation buildNullJoinColumnAnnotation() {
+ return new NullJoinColumnAnnotation(this.getResourcePersistentAttribute());
+ }
+
+
+ // ********** misc **********
+
+ protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getRelationship().getMapping().getResourcePersistentAttribute();
+ }
+
+ @Override
+ public JavaMappingJoinColumnRelationship getRelationship() {
+ return (JavaMappingJoinColumnRelationship) super.getRelationship();
+ }
+
+ @Override
+ protected JavaJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ public boolean isOverridable() {
+ return true;
+ }
+
+ public TypeMapping getRelationshipSource() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return this.targetForeignKey ?
+ mapping.getResolvedTargetEntity() :
+ mapping.getTypeMapping();
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return this.targetForeignKey ?
+ mapping.getTypeMapping() :
+ mapping.getResolvedTargetEntity();
+ }
+
+ protected Entity getRelationshipTargetEntity() {
+ TypeMapping target = this.getRelationshipTarget();
+ return (target instanceof Entity) ? (Entity) target : null;
+ }
+
+ public boolean isTargetForeignKey() {
+ return this.targetForeignKey;
+ }
+
+
+ // ********** validation **********
+
+ public String getColumnTableNotValidDescription() {
+ return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getRelationship().getValidationTextRange(astRoot);
+ }
+
+
+ // ********** join column owner **********
+
+ protected class JoinColumnOwner
+ implements JavaJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String getDefaultTableName() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ public String getAttributeName() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getName();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipSource();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName);
+ }
+
+ /**
+ * the join column can be on a secondary table
+ */
+ public Iterator<String> candidateTableNames() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.candidateTableNames();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.resolveDbTable(tableName);
+ }
+
+ public Table getReferencedColumnDbTable() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.defaultJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java
new file mode 100644
index 0000000000..318babfe30
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToManyRelationship2_0;
+import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaOneToManyRelationship
+ extends AbstractJavaMappingRelationship<JavaOneToManyMapping>
+ implements JavaOneToManyRelationship2_0
+{
+ protected final JavaMappedByRelationshipStrategy mappedByStrategy;
+
+ protected final JavaJoinTableRelationshipStrategy joinTableStrategy;
+
+ // JPA 2.0 or EclipseLink
+ protected final boolean supportsJoinColumnStrategy;
+ protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy;
+
+
+ public GenericJavaOneToManyRelationship(JavaOneToManyMapping parent, boolean supportsJoinColumnStrategy) {
+ super(parent);
+ this.mappedByStrategy = this.buildMappedByStrategy();
+ this.supportsJoinColumnStrategy = supportsJoinColumnStrategy;
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+
+ // build join table strategy last since it's dependent on the other strategies
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mappedByStrategy.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.mappedByStrategy.update();
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected JavaRelationshipStrategy buildStrategy() {
+ if (this.mappedByStrategy.getMappedByAttribute() != null) {
+ return this.mappedByStrategy;
+ }
+ if (this.supportsJoinColumnStrategy) {
+ if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
+ return this.joinColumnStrategy;
+ }
+ }
+ return this.joinTableStrategy;
+ }
+
+
+ // ********** mapped by strategy **********
+
+ public JavaMappedByRelationshipStrategy getMappedByStrategy() {
+ return this.mappedByStrategy;
+ }
+
+ public boolean strategyIsMappedBy() {
+ return this.strategy == this.mappedByStrategy;
+ }
+
+ public final void setStrategyToMappedBy() {
+ this.mappedByStrategy.addStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayBeMappedBy(AttributeMapping mapping) {
+ String key = mapping.getKey();
+ if (key == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ return true;
+ }
+ if (this.supportsJoinColumnStrategy) {
+ return key == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+ return false;
+ }
+
+ protected JavaMappedByRelationshipStrategy buildMappedByStrategy() {
+ return new GenericJavaMappedByRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public JavaJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public final void setStrategyToJoinTable() {
+ // join table is default, so no need to add annotation
+ this.mappedByStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return (this.mappedByStrategy.getMappedByAttribute() == null) &&
+ ! this.joinColumnStrategy.hasSpecifiedJoinColumns();
+ }
+
+ protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return new GenericJavaMappingJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** join column strategy **********
+
+ public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ this.joinColumnStrategy.addStrategy();
+ this.mappedByStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return false;
+ }
+
+ protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return this.supportsJoinColumnStrategy ?
+ new GenericJavaMappingJoinColumnRelationshipStrategy(this, true) : // true = target foreign key
+ new NullJavaJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromMappedByRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ }
+
+ @Override
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ super.initializeFromMappedByRelationship(oldRelationship);
+ this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ super.initializeFromJoinColumnRelationship(oldRelationship);
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaOneToManyMapping getMapping() {
+ return this.getParent();
+ }
+
+ public OneToManyAnnotation getMappingAnnotation() {
+ return this.getMapping().getMappingAnnotation();
+ }
+
+ public OneToManyAnnotation getMappingAnnotationForUpdate() {
+ return this.getMapping().getAnnotationForUpdate();
+ }
+
+ public boolean isOwner() {
+ return this.mappedByStrategy.getMappedByAttribute() == null;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
+ }
+
+ @Override
+ public boolean isTargetForeignKey() {
+ return this.joinColumnStrategy.isTargetForeignKey();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.mappedByStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.mappedByStrategy.validate(messages, reporter, astRoot);
+ this.joinTableStrategy.validate(messages, reporter, astRoot);
+ this.joinColumnStrategy.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
new file mode 100644
index 0000000000..8ea6e4ef66
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToOneRelationship2_0;
+import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaOneToOneRelationship
+ extends AbstractJavaMappingRelationship<JavaOneToOneMapping>
+ implements JavaOneToOneRelationship2_0
+{
+ protected final JavaMappedByRelationshipStrategy mappedByStrategy;
+
+ protected final JavaPrimaryKeyJoinColumnRelationshipStrategy primaryKeyJoinColumnStrategy;
+
+ // JPA 2.0
+ protected final JavaJoinTableRelationshipStrategy joinTableStrategy;
+
+ protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy;
+
+
+ public GenericJavaOneToOneRelationship(JavaOneToOneMapping parent) {
+ super(parent);
+ this.mappedByStrategy = this.buildMappedByStrategy();
+ this.primaryKeyJoinColumnStrategy = this.buildPrimaryKeyJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mappedByStrategy.synchronizeWithResourceModel();
+ this.primaryKeyJoinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.mappedByStrategy.update();
+ this.primaryKeyJoinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ this.joinColumnStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected JavaRelationshipStrategy buildStrategy() {
+ if (this.mappedByStrategy.getMappedByAttribute() != null) {
+ return this.mappedByStrategy;
+ }
+ if (this.primaryKeyJoinColumnStrategy.hasPrimaryKeyJoinColumns()) {
+ return this.primaryKeyJoinColumnStrategy;
+ }
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinTableStrategy.getJoinTable() != null) {
+ return this.joinTableStrategy;
+ }
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** mapped by strategy **********
+
+ public JavaMappedByRelationshipStrategy getMappedByStrategy() {
+ return this.mappedByStrategy;
+ }
+
+ public boolean strategyIsMappedBy() {
+ return this.strategy == this.mappedByStrategy;
+ }
+
+ public void setStrategyToMappedBy() {
+ this.mappedByStrategy.addStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.primaryKeyJoinColumnStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayBeMappedBy(AttributeMapping mapping) {
+ return mapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ protected JavaMappedByRelationshipStrategy buildMappedByStrategy() {
+ return new GenericJavaMappedByRelationshipStrategy(this);
+ }
+
+
+ // ********** primary key join column strategy **********
+
+ public JavaPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy() {
+ return this.primaryKeyJoinColumnStrategy;
+ }
+
+ public boolean strategyIsPrimaryKeyJoinColumn() {
+ return this.strategy == this.primaryKeyJoinColumnStrategy;
+ }
+
+ public void setStrategyToPrimaryKeyJoinColumn() {
+ this.primaryKeyJoinColumnStrategy.addStrategy();
+ this.mappedByStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ protected JavaPrimaryKeyJoinColumnRelationshipStrategy buildPrimaryKeyJoinColumnStrategy() {
+ return new GenericJavaPrimaryKeyJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public JavaJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public final void setStrategyToJoinTable() {
+ this.joinTableStrategy.addStrategy();
+ this.mappedByStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.primaryKeyJoinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return false;
+ }
+
+ protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return this.isJpa2_0Compatible() ?
+ new GenericJavaMappingJoinTableRelationshipStrategy(this) :
+ new NullJavaJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** join column strategy **********
+
+ public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ // join column strategy is the default; so no need to add stuff,
+ // just remove all the others
+ this.mappedByStrategy.removeStrategy();
+ this.primaryKeyJoinColumnStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return (this.mappedByStrategy.getMappedByAttribute() == null) &&
+ (this.primaryKeyJoinColumnStrategy.primaryKeyJoinColumnsSize() == 0) &&
+ (this.joinTableStrategy.getJoinTable() == null);
+ }
+
+ protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericJavaMappingJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromMappedByRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ // no other pk join column relationships yet
+ }
+
+ @Override
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ super.initializeFromMappedByRelationship(oldRelationship);
+ this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ super.initializeFromJoinColumnRelationship(oldRelationship);
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaOneToOneMapping getMapping() {
+ return this.getParent();
+ }
+
+ public OwnableRelationshipMappingAnnotation getMappingAnnotation() {
+ return this.getMapping().getMappingAnnotation();
+ }
+
+ public OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate() {
+ return this.getMapping().getAnnotationForUpdate();
+ }
+
+ public boolean isOwner() {
+ return this.mappedByStrategy.getMappedByAttribute() == null;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.mappedByStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.primaryKeyJoinColumnStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.mappedByStrategy.validate(messages, reporter, astRoot);
+ this.primaryKeyJoinColumnStrategy.validate(messages, reporter, astRoot);
+ this.joinColumnStrategy.validate(messages, reporter, astRoot);
+ this.joinTableStrategy.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..9190e16939
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+
+public class GenericJavaOverrideJoinColumnRelationshipStrategy
+ extends AbstractJavaJoinColumnRelationshipStrategy
+{
+ public GenericJavaOverrideJoinColumnRelationshipStrategy(JavaOverrideRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** join column annotations **********
+
+ @Override
+ protected ListIterator<JoinColumnAnnotation> joinColumnAnnotations() {
+ return this.getOverrideAnnotation().joinColumns();
+ }
+
+ @Override
+ protected JoinColumnAnnotation addJoinColumnAnnotation(int index) {
+ return this.getOverrideAnnotation().addJoinColumn(index);
+ }
+
+ @Override
+ protected void removeJoinColumnAnnotation(int index) {
+ this.getOverrideAnnotation().removeJoinColumn(index);
+ }
+
+ @Override
+ protected void moveJoinColumnAnnotation(int targetIndex, int sourceIndex) {
+ this.getOverrideAnnotation().moveJoinColumn(targetIndex, sourceIndex);
+ }
+
+ @Override
+ protected JoinColumnAnnotation buildNullJoinColumnAnnotation() {
+ return new NullJoinColumnAnnotation(this.getOverrideAnnotation());
+ }
+
+ protected AssociationOverrideAnnotation getOverrideAnnotation() {
+ return this.getAssociationOverride().getOverrideAnnotation();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ public boolean isTargetForeignKey() {
+ RelationshipMapping relationshipMapping = this.getRelationshipMapping();
+ return (relationshipMapping != null) &&
+ relationshipMapping.getRelationship().isTargetForeignKey();
+ }
+
+ public TypeMapping getRelationshipSource() {
+ return this.isTargetForeignKey() ?
+ this.getRelationshipMapping().getResolvedTargetEntity() :
+ this.getAssociationOverrideContainer().getTypeMapping();
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ return this.isTargetForeignKey() ?
+ this.getAssociationOverrideContainer().getTypeMapping() :
+ this.getRelationshipMappingTargetEntity();
+ }
+
+ protected TypeMapping getRelationshipMappingTargetEntity() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return (mapping == null) ? null : mapping.getResolvedTargetEntity();
+ }
+
+ protected Entity getRelationshipTargetEntity() {
+ TypeMapping target = this.getRelationshipTarget();
+ return (target instanceof Entity) ? (Entity) target : null;
+ }
+
+ @Override
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+ protected String getAttributeName() {
+ return this.getAssociationOverride().getName();
+ }
+
+ @Override
+ public String getTableName() {
+ return this.isTargetForeignKey() ?
+ super.getTableName() :
+ this.getAssociationOverrideContainer().getDefaultTableName();
+ }
+
+ @Override
+ public Table resolveDbTable(String tableName) {
+ return this.isTargetForeignKey() ?
+ super.resolveDbTable(tableName) :
+ this.getAssociationOverrideContainer().resolveDbTable(tableName);
+ }
+
+ @Override
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.isTargetForeignKey() ?
+ super.tableNameIsInvalid(tableName) :
+ this.getAssociationOverrideContainer().tableNameIsInvalid(tableName);
+ }
+
+ @Override
+ public Iterator<String> candidateTableNames() {
+ return this.isTargetForeignKey() ?
+ super.candidateTableNames() :
+ this.getAssociationOverrideContainer().candidateTableNames();
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return null;
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ protected JavaAssociationOverride getAssociationOverride() {
+ return this.getRelationship().getAssociationOverride();
+ }
+
+ protected JavaAssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.getAssociationOverride().getContainer();
+ }
+
+ @Override
+ public JavaOverrideRelationship getRelationship() {
+ return (JavaOverrideRelationship) super.getRelationship();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getRelationship().getValidationTextRange(astRoot);
+ }
+
+
+ // ********** join column owner adapter **********
+
+ protected class JoinColumnOwner
+ implements JavaJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public String getDefaultTableName() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ public String getAttributeName() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getAttributeName();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ RelationshipMapping relationshipMapping = GenericJavaOverrideJoinColumnRelationshipStrategy.this.getRelationshipMapping();
+ return relationshipMapping == null ? null : relationshipMapping.getPersistentAttribute();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.candidateTableNames();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.resolveDbTable(tableName);
+ }
+
+ public Table getReferencedColumnDbTable() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return false;
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return this.getAssociationOverrideContainer().buildColumnValidator(this.getAssociationOverride(), (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
+ }
+
+ protected JavaAssociationOverride getAssociationOverride() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getAssociationOverride();
+ }
+
+ protected JavaAssociationOverrideContainer getAssociationOverrideContainer() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getAssociationOverrideContainer();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..188364f29b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -0,0 +1,385 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
+ extends AbstractJavaJpaContextNode
+ implements JavaPrimaryKeyJoinColumnRelationshipStrategy
+{
+ protected final Vector<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = new Vector<JavaPrimaryKeyJoinColumn>();
+ protected final PrimaryKeyJoinColumnContainerAdapter primaryKeyJoinColumnContainerAdapter;
+ protected final JavaJoinColumn.Owner primaryKeyJoinColumnOwner;
+
+
+ public GenericJavaPrimaryKeyJoinColumnRelationshipStrategy(JavaPrimaryKeyJoinColumnRelationship parent) {
+ super(parent);
+ this.primaryKeyJoinColumnContainerAdapter = this.buildPrimaryKeyJoinColumnContainerAdapter();
+ this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ this.initializePrimaryKeyJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncPrimaryKeyJoinColumns();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getPrimaryKeyJoinColumns());
+ }
+
+
+ // ********** primary key join columns **********
+
+ public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.getPrimaryKeyJoinColumns().iterator();
+ }
+
+ public ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<JavaPrimaryKeyJoinColumn>(this.primaryKeyJoinColumns);
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return this.primaryKeyJoinColumns.size();
+ }
+
+ public boolean hasPrimaryKeyJoinColumns() {
+ return this.primaryKeyJoinColumns.size() != 0;
+ }
+
+ public JavaPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
+ return this.primaryKeyJoinColumns.get(index);
+ }
+
+ public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() {
+ return this.addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size());
+ }
+
+ public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
+ PrimaryKeyJoinColumnAnnotation annotation = this.addPrimaryKeyJoinColumnAnnotation(index);
+ return this.addPrimaryKeyJoinColumn_(index, annotation);
+ }
+
+ public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
+ this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removePrimaryKeyJoinColumn(int index) {
+ this.removePrimaryKeyJoinColumnAnnotation(index);
+ this.removePrimaryKeyJoinColumn_(index);
+ }
+
+ protected void removePrimaryKeyJoinColumn_(int index) {
+ this.removeItemFromList(index, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ this.movePrimaryKeyJoinColumnAnnotation(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected void initializePrimaryKeyJoinColumns() {
+ for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) {
+ this.primaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation));
+ }
+ }
+
+ protected void syncPrimaryKeyJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.primaryKeyJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
+ return CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations());
+ }
+
+ protected void movePrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) {
+ JavaPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(pkJoinColumnAnnotation);
+ this.addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removePrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn joinColumn) {
+ this.removePrimaryKeyJoinColumn_(this.primaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ protected PrimaryKeyJoinColumnContainerAdapter buildPrimaryKeyJoinColumnContainerAdapter() {
+ return new PrimaryKeyJoinColumnContainerAdapter();
+ }
+
+ /**
+ * primary key join column container adapter
+ */
+ protected class PrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
+ {
+ public Iterable<JavaPrimaryKeyJoinColumn> getContextElements() {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumns();
+ }
+ public Iterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnAnnotations();
+ }
+ public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getColumnAnnotation();
+ }
+ public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) {
+ GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.movePrimaryKeyJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) {
+ GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.addPrimaryKeyJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(JavaPrimaryKeyJoinColumn element) {
+ GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.removePrimaryKeyJoinColumn_(element);
+ }
+ }
+
+ protected JavaJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation annotation) {
+ return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, annotation);
+ }
+
+
+ // ********** primary key join column annotations **********
+
+ protected Iterator<PrimaryKeyJoinColumnAnnotation> primaryKeyJoinColumnAnnotations() {
+ return new SubIteratorWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(this.primaryKeyJoinColumnAnnotations_());
+ }
+
+ protected Iterator<NestableAnnotation> primaryKeyJoinColumnAnnotations_() {
+ return this.getResourcePersistentAttribute().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ protected PrimaryKeyJoinColumnAnnotation addPrimaryKeyJoinColumnAnnotation(int index) {
+ return (PrimaryKeyJoinColumnAnnotation) this.getResourcePersistentAttribute().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removePrimaryKeyJoinColumnAnnotation(int index) {
+ this.getResourcePersistentAttribute().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void movePrimaryKeyJoinColumnAnnotation(int targetIndex, int sourceIndex) {
+ this.getResourcePersistentAttribute().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaPrimaryKeyJoinColumnRelationship getParent() {
+ return (JavaPrimaryKeyJoinColumnRelationship) super.getParent();
+ }
+
+ public JavaPrimaryKeyJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected JavaRelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getRelationship().getMapping().getResourcePersistentAttribute();
+ }
+
+ public String getTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY;
+ }
+
+ protected TypeMapping getTypeMapping() {
+ return this.getRelationshipMapping().getTypeMapping();
+ }
+
+ public void addStrategy() {
+ if (this.primaryKeyJoinColumns.size() == 0) {
+ this.addPrimaryKeyJoinColumn();
+ }
+ }
+
+ public void removeStrategy() {
+ for (int i = this.primaryKeyJoinColumns.size(); i-- > 0; ) {
+ this.removePrimaryKeyJoinColumn(i);
+ }
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaPrimaryKeyJoinColumn column : this.getPrimaryKeyJoinColumns()) {
+ result = column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ for (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
+ pkJoinColumn.validate(messages, reporter, astRoot);
+ }
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getRelationship().getValidationTextRange(astRoot);
+ }
+
+
+ // ********** join column owner **********
+
+ protected class PrimaryKeyJoinColumnOwner
+ implements JavaJoinColumn.Owner
+ {
+ protected PrimaryKeyJoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String getDefaultTableName() {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public Entity getRelationshipTarget() {
+ return this.getRelationshipMapping().getResolvedTargetEntity();
+ }
+
+ public String getAttributeName() {
+ return this.getRelationshipMapping().getName();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ /**
+ * the join column can be on a secondary table
+ */
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getTypeMapping();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public Table getReferencedColumnDbTable() {
+ Entity targetEntity = this.getRelationshipTarget();
+ return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return false;
+ }
+
+ public String getDefaultColumnName() {
+ return null;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot);
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.primaryKeyJoinColumnsSize();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new OneToOnePrimaryKeyJoinColumnValidator((BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
+ }
+
+ protected JavaRelationshipMapping getRelationshipMapping() {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getRelationshipMapping();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java
new file mode 100644
index 0000000000..f27ca4df39
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+
+/**
+ * Java virtual join table
+ */
+public class GenericJavaVirtualJoinTable
+ extends AbstractJavaVirtualReferenceTable<JoinTable>
+ implements JavaVirtualJoinTable
+{
+ protected final JoinTable overriddenTable;
+
+ protected final Vector<JavaVirtualJoinColumn> specifiedInverseJoinColumns = new Vector<JavaVirtualJoinColumn>();
+ protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final ReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
+
+ protected JavaVirtualJoinColumn defaultInverseJoinColumn;
+
+
+ public GenericJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) {
+ super(parent);
+ this.overriddenTable = overriddenTable;
+ this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSpecifiedInverseJoinColumns();
+ this.updateDefaultInverseJoinColumn();
+ }
+
+
+ // ********** table **********
+
+ @Override
+ public JoinTable getOverriddenTable() {
+ return this.overriddenTable;
+ }
+
+
+ // ********** inverse join columns **********
+
+ public ListIterator<JavaVirtualJoinColumn> inverseJoinColumns() {
+ return this.getInverseJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getInverseJoinColumns() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
+ }
+
+ public int inverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
+ }
+
+
+ // ********** inverse specified join columns **********
+
+ public ListIterator<JavaVirtualJoinColumn> specifiedInverseJoinColumns() {
+ return this.getSpecifiedInverseJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
+ return new LiveCloneListIterable<JavaVirtualJoinColumn>(this.specifiedInverseJoinColumns);
+ }
+
+ public int specifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedInverseJoinColumns() {
+ return this.specifiedInverseJoinColumns.size() != 0;
+ }
+
+ public JavaVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) {
+ return this.specifiedInverseJoinColumns.get(index);
+ }
+
+ protected void updateSpecifiedInverseJoinColumns() {
+ ContextContainerTools.update(this.specifiedInverseJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumn> getOverriddenInverseJoinColumns() {
+ return CollectionTools.iterable(this.getOverriddenTable().specifiedInverseJoinColumns());
+ }
+
+ protected void moveSpecifiedInverseJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, JoinColumn joinColumn) {
+ JavaVirtualJoinColumn virtualJoinColumn = this.buildInverseJoinColumn(joinColumn);
+ this.addItemToList(index, virtualJoinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ return virtualJoinColumn;
+ }
+
+ protected void removeSpecifiedInverseJoinColumn(JavaVirtualJoinColumn joinColumn) {
+ this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ /**
+ * specified inverse join column container adapter
+ */
+ protected class SpecifiedInverseJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaVirtualJoinColumn, JoinColumn>
+ {
+ public Iterable<JavaVirtualJoinColumn> getContextElements() {
+ return GenericJavaVirtualJoinTable.this.getSpecifiedInverseJoinColumns();
+ }
+ public Iterable<JoinColumn> getResourceElements() {
+ return GenericJavaVirtualJoinTable.this.getOverriddenInverseJoinColumns();
+ }
+ public JoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, JavaVirtualJoinColumn element) {
+ GenericJavaVirtualJoinTable.this.moveSpecifiedInverseJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JoinColumn element) {
+ GenericJavaVirtualJoinTable.this.addSpecifiedInverseJoinColumn(index, element);
+ }
+ public void removeContextElement(JavaVirtualJoinColumn element) {
+ GenericJavaVirtualJoinTable.this.removeSpecifiedInverseJoinColumn(element);
+ }
+ }
+
+
+ // ********** default inverse join column **********
+
+ public JavaVirtualJoinColumn getDefaultInverseJoinColumn() {
+ return this.defaultInverseJoinColumn;
+ }
+
+ protected void setDefaultInverseJoinColumn(JavaVirtualJoinColumn joinColumn) {
+ JavaVirtualJoinColumn old = this.defaultInverseJoinColumn;
+ this.defaultInverseJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn);
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getDefaultInverseJoinColumns() {
+ return (this.defaultInverseJoinColumn != null) ?
+ new SingleElementListIterable<JavaVirtualJoinColumn>(this.defaultInverseJoinColumn) :
+ EmptyListIterable.<JavaVirtualJoinColumn>instance();
+ }
+
+ protected int getDefaultInverseJoinColumnsSize() {
+ return (this.defaultInverseJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultInverseJoinColumn() {
+ if (this.buildsDefaultInverseJoinColumn()) {
+ if (this.defaultInverseJoinColumn == null) {
+ this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(this.getOverriddenTable().getDefaultInverseJoinColumn()));
+ } else {
+ this.defaultInverseJoinColumn.update();
+ }
+ } else {
+ this.setDefaultInverseJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultInverseJoinColumn() {
+ return ! this.hasSpecifiedInverseJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaVirtualJoinTableRelationshipStrategy getParent() {
+ return (JavaVirtualJoinTableRelationshipStrategy) super.getParent();
+ }
+
+ protected JavaVirtualJoinTableRelationshipStrategy getJoinStrategy() {
+ return this.getParent();
+ }
+
+ @Override
+ protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ protected ReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() {
+ return new InverseJoinColumnOwner();
+ }
+
+ protected JavaVirtualJoinColumn buildInverseJoinColumn(JoinColumn joinColumn) {
+ return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumn);
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return this.getJoinStrategy().getJoinTableDefaultName();
+ }
+
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getJoinStrategy().getRelationship().getMapping();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+
+ // ********** join column owners **********
+
+ /**
+ * just a little common behavior
+ */
+ protected abstract class AbstractJoinColumnOwner
+ implements ReadOnlyJoinColumn.Owner
+ {
+ protected AbstractJoinColumnOwner() {
+ super();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getRelationship().getTypeMapping();
+ }
+
+ /**
+ * by default, the join column is, obviously, in the join table;
+ * not sure whether it can be anywhere else...
+ */
+ public String getDefaultTableName() {
+ return GenericJavaVirtualJoinTable.this.getName();
+ }
+
+ /**
+ * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
+ */
+ public String getDefaultColumnName() {
+ throw new UnsupportedOperationException();
+ }
+
+ protected JavaVirtualRelationship getRelationship() {
+ return GenericJavaVirtualJoinTable.this.getJoinStrategy().getRelationship();
+ }
+ }
+
+
+ /**
+ * owner for "back-pointer" join columns;
+ * these point at the source/owning entity
+ */
+ protected class JoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ return this.getRelationship().getEntity();
+ }
+
+ public String getAttributeName() {
+ return MappingTools.getTargetAttributeName(GenericJavaVirtualJoinTable.this.getRelationshipMapping());
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericJavaVirtualJoinTable.this.defaultJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaVirtualJoinTable.this.joinColumnsSize();
+ }
+ }
+
+
+ /**
+ * owner for "forward-pointer" join columns;
+ * these point at the target/inverse entity
+ */
+ protected class InverseJoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected InverseJoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ RelationshipMapping relationshipMapping = GenericJavaVirtualJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
+ }
+
+ public String getAttributeName() {
+ RelationshipMapping relationshipMapping = GenericJavaVirtualJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getName();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericJavaVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaVirtualJoinTable.this.inverseJoinColumnsSize();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
new file mode 100644
index 0000000000..951094aed6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseColumn;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+
+public class JavaBaseColumnTextRangeResolver
+ extends JavaNamedColumnTextRangeResolver
+ implements BaseColumnTextRangeResolver
+{
+
+ public JavaBaseColumnTextRangeResolver(JavaBaseColumn column, CompilationUnit astRoot) {
+ super(column, astRoot);
+ }
+
+ @Override
+ protected JavaBaseColumn getColumn() {
+ return (JavaBaseColumn) super.getColumn();
+ }
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java
new file mode 100644
index 0000000000..7d13a41785
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+
+public class JavaBasicMappingDefinition
+ extends AbstractJavaBasicMappingDefinition
+{
+ // singleton
+ private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaBasicMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static DefaultJavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaBasicMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java
new file mode 100644
index 0000000000..db5e442034
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+
+public class JavaEmbeddableDefinition
+ implements JavaTypeMappingDefinition
+{
+ // singleton
+ private static final JavaEmbeddableDefinition INSTANCE = new JavaEmbeddableDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static JavaTypeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaEmbeddableDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return EmbeddableAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return EmptyIterable.instance();
+ }
+
+ public JavaEmbeddable buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) {
+ return factory.buildJavaEmbeddable(persistentType, (EmbeddableAnnotation) mappingAnnotation);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
new file mode 100644
index 0000000000..9695b24aca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
+
+public class JavaEmbeddedIdMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedIdMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singletong usage
+ */
+ private JavaEmbeddedIdMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return EmbeddedIdAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ AttributeOverrideAnnotation.ANNOTATION_NAME,
+ AttributeOverridesAnnotation.ANNOTATION_NAME,
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaEmbeddedIdMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java
new file mode 100644
index 0000000000..fc94ac724a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+
+public class JavaEmbeddedMappingDefinition
+ extends AbstractJavaEmbeddedMappingDefinition
+{
+ // singleton
+ private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static DefaultJavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaEmbeddedMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java
new file mode 100644
index 0000000000..485e0b658b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+
+public class JavaEntityDefinition
+ implements JavaTypeMappingDefinition
+{
+ // singleton
+ private static final JavaEntityDefinition INSTANCE = new JavaEntityDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static JavaTypeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaEntityDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return EntityAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ TableAnnotation.ANNOTATION_NAME,
+ SecondaryTableAnnotation.ANNOTATION_NAME,
+ SecondaryTablesAnnotation.ANNOTATION_NAME,
+ PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
+ PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME,
+ IdClassAnnotation.ANNOTATION_NAME,
+ InheritanceAnnotation.ANNOTATION_NAME,
+ DiscriminatorValueAnnotation.ANNOTATION_NAME,
+ DiscriminatorColumnAnnotation.ANNOTATION_NAME,
+ SequenceGeneratorAnnotation.ANNOTATION_NAME,
+ TableGeneratorAnnotation.ANNOTATION_NAME,
+ NamedQueryAnnotation.ANNOTATION_NAME,
+ NamedQueriesAnnotation.ANNOTATION_NAME,
+ NamedNativeQueryAnnotation.ANNOTATION_NAME,
+ NamedNativeQueriesAnnotation.ANNOTATION_NAME,
+ 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,
+ AttributeOverrideAnnotation.ANNOTATION_NAME,
+ AttributeOverridesAnnotation.ANNOTATION_NAME,
+ AssociationOverrideAnnotation.ANNOTATION_NAME,
+ AssociationOverridesAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaEntity buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) {
+ return factory.buildJavaEntity(persistentType, (EntityAnnotation) mappingAnnotation);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java
new file mode 100644
index 0000000000..af74224308
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
+
+public class JavaEntityTextRangeResolver
+ implements EntityTextRangeResolver
+{
+ private JavaEntity entity;
+
+ private CompilationUnit astRoot;
+
+
+ public JavaEntityTextRangeResolver(JavaEntity entity, CompilationUnit astRoot) {
+ this.entity = entity;
+ this.astRoot = astRoot;
+ }
+
+
+ public TextRange getTypeMappingTextRange() {
+ return this.entity.getValidationTextRange(this.astRoot);
+ }
+
+ public TextRange getIdClassTextRange() {
+ return this.entity.getIdClassReference().getValidationTextRange(this.astRoot);
+ }
+
+ public TextRange getAttributeMappingTextRange(String attributeName) {
+ return this.entity.getPersistentType().
+ getAttributeNamed(attributeName).getMapping().getValidationTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java
new file mode 100644
index 0000000000..1297324074
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaIdMappingDefinition
+ extends AbstractJavaIdMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaIdMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaIdMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..e715135955
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+
+public class JavaJoinColumnTextRangeResolver
+ extends JavaNamedColumnTextRangeResolver
+ implements JoinColumnTextRangeResolver
+{
+ public JavaJoinColumnTextRangeResolver(JavaJoinColumn column, CompilationUnit astRoot) {
+ super(column, astRoot);
+ }
+
+ @Override
+ protected JavaJoinColumn getColumn() {
+ return (JavaJoinColumn) super.getColumn();
+ }
+
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange(this.astRoot);
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java
new file mode 100644
index 0000000000..dbce1decd9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaManyToManyMappingDefinition
+ extends AbstractJavaManyToManyMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToManyMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaManyToManyMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java
new file mode 100644
index 0000000000..f93744128a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaManyToOneMappingDefinition
+ extends AbstractJavaManyToOneMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToOneMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaManyToOneMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java
new file mode 100644
index 0000000000..ce234ec00c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+
+public class JavaMappedSuperclassDefinition
+ implements JavaTypeMappingDefinition
+{
+ // singleton
+ private static final JavaMappedSuperclassDefinition INSTANCE = new JavaMappedSuperclassDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static JavaTypeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaMappedSuperclassDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return MappedSuperclassAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ IdClassAnnotation.ANNOTATION_NAME,
+ 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
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaMappedSuperclass buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) {
+ return factory.buildJavaMappedSuperclass(persistentType, (MappedSuperclassAnnotation) mappingAnnotation);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java
new file mode 100644
index 0000000000..c9319716ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+
+public class JavaMappedSuperclassTextRangeResolver
+ implements PrimaryKeyTextRangeResolver
+{
+ private JavaMappedSuperclass mappedSuperclass;
+
+ private CompilationUnit astRoot;
+
+
+ public JavaMappedSuperclassTextRangeResolver(
+ JavaMappedSuperclass mappedSuperclass, CompilationUnit astRoot) {
+
+ this.mappedSuperclass = mappedSuperclass;
+ this.astRoot = astRoot;
+ }
+
+
+ public TextRange getTypeMappingTextRange() {
+ return this.mappedSuperclass.getValidationTextRange(this.astRoot);
+ }
+
+ public TextRange getIdClassTextRange() {
+ return this.mappedSuperclass.getIdClassReference().getValidationTextRange(this.astRoot);
+ }
+
+ public TextRange getAttributeMappingTextRange(String attributeName) {
+ return this.mappedSuperclass.getPersistentType().
+ getAttributeNamed(attributeName).getMapping().getValidationTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
new file mode 100644
index 0000000000..cab6e08e67
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+
+public class JavaNamedColumnTextRangeResolver
+ implements NamedColumnTextRangeResolver
+{
+ protected final JavaNamedColumn javaNamedColumn;
+
+ protected final CompilationUnit astRoot;
+
+ public JavaNamedColumnTextRangeResolver(JavaNamedColumn javaNamedColumn, CompilationUnit astRoot) {
+ this.javaNamedColumn = javaNamedColumn;
+ this.astRoot = astRoot;
+ }
+
+ protected JavaNamedColumn getColumn() {
+ return this.javaNamedColumn;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.javaNamedColumn.getNameTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java
new file mode 100644
index 0000000000..b48a3deef0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java null type mapping
+ */
+public class JavaNullTypeMapping
+ extends AbstractJavaTypeMapping<Annotation>
+{
+ public JavaNullTypeMapping(JavaPersistentType parent) {
+ super(parent, null);
+ }
+
+ public String getKey() {
+ return MappingKeys.NULL_TYPE_MAPPING_KEY;
+ }
+
+ public JavaPersistentType getIdClass() {
+ return null;
+ }
+
+ public boolean isMapped() {
+ return false;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ /**
+ * We added this message here because the most likely solution is to add
+ * an annotation to the .java file.
+ * This message used to be found on the <class> tag in persistence.xml.
+ * The other possible way to fix the error is to remove it from persistence.xml.
+ * This can be accomplished with the Synchronize Classes action.
+ * We could also add a quick fix for this error.
+ */
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_INVALID_CLASS,
+ new String[] {this.getPersistentType().getName()},
+ this,
+ this.getValidationTextRange(astRoot)
+ )
+ );
+ }
+
+ @Override
+ public boolean validatesAgainstDatabase() {
+ return false;
+ }
+
+ @Override
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getPersistentType().getValidationTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java
new file mode 100644
index 0000000000..e2029a4f07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaOneToManyMappingDefinition
+ extends AbstractJavaOneToManyMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToManyMappingDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaOneToManyMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java
new file mode 100644
index 0000000000..6ed2d0b317
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaOneToOneMappingDefinition
+ extends AbstractJavaOneToOneMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToOneMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaOneToOneMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java
new file mode 100644
index 0000000000..7dcd7ce470
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverride;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+
+public class JavaOverrideTextRangeResolver
+ implements OverrideTextRangeResolver
+{
+ protected final JavaOverride javaOverride;
+
+ protected final CompilationUnit astRoot;
+
+ public JavaOverrideTextRangeResolver(JavaOverride javaOverride, CompilationUnit astRoot) {
+ this.javaOverride = javaOverride;
+ this.astRoot = astRoot;
+ }
+
+ protected JavaOverride getOverride() {
+ return this.javaOverride;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.javaOverride.getNameTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java
new file mode 100644
index 0000000000..83fe6f95ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+
+public class JavaPersistentAttributeTextRangeResolver
+ implements PersistentAttributeTextRangeResolver
+{
+ private JavaPersistentAttribute javaPersistentAttribute;
+
+ private CompilationUnit astRoot;
+
+ public JavaPersistentAttributeTextRangeResolver(JavaPersistentAttribute javaPersistentAttribute, CompilationUnit astRoot) {
+ this.javaPersistentAttribute = javaPersistentAttribute;
+ this.astRoot = astRoot;
+ }
+
+ public TextRange getAttributeTextRange() {
+ return this.javaPersistentAttribute.getValidationTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..261f522f4a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+
+public class JavaPrimaryKeyJoinColumnTextRangeResolver
+ extends JavaNamedColumnTextRangeResolver
+ implements BaseJoinColumnTextRangeResolver
+{
+
+ public JavaPrimaryKeyJoinColumnTextRangeResolver(JavaPrimaryKeyJoinColumn column, CompilationUnit astRoot) {
+ super(column, astRoot);
+ }
+
+ @Override
+ protected JavaPrimaryKeyJoinColumn getColumn() {
+ return (JavaPrimaryKeyJoinColumn) super.getColumn();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java
new file mode 100644
index 0000000000..2f431635bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaTable;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+
+public class JavaTableTextRangeResolver
+ implements TableTextRangeResolver
+{
+ protected final JavaTable javaTable;
+
+ protected final CompilationUnit astRoot;
+
+ public JavaTableTextRangeResolver(JavaTable javaTable, CompilationUnit astRoot) {
+ this.javaTable = javaTable;
+ this.astRoot = astRoot;
+ }
+
+ protected JavaTable getTable() {
+ return this.javaTable;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.javaTable.getNameTextRange(this.astRoot);
+ }
+
+ public TextRange getCatalogTextRange() {
+ return this.javaTable.getCatalogTextRange(this.astRoot);
+ }
+
+ public TextRange getSchemaTextRange() {
+ return this.javaTable.getSchemaTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java
new file mode 100644
index 0000000000..4618a9ec32
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
+
+public class JavaTransientMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaTransientMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaTransientMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return TransientAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return EmptyIterable.instance();
+ }
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaTransientMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java
new file mode 100644
index 0000000000..174e6b2b7a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
+
+public class JavaTypeMappingTextRangeResolver
+ implements TypeMappingTextRangeResolver
+{
+ private JavaTypeMapping typeMapping;
+
+ private CompilationUnit astRoot;
+
+ public JavaTypeMappingTextRangeResolver(JavaTypeMapping typeMapping, CompilationUnit astRoot) {
+ this.typeMapping = typeMapping;
+ this.astRoot = astRoot;
+ }
+
+ public TextRange getTypeMappingTextRange() {
+ return this.typeMapping.getValidationTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java
new file mode 100644
index 0000000000..c078d6fced
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaVersionMappingDefinition
+ extends AbstractJavaVersionMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaVersionMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaVersionMappingDefinition() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
new file mode 100644
index 0000000000..1ba0d7ae9c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
@@ -0,0 +1,1016 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> file
+ * <br>
+ * <code>entity-mappings</code> element
+ */
+public abstract class AbstractEntityMappings
+ extends AbstractOrmXmlContextNode
+ implements EntityMappings
+{
+ protected final XmlEntityMappings xmlEntityMappings;
+
+ protected String description;
+
+ protected String package_; // "package" is a Java keyword
+
+ protected AccessType specifiedAccess;
+ protected AccessType defaultAccess;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected final OrmPersistenceUnitMetadata persistenceUnitMetadata;
+
+ protected final Vector<OrmPersistentType> persistentTypes = new Vector<OrmPersistentType>();
+ protected final PersistentTypeContainerAdapter persistentTypeContainerAdapter = new PersistentTypeContainerAdapter();
+
+ protected final Vector<OrmSequenceGenerator> sequenceGenerators = new Vector<OrmSequenceGenerator>();
+ protected final SequenceGeneratorContainerAdapter sequenceGeneratorContainerAdapter = new SequenceGeneratorContainerAdapter();
+
+ protected final Vector<OrmTableGenerator> tableGenerators = new Vector<OrmTableGenerator>();
+ protected final TableGeneratorContainerAdapter tableGeneratorContainerAdapter = new TableGeneratorContainerAdapter();
+
+ protected final OrmQueryContainer queryContainer;
+
+
+ protected AbstractEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) {
+ super(parent);
+ this.xmlEntityMappings = xmlEntityMappings;
+
+ this.description = this.xmlEntityMappings.getDescription();
+ this.package_ = this.xmlEntityMappings.getPackage();
+
+ this.specifiedAccess = this.buildSpecifiedAccess();
+ this.specifiedCatalog = this.xmlEntityMappings.getCatalog();
+ this.specifiedSchema = this.xmlEntityMappings.getSchema();
+
+ this.persistenceUnitMetadata = this.buildPersistenceUnitMetadata();
+
+ this.initializePersistentTypes();
+ this.initializeSequenceGenerators();
+ this.initializeTableGenerators();
+
+ this.queryContainer = this.buildQueryContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+
+ this.setDescription_(this.xmlEntityMappings.getDescription());
+ this.setPackage_(this.xmlEntityMappings.getPackage());
+
+ this.setSpecifiedAccess_(this.buildSpecifiedAccess());
+ this.setSpecifiedCatalog_(this.xmlEntityMappings.getCatalog());
+ this.setSpecifiedSchema_(this.xmlEntityMappings.getSchema());
+
+ this.persistenceUnitMetadata.synchronizeWithResourceModel();
+
+ this.syncPersistentTypes();
+ this.syncSequenceGenerators();
+ this.syncTableGenerators();
+
+ this.queryContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setDefaultAccess(this.buildDefaultAccess());
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.setDefaultSchema(this.buildDefaultSchema());
+
+ this.persistenceUnitMetadata.update();
+
+ this.updateNodes(this.getPersistentTypes());
+ this.updateNodes(this.getSequenceGenerators());
+ this.updateNodes(this.getTableGenerators());
+
+ this.queryContainer.update();
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ public OrmXml getParent() {
+ return (OrmXml) super.getParent();
+ }
+
+ public OrmXml getOrmXml() {
+ return this.getParent();
+ }
+
+ @Override
+ public MappingFileRoot getMappingFileRoot() {
+ return this;
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return OrmStructureNodes.ENTITY_MAPPINGS_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ for (OrmPersistentType persistentType: this.getPersistentTypes()) {
+ if (persistentType.contains(textOffset)) {
+ return persistentType.getStructureNode(textOffset);
+ }
+ }
+ return this;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.xmlEntityMappings.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) {
+ ormPersistentType.dispose();
+ }
+ }
+
+
+ // ********** PersistentType.Owner implementation **********
+
+ public AccessType getOverridePersistentTypeAccess() {
+ return this.isXmlMappingMetadataComplete() ? this.specifiedAccess : null;
+ }
+
+ public AccessType getDefaultPersistentTypeAccess() {
+ return this.getAccess();
+ }
+
+ public String getDefaultPersistentTypePackage() {
+ return this.getPackage();
+ }
+
+ protected boolean isXmlMappingMetadataComplete() {
+ return this.getPersistenceUnit().isXmlMappingMetadataComplete();
+ }
+
+
+ // ********** persistence unit metadata **********
+
+ public OrmPersistenceUnitMetadata getPersistenceUnitMetadata() {
+ return this.persistenceUnitMetadata;
+ }
+
+ protected OrmPersistenceUnitMetadata buildPersistenceUnitMetadata() {
+ return this.getContextNodeFactory().buildOrmPersistenceUnitMetadata(this);
+ }
+
+
+ // ********** misc **********
+
+ public XmlEntityMappings getXmlEntityMappings() {
+ return this.xmlEntityMappings;
+ }
+
+ public String getVersion() {
+ return this.xmlEntityMappings.getVersion();
+ }
+
+ public void changeMapping(OrmPersistentType ormPersistentType, OrmTypeMapping oldMapping, OrmTypeMapping newMapping) {
+ AccessType savedAccess = ormPersistentType.getSpecifiedAccess();
+ int sourceIndex = this.persistentTypes.indexOf(ormPersistentType);
+ this.persistentTypes.remove(sourceIndex);
+ oldMapping.removeXmlTypeMappingFrom(this.xmlEntityMappings);
+ int targetIndex = this.calculateInsertionIndex(ormPersistentType);
+ this.persistentTypes.add(targetIndex, ormPersistentType);
+ newMapping.addXmlTypeMappingTo(this.xmlEntityMappings);
+
+ newMapping.initializeFrom(oldMapping);
+ //not sure where else to put this, need to set the access on the resource model
+ ormPersistentType.setSpecifiedAccess(savedAccess);
+ this.fireItemMoved(PERSISTENT_TYPES_LIST, targetIndex, sourceIndex);
+ }
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return (this.xmlEntityMappings != null) && this.xmlEntityMappings.containsOffset(textOffset);
+ }
+
+
+ // ********** description **********
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.setDescription_(description);
+ this.xmlEntityMappings.setDescription(description);
+ }
+
+ protected void setDescription_(String description) {
+ String old = this.description;
+ this.description = description;
+ this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description);
+ }
+
+
+ // ********** package **********
+
+ public String getPackage() {
+ return this.package_;
+ }
+
+ public void setPackage(String package_) {
+ this.setPackage_(package_);
+ this.xmlEntityMappings.setPackage(package_);
+ }
+
+ /**
+ * TODO If the package changes, we should probably clear out all resolved
+ * references to persistent types:<ul>
+ * <li>{@link OrmIdClassReference#getIdClass()}
+ * <li>{@link OrmPersistentType#getJavaPersistentType()}
+ * </ul>
+ */
+ protected void setPackage_(String package_) {
+ String old = this.package_;
+ this.package_ = package_;
+ this.firePropertyChanged(PACKAGE_PROPERTY, old, package_);
+ }
+
+
+ // ********** access **********
+
+ public AccessType getAccess() {
+ return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
+ }
+
+ public AccessType getSpecifiedAccess() {
+ return this.specifiedAccess;
+ }
+
+ public void setSpecifiedAccess(AccessType access) {
+ this.setSpecifiedAccess_(access);
+ this.xmlEntityMappings.setAccess(AccessType.toOrmResourceModel(access));
+ }
+
+ protected void setSpecifiedAccess_(AccessType access) {
+ AccessType old = this.specifiedAccess;
+ this.specifiedAccess = access;
+ this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildSpecifiedAccess() {
+ return AccessType.fromOrmResourceModel(this.xmlEntityMappings.getAccess());
+ }
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType access) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = access;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildDefaultAccess() {
+ return this.getPersistenceUnit().getDefaultAccess();
+ }
+
+
+ // ********** catalog **********
+
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ this.setSpecifiedCatalog_(catalog);
+ this.xmlEntityMappings.setCatalog(catalog);
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildDefaultCatalog() {
+ return this.getPersistenceUnit().getDefaultCatalog();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+
+ // ********** schema **********
+
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ this.setSpecifiedSchema_(schema);
+ this.xmlEntityMappings.setSchema(schema);
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildDefaultSchema() {
+ return this.getPersistenceUnit().getDefaultSchema();
+ }
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+
+ // ********** schema container **********
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+
+ // ********** persistent types **********
+
+ public ListIterable<OrmPersistentType> getPersistentTypes() {
+ return new LiveCloneListIterable<OrmPersistentType>(this.persistentTypes);
+ }
+
+ public int getPersistentTypesSize() {
+ return this.persistentTypes.size();
+ }
+
+ public OrmPersistentType getPersistentType(String className) {
+ for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) {
+ if (ormPersistentType.isFor(className)) {
+ return ormPersistentType;
+ }
+ }
+ return null;
+ }
+
+ public boolean containsPersistentType(String className) {
+ return this.getPersistentType(className) != null;
+ }
+
+ public PersistentType resolvePersistentType(String className) {
+ return (PersistentType) this.resolvePersistentType(PERSISTENT_TYPE_LOOKUP_ADAPTER, className);
+ }
+
+ public JavaResourcePersistentType resolveJavaResourcePersistentType(String className) {
+ return (JavaResourcePersistentType) this.resolvePersistentType(RESOURCE_PERSISTENT_TYPE_LOOKUP_ADAPTER, className);
+ }
+
+ protected Object resolvePersistentType(PersistentTypeLookupAdapter adapter, String className) {
+ if (className == null) {
+ return null;
+ }
+
+ // static inner class listed in orm.xml will use '$', replace with '.'
+ className = className.replace('$', '.');
+
+ // first try to resolve using only the locally specified name...
+ Object persistentType = adapter.resolvePersistentType(this, className);
+ if (persistentType != null) {
+ return persistentType;
+ }
+
+ // ...then try to resolve by prepending the global package name
+ if (this.getPackage() == null) {
+ return null;
+ }
+ return adapter.resolvePersistentType(this, this.getPackage() + '.' + className);
+ }
+
+ protected interface PersistentTypeLookupAdapter {
+ Object resolvePersistentType(EntityMappings entityMappings, String className);
+ }
+
+ protected static final PersistentTypeLookupAdapter PERSISTENT_TYPE_LOOKUP_ADAPTER =
+ new PersistentTypeLookupAdapter() {
+ public Object resolvePersistentType(EntityMappings entityMappings, String className) {
+ return entityMappings.getPersistenceUnit().getPersistentType(className);
+ }
+ };
+
+ protected static final PersistentTypeLookupAdapter RESOURCE_PERSISTENT_TYPE_LOOKUP_ADAPTER =
+ new PersistentTypeLookupAdapter() {
+ public Object resolvePersistentType(EntityMappings entityMappings, String className) {
+ return entityMappings.getJpaProject().getJavaResourcePersistentType(className);
+ }
+ };
+
+ /**
+ * We have to calculate the new persistent type's index.
+ * We will use the type's short name if the entity mappings's
+ * package is the same as the type's package.
+ */
+ public OrmPersistentType addPersistentType(String mappingKey, String className) {
+ OrmTypeMappingDefinition md = this.getMappingFileDefinition().getTypeMappingDefinition(mappingKey);
+ XmlTypeMapping xmlTypeMapping = md.buildResourceMapping(this.getResourceNodeFactory());
+ OrmPersistentType persistentType = this.buildPersistentType(xmlTypeMapping);
+ int index = this.calculateInsertionIndex(persistentType);
+ this.addItemToList(index, persistentType, this.persistentTypes, PERSISTENT_TYPES_LIST);
+
+ persistentType.getMapping().addXmlTypeMappingTo(this.xmlEntityMappings);
+
+ // adds short name if package name is relevant
+ className = this.normalizeClassName(className);
+ persistentType.getMapping().setClass(className);
+
+ return persistentType;
+ }
+
+ /**
+ * Shorten the specified class name if it is in the entity mappings's package.
+ */
+ protected String normalizeClassName(String className) {
+ return ((this.package_ != null) &&
+ className.startsWith(this.package_) &&
+ (className.charAt(this.package_.length()) == '.')) ?
+ className.substring(this.package_.length() + 1) :
+ className;
+ }
+
+ protected OrmPersistentType buildPersistentType(XmlTypeMapping xmlTypeMapping) {
+ return this.getContextNodeFactory().buildOrmPersistentType(this, xmlTypeMapping);
+ }
+
+ protected int calculateInsertionIndex(OrmPersistentType ormPersistentType) {
+ return CollectionTools.insertionIndexOf(this.persistentTypes, ormPersistentType, MAPPING_COMPARATOR);
+ }
+
+ protected static final Comparator<OrmPersistentType> MAPPING_COMPARATOR =
+ new Comparator<OrmPersistentType>() {
+ public int compare(OrmPersistentType o1, OrmPersistentType o2) {
+ int o1Sequence = o1.getMapping().getXmlSequence();
+ int o2Sequence = o2.getMapping().getXmlSequence();
+ if (o1Sequence < o2Sequence) {
+ return -1;
+ }
+ if (o1Sequence == o2Sequence) {
+ return 0;
+ }
+ return 1;
+ }
+ };
+
+ public void removePersistentType(int index) {
+ OrmPersistentType persistentType = this.removePersistentType_(index);
+ persistentType.getMapping().removeXmlTypeMappingFrom(this.xmlEntityMappings);
+ }
+
+ /**
+ * dispose and return the persistent type
+ */
+ protected OrmPersistentType removePersistentType_(int index) {
+ OrmPersistentType persistentType = this.removeItemFromList(index, this.persistentTypes, PERSISTENT_TYPES_LIST);
+ persistentType.dispose();
+ return persistentType;
+ }
+
+ public void removePersistentType(OrmPersistentType persistentType) {
+ this.removePersistentType(this.persistentTypes.indexOf(persistentType));
+ }
+
+ protected void initializePersistentTypes() {
+ for (XmlTypeMapping xmlTypeMapping : this.getXmlTypeMappings()) {
+ this.persistentTypes.add(this.buildPersistentType(xmlTypeMapping));
+ }
+ }
+
+ protected void syncPersistentTypes() {
+ ContextContainerTools.synchronizeWithResourceModel(this.persistentTypeContainerAdapter);
+ }
+
+ protected Iterable<XmlTypeMapping> getXmlTypeMappings() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlTypeMapping>(this.xmlEntityMappings.getTypeMappings());
+ }
+
+ protected void movePersistentType_(int index, OrmPersistentType persistentType) {
+ this.moveItemInList(index, persistentType, this.persistentTypes, PERSISTENT_TYPES_LIST);
+ }
+
+ protected void addPersistentType_(int index, XmlTypeMapping xmlTypeMapping) {
+ this.addItemToList(index, this.buildPersistentType(xmlTypeMapping), this.persistentTypes, PERSISTENT_TYPES_LIST);
+ }
+
+ protected void removePersistentType_(OrmPersistentType persistentType) {
+ this.removePersistentType_(this.persistentTypes.indexOf(persistentType));
+ }
+
+ /**
+ * persistent type container adapter
+ */
+ protected class PersistentTypeContainerAdapter
+ implements ContextContainerTools.Adapter<OrmPersistentType, XmlTypeMapping>
+ {
+ public Iterable<OrmPersistentType> getContextElements() {
+ return AbstractEntityMappings.this.getPersistentTypes();
+ }
+ public Iterable<XmlTypeMapping> getResourceElements() {
+ return AbstractEntityMappings.this.getXmlTypeMappings();
+ }
+ public XmlTypeMapping getResourceElement(OrmPersistentType contextElement) {
+ return contextElement.getMapping().getXmlTypeMapping();
+ }
+ public void moveContextElement(int index, OrmPersistentType element) {
+ AbstractEntityMappings.this.movePersistentType_(index, element);
+ }
+ public void addContextElement(int index, XmlTypeMapping resourceElement) {
+ AbstractEntityMappings.this.addPersistentType_(index, resourceElement);
+ }
+ public void removeContextElement(OrmPersistentType element) {
+ AbstractEntityMappings.this.removePersistentType_(element);
+ }
+ }
+
+
+ // ********** sequence generators **********
+
+ public ListIterable<OrmSequenceGenerator> getSequenceGenerators() {
+ return new LiveCloneListIterable<OrmSequenceGenerator>(this.sequenceGenerators);
+ }
+
+ public int getSequenceGeneratorsSize() {
+ return this.sequenceGenerators.size();
+ }
+
+ public OrmSequenceGenerator addSequenceGenerator() {
+ return this.addSequenceGenerator(this.sequenceGenerators.size());
+ }
+
+ public OrmSequenceGenerator addSequenceGenerator(int index) {
+ XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator();
+ OrmSequenceGenerator sequenceGenerator = this.addSequenceGenerator_(index, xmlGenerator);
+ this.xmlEntityMappings.getSequenceGenerators().add(index, xmlGenerator);
+ return sequenceGenerator;
+ }
+
+ protected XmlSequenceGenerator buildXmlSequenceGenerator() {
+ return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
+ }
+
+ protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator xmlSequenceGenerator) {
+ return this.getContextNodeFactory().buildOrmSequenceGenerator(this, xmlSequenceGenerator);
+ }
+
+ public void removeSequenceGenerator(OrmSequenceGenerator sequenceGenerator) {
+ this.removeSequenceGenerator(this.sequenceGenerators.indexOf(sequenceGenerator));
+ }
+
+ public void removeSequenceGenerator(int index) {
+ this.removeSequenceGenerator_(index);
+ this.xmlEntityMappings.getSequenceGenerators().remove(index);
+ }
+
+ protected void removeSequenceGenerator_(int index) {
+ this.removeItemFromList(index, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
+ }
+
+ public void moveSequenceGenerator(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
+ this.xmlEntityMappings.getSequenceGenerators().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeSequenceGenerators() {
+ for (XmlSequenceGenerator sequenceGenerator : this.getXmlSequenceGenerators()) {
+ this.sequenceGenerators.add(this.buildSequenceGenerator(sequenceGenerator));
+ }
+ }
+
+ protected void syncSequenceGenerators() {
+ ContextContainerTools.synchronizeWithResourceModel(this.sequenceGeneratorContainerAdapter);
+ }
+
+ protected Iterable<XmlSequenceGenerator> getXmlSequenceGenerators() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlSequenceGenerator>(this.xmlEntityMappings.getSequenceGenerators());
+ }
+
+ protected void moveSequenceGenerator_(int index, OrmSequenceGenerator sequenceGenerator) {
+ this.moveItemInList(index, sequenceGenerator, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
+ }
+
+ protected OrmSequenceGenerator addSequenceGenerator_(int index, XmlSequenceGenerator xmlSequenceGenerator) {
+ OrmSequenceGenerator sequenceGenerator = this.buildSequenceGenerator(xmlSequenceGenerator);
+ this.addItemToList(index, sequenceGenerator, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
+ return sequenceGenerator;
+ }
+
+ protected void removeSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) {
+ this.removeSequenceGenerator_(this.sequenceGenerators.indexOf(sequenceGenerator));
+ }
+
+ /**
+ * sequence generator container adapter
+ */
+ protected class SequenceGeneratorContainerAdapter
+ implements ContextContainerTools.Adapter<OrmSequenceGenerator, XmlSequenceGenerator>
+ {
+ public Iterable<OrmSequenceGenerator> getContextElements() {
+ return AbstractEntityMappings.this.getSequenceGenerators();
+ }
+ public Iterable<XmlSequenceGenerator> getResourceElements() {
+ return AbstractEntityMappings.this.getXmlSequenceGenerators();
+ }
+ public XmlSequenceGenerator getResourceElement(OrmSequenceGenerator contextElement) {
+ return contextElement.getXmlGenerator();
+ }
+ public void moveContextElement(int index, OrmSequenceGenerator element) {
+ AbstractEntityMappings.this.moveSequenceGenerator_(index, element);
+ }
+ public void addContextElement(int index, XmlSequenceGenerator resourceElement) {
+ AbstractEntityMappings.this.addSequenceGenerator_(index, resourceElement);
+ }
+ public void removeContextElement(OrmSequenceGenerator element) {
+ AbstractEntityMappings.this.removeSequenceGenerator_(element);
+ }
+ }
+
+
+ // ********** table generators **********
+
+ public ListIterable<OrmTableGenerator> getTableGenerators() {
+ return new LiveCloneListIterable<OrmTableGenerator>(this.tableGenerators);
+ }
+
+ public int getTableGeneratorsSize() {
+ return this.tableGenerators.size();
+ }
+
+ public OrmTableGenerator addTableGenerator() {
+ return this.addTableGenerator(this.tableGenerators.size());
+ }
+
+ public OrmTableGenerator addTableGenerator(int index) {
+ XmlTableGenerator xmlTableGenerator = this.buildXmlTableGenerator();
+ OrmTableGenerator tableGenerator = this.addTableGenerator_(index, xmlTableGenerator);
+ this.xmlEntityMappings.getTableGenerators().add(index, xmlTableGenerator);
+ return tableGenerator;
+ }
+
+ protected XmlTableGenerator buildXmlTableGenerator() {
+ return OrmFactory.eINSTANCE.createXmlTableGenerator();
+ }
+
+ protected OrmTableGenerator buildTableGenerator(XmlTableGenerator xmlTableGenerator) {
+ return this.getContextNodeFactory().buildOrmTableGenerator(this, xmlTableGenerator);
+ }
+
+ public void removeTableGenerator(OrmTableGenerator tableGenerator) {
+ this.removeTableGenerator(this.tableGenerators.indexOf(tableGenerator));
+ }
+
+ public void removeTableGenerator(int index) {
+ this.removeTableGenerator_(index);
+ this.xmlEntityMappings.getTableGenerators().remove(index);
+ }
+
+ protected void removeTableGenerator_(int index) {
+ this.removeItemFromList(index, this.tableGenerators, TABLE_GENERATORS_LIST);
+ }
+
+ public void moveTableGenerator(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.tableGenerators, TABLE_GENERATORS_LIST);
+ this.xmlEntityMappings.getTableGenerators().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeTableGenerators() {
+ for (XmlTableGenerator tableGenerator : this.getXmlTableGenerators()) {
+ this.tableGenerators.add(this.buildTableGenerator(tableGenerator));
+ }
+ }
+
+ protected void syncTableGenerators() {
+ ContextContainerTools.synchronizeWithResourceModel(this.tableGeneratorContainerAdapter);
+ }
+
+ protected Iterable<XmlTableGenerator> getXmlTableGenerators() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlTableGenerator>(this.xmlEntityMappings.getTableGenerators());
+ }
+
+ protected void moveTableGenerator_(int index, OrmTableGenerator tableGenerator) {
+ this.moveItemInList(index, tableGenerator, this.tableGenerators, TABLE_GENERATORS_LIST);
+ }
+
+ protected OrmTableGenerator addTableGenerator_(int index, XmlTableGenerator xmlTableGenerator) {
+ OrmTableGenerator tableGenerator = this.buildTableGenerator(xmlTableGenerator);
+ this.addItemToList(index, tableGenerator, this.tableGenerators, TABLE_GENERATORS_LIST);
+ return tableGenerator;
+ }
+
+ protected void removeTableGenerator_(OrmTableGenerator tableGenerator) {
+ this.removeTableGenerator_(this.tableGenerators.indexOf(tableGenerator));
+ }
+
+ /**
+ * table generator container adapter
+ */
+ protected class TableGeneratorContainerAdapter
+ implements ContextContainerTools.Adapter<OrmTableGenerator, XmlTableGenerator>
+ {
+ public Iterable<OrmTableGenerator> getContextElements() {
+ return AbstractEntityMappings.this.getTableGenerators();
+ }
+ public Iterable<XmlTableGenerator> getResourceElements() {
+ return AbstractEntityMappings.this.getXmlTableGenerators();
+ }
+ public XmlTableGenerator getResourceElement(OrmTableGenerator contextElement) {
+ return contextElement.getXmlGenerator();
+ }
+ public void moveContextElement(int index, OrmTableGenerator element) {
+ AbstractEntityMappings.this.moveTableGenerator_(index, element);
+ }
+ public void addContextElement(int index, XmlTableGenerator resourceElement) {
+ AbstractEntityMappings.this.addTableGenerator_(index, resourceElement);
+ }
+ public void removeContextElement(OrmTableGenerator element) {
+ AbstractEntityMappings.this.removeTableGenerator_(element);
+ }
+ }
+
+
+ // ********** query container **********
+
+ public OrmQueryContainer getQueryContainer() {
+ return this.queryContainer;
+ }
+
+ protected OrmQueryContainer buildQueryContainer() {
+ return this.getContextNodeFactory().buildOrmQueryContainer(this, this.xmlEntityMappings);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateVersion(messages);
+ this.validateGenerators(messages);
+ this.queryContainer.validate(messages, reporter);
+ for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) {
+ this.validatePersistentType(ormPersistentType, messages, reporter);
+ }
+ }
+
+ protected void validateVersion(List<IMessage> messages) {
+ if (! this.getLatestDocumentVersion().equals(this.xmlEntityMappings.getVersion())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.LOW_SEVERITY,
+ JpaValidationMessages.XML_VERSION_NOT_LATEST,
+ this,
+ this.xmlEntityMappings.getVersionTextRange()
+ )
+ );
+ }
+ }
+
+ /**
+ * Return the latest version of the document supported by the platform
+ */
+ protected String getLatestDocumentVersion() {
+ return this.getJpaPlatform().getMostRecentSupportedResourceType(this.getContentType()).getVersion();
+ }
+
+ protected IContentType getContentType() {
+ return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE;
+ }
+
+ protected void validateGenerators(List<IMessage> messages) {
+ for (OrmGenerator localGenerator : this.getGenerators()) {
+ String name = localGenerator.getName();
+ if (StringTools.stringIsEmpty(name)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.GENERATOR_NAME_UNDEFINED,
+ new String[] {},
+ localGenerator,
+ localGenerator.getNameTextRange()
+ ));
+ } else {
+ List<String> reportedNames = new ArrayList<String>();
+ for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) {
+ if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.GENERATOR_DUPLICATE_NAME,
+ new String[] {localGenerator.getName()},
+ localGenerator,
+ localGenerator.getNameTextRange()
+ )
+ );
+ reportedNames.add(name);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Return all the generators, table and sequence.
+ */
+ @SuppressWarnings("unchecked")
+ protected Iterable<OrmGenerator> getGenerators() {
+ return new CompositeIterable<OrmGenerator>(
+ this.getTableGenerators(),
+ this.getSequenceGenerators()
+ );
+ }
+
+
+ protected void validatePersistentType(OrmPersistentType persistentType, List<IMessage> messages, IReporter reporter) {
+ try {
+ persistentType.validate(messages, reporter);
+ } catch (Throwable exception) {
+ JptJpaCorePlugin.log(exception);
+ }
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<DeleteEdit> createDeleteTypeEdits(final IType type) {
+ return new CompositeIterable<DeleteEdit>(
+ new TransformationIterable<OrmPersistentType, Iterable<DeleteEdit>>(this.getPersistentTypes()) {
+ @Override
+ protected Iterable<DeleteEdit> transform(OrmPersistentType persistentType) {
+ return persistentType.createDeleteTypeEdits(type);
+ }
+ }
+ );
+ }
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(final IType originalType, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<OrmPersistentType, Iterable<ReplaceEdit>>(this.getPersistentTypes()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(OrmPersistentType persistentType) {
+ return persistentType.createRenameTypeEdits(originalType, newName);
+ }
+ }
+ );
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<OrmPersistentType, Iterable<ReplaceEdit>>(this.getPersistentTypes()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(OrmPersistentType persistentType) {
+ return persistentType.createMoveTypeEdits(originalType, newPackage);
+ }
+ }
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.createPersistentTypeRenamePackageEdits(originalPackage, newName),
+ this.createRenamePackageEdit(originalPackage, newName));
+ }
+
+ protected Iterable<ReplaceEdit> createPersistentTypeRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<OrmPersistentType, Iterable<ReplaceEdit>>(this.getPersistentTypes()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(OrmPersistentType persistentType) {
+ return persistentType.createRenamePackageEdits(originalPackage, newName);
+ }
+ }
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createRenamePackageEdit(final IPackageFragment originalPackage, final String newName) {
+ return Tools.valuesAreEqual(this.package_, originalPackage.getElementName()) ?
+ new SingleElementIterable<ReplaceEdit>(this.xmlEntityMappings.createRenamePackageEdit(newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java
new file mode 100644
index 0000000000..0c05faba25
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java
@@ -0,0 +1,419 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.ColumnMapping;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMultiRelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSingleRelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.SimpleMetamodelField;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
+ extends AbstractOrmXmlContextNode
+ implements OrmAttributeMapping, AttributeMapping2_0
+{
+ protected final X xmlAttributeMapping;
+
+ protected String name;
+
+
+ protected AbstractOrmAttributeMapping(OrmPersistentAttribute parent, X xmlAttributeMapping) {
+ super(parent);
+ this.xmlAttributeMapping = xmlAttributeMapping;
+ this.name = xmlAttributeMapping.getName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.xmlAttributeMapping.getName());
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.setName_(name);
+ this.xmlAttributeMapping.setName(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ if (this.firePropertyChanged(NAME_PROPERTY, old, name)) {
+ // tell our attribute its name has, effectively, changed
+ this.getPersistentAttribute().nameChanged(old, name);
+ }
+ }
+
+
+ // ********** morphing mappings **********
+
+ public void initializeFromOrmAttributeMapping(OrmAttributeMapping oldMapping) {
+ this.setName(oldMapping.getName());
+ }
+
+ protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
+ this.initializeFromOrmAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromOrmBasicMapping(OrmBasicMapping oldMapping) {
+ this.initializeFromOrmColumnMapping(oldMapping);
+ }
+
+ public void initializeFromOrmIdMapping(OrmIdMapping oldMapping) {
+ this.initializeFromOrmColumnMapping(oldMapping);
+ }
+
+ public void initializeFromOrmTransientMapping(OrmTransientMapping oldMapping) {
+ this.initializeFromOrmAttributeMapping(oldMapping);
+ }
+
+ protected void initializeFromOrmBaseEmbeddedMapping(OrmBaseEmbeddedMapping oldMapping) {
+ this.initializeFromOrmAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromOrmEmbeddedMapping(OrmEmbeddedMapping oldMapping) {
+ this.initializeFromOrmBaseEmbeddedMapping(oldMapping);
+ }
+
+ public void initializeFromOrmEmbeddedIdMapping(OrmEmbeddedIdMapping oldMapping) {
+ this.initializeFromOrmBaseEmbeddedMapping(oldMapping);
+ }
+
+ public void initializeFromOrmVersionMapping(OrmVersionMapping oldMapping) {
+ this.initializeFromOrmColumnMapping(oldMapping);
+ }
+
+ protected void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) {
+ this.initializeFromOrmAttributeMapping(oldMapping);
+ }
+
+ protected void initializeFromOrmMultiRelationshipMapping(OrmMultiRelationshipMapping oldMapping) {
+ this.initializeFromOrmRelationshipMapping(oldMapping);
+ }
+
+ protected void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
+ this.initializeFromOrmRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromOrmOneToManyMapping(OrmOneToManyMapping oldMapping) {
+ this.initializeFromOrmMultiRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromOrmManyToOneMapping(OrmManyToOneMapping oldMapping) {
+ this.initializeFromOrmSingleRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromOrmOneToOneMapping(OrmOneToOneMapping oldMapping) {
+ this.initializeFromOrmSingleRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromOrmManyToManyMapping(OrmManyToManyMapping oldMapping) {
+ this.initializeFromOrmMultiRelationshipMapping(oldMapping);
+ }
+
+
+ // ********** misc **********
+
+ public X getXmlAttributeMapping() {
+ return this.xmlAttributeMapping;
+ }
+
+ @Override
+ public OrmPersistentAttribute getParent() {
+ return (OrmPersistentAttribute) super.getParent();
+ }
+
+ public OrmPersistentAttribute getPersistentAttribute() {
+ return this.getParent();
+ }
+
+ public OrmTypeMapping getTypeMapping() {
+ return this.getPersistentAttribute().getOwningTypeMapping();
+ }
+
+ protected JavaPersistentAttribute getJavaPersistentAttribute() {
+ return this.getPersistentAttribute().getJavaPersistentAttribute();
+ }
+
+ // TODO remove this method - it will always return false...
+ // subclass member classes like this method
+ public boolean isVirtual() {
+ return false;
+ }
+
+ protected EntityMappings getEntityMappings() {
+ return this.getPersistentAttribute().getOwningPersistentType().getParent();
+ }
+
+ protected PersistentType resolvePersistentType(String className) {
+ return this.getEntityMappings().resolvePersistentType(className);
+ }
+
+ public boolean isDefault() {
+ return false;
+ }
+
+ public String getPrimaryKeyColumnName() {
+ return null;
+ }
+
+ public boolean isOverridableAttributeMapping() {
+ return false;
+ }
+
+ public boolean isOverridableAssociationMapping() {
+ return false;
+ }
+
+ public boolean isRelationshipOwner() {
+ return false;
+ }
+
+ public boolean isOwnedBy(AttributeMapping mapping) {
+ return false;
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.getTypeMapping().validatesAgainstDatabase();
+ }
+
+ public boolean contains(int textOffset) {
+ return this.xmlAttributeMapping.containsOffset(textOffset);
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.xmlAttributeMapping.getSelectionTextRange();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.xmlAttributeMapping.getValidationTextRange();
+ }
+
+ public TextRange getNameTextRange() {
+ return this.xmlAttributeMapping.getNameTextRange();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** embedded mappings **********
+
+ public Iterator<String> allMappingNames() {
+ return (this.name != null) ?
+ new SingleElementIterator<String>(this.name) :
+ EmptyIterator.<String>instance();
+ }
+
+ public Iterator<String> allOverridableAttributeMappingNames() {
+ return ((this.name != null) && this.isOverridableAttributeMapping()) ?
+ new SingleElementIterator<String>(this.name) :
+ EmptyIterator.<String>instance();
+ }
+
+ public Iterator<String> allOverridableAssociationMappingNames() {
+ return ((this.name != null) && this.isOverridableAssociationMapping()) ?
+ new SingleElementIterator<String>(this.name) :
+ EmptyIterator.<String>instance();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ ColumnMapping mapping = this.resolveColumnMapping(attributeName);
+ return (mapping == null) ? null : mapping.getColumn();
+ }
+
+ protected ColumnMapping resolveColumnMapping(String attributeName) {
+ AttributeMapping mapping = this.resolveAttributeMapping(attributeName);
+ return ((mapping != null) && mapping.isOverridableAttributeMapping()) ? (ColumnMapping) mapping : null;
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ RelationshipMapping mapping = this.resolveRelationshipMapping(attributeName);
+ return (mapping == null) ? null : mapping.getRelationship();
+ }
+
+ protected RelationshipMapping resolveRelationshipMapping(String attributeName) {
+ AttributeMapping mapping = this.resolveAttributeMapping(attributeName);
+ return ((mapping != null) && mapping.isOverridableAssociationMapping()) ?
+ (RelationshipMapping) mapping :
+ null;
+ }
+
+ public AttributeMapping resolveAttributeMapping(String attributeName) {
+ return Tools.valuesAreEqual(attributeName, this.name) ? this : null;
+ }
+
+ protected Transformer<String, String> buildQualifierTransformer() {
+ return new MappingTools.QualifierTransformer(this.name);
+ }
+
+ protected String unqualify(String attributeName) {
+ return MappingTools.unqualify(this.name, attributeName);
+ }
+
+
+ // ********** metamodel **********
+
+ public MetamodelField getMetamodelField() {
+ // if we don't have a name we can't build a metamodel field...
+ String metamodelFieldName = this.getMetamodelFieldName();
+ return (metamodelFieldName == null) ? null :
+ new SimpleMetamodelField(
+ this.getMetamodelFieldModifiers(),
+ this.getMetamodelFieldTypeName(),
+ this.getMetamodelFieldTypeArgumentNames(),
+ metamodelFieldName
+ );
+ }
+
+ protected Iterable<String> getMetamodelFieldModifiers() {
+ return STANDARD_METAMODEL_FIELD_MODIFIERS;
+ }
+
+ /**
+ * most mappings are "singular"
+ */
+ protected String getMetamodelFieldTypeName() {
+ return JPA2_0.SINGULAR_ATTRIBUTE;
+ }
+
+ protected final Iterable<String> getMetamodelFieldTypeArgumentNames() {
+ ArrayList<String> typeArgumentNames = new ArrayList<String>(3);
+ typeArgumentNames.add(this.getTypeMapping().getPersistentType().getName());
+ this.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ return typeArgumentNames;
+ }
+
+ /**
+ * by default, we add only the mapping's attribute type name;
+ * but collection relationship mappings will also need to add the key type
+ * name if the "collection" is of type java.util.Map
+ */
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ typeArgumentNames.add(this.getMetamodelTypeName());
+ }
+
+ public String getMetamodelTypeName() {
+ return ((OrmPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelTypeName();
+ }
+
+ protected String getMetamodelFieldName() {
+ return this.name;
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return EmptyIterable.instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateAttribute(messages);
+ this.validateMapping(messages);
+ }
+
+ protected void validateAttribute(List<IMessage> messages) {
+ if (StringTools.stringIsEmpty(this.name)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ }
+
+ //TODO validation message - i think more info is needed in this message. include type mapping type?
+ protected void validateMapping(List<IMessage> messages) {
+ if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
+ new String[] {this.name},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java
new file mode 100644
index 0000000000..75782eb2f6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseColumn;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn;
+
+/**
+ * <code>orm.xml</code> column or join column
+ */
+public abstract class AbstractOrmBaseColumn<X extends AbstractXmlColumn, O extends OrmBaseColumn.Owner>
+ extends AbstractOrmNamedColumn<X, O>
+ implements OrmBaseColumn
+{
+ protected String specifiedTable;
+ protected String defaultTable;
+
+ // TODO defaults from java for all of these settings
+ protected Boolean specifiedUnique;
+
+ protected Boolean specifiedNullable;
+
+ protected Boolean specifiedInsertable;
+
+ protected Boolean specifiedUpdatable;
+
+
+ // ********** constructor/initialization **********
+
+ protected AbstractOrmBaseColumn(XmlContextNode parent, O owner) {
+ this(parent, owner, null);
+ }
+
+ protected AbstractOrmBaseColumn(XmlContextNode parent, O owner, X xmlColumn) {
+ super(parent, owner, xmlColumn);
+ this.specifiedTable = this.buildSpecifiedTable();
+ this.specifiedUnique = this.buildSpecifiedUnique();
+ this.specifiedNullable = this.buildSpecifiedNullable();
+ this.specifiedInsertable = this.buildSpecifiedInsertable();
+ this.specifiedUpdatable = this.buildSpecifiedUpdatable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTable_(this.buildSpecifiedTable());
+ this.setSpecifiedUnique_(this.buildSpecifiedUnique());
+ this.setSpecifiedNullable_(this.buildSpecifiedNullable());
+ this.setSpecifiedInsertable_(this.buildSpecifiedInsertable());
+ this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultTable(this.buildDefaultTable());
+ }
+
+
+ // ********** table **********
+
+ @Override
+ public String getTable() {
+ return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ public void setSpecifiedTable(String table) {
+ if (this.valuesAreDifferent(this.specifiedTable, table)) {
+ X xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedTable_(table);
+ xmlColumn.setTable(table);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedTable_(String table) {
+ String old = this.specifiedTable;
+ this.specifiedTable = table;
+ this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildSpecifiedTable() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getTable();
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String table) {
+ String old = this.defaultTable;
+ this.defaultTable = table;
+ this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildDefaultTable() {
+ return this.owner.getDefaultTableName();
+ }
+
+
+ // ********** unique **********
+
+ public boolean isUnique() {
+ return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique();
+ }
+
+ public Boolean getSpecifiedUnique() {
+ return this.specifiedUnique;
+ }
+
+ public void setSpecifiedUnique(Boolean unique) {
+ if (this.valuesAreDifferent(this.specifiedUnique, unique)) {
+ X xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedUnique_(unique);
+ xmlColumn.setUnique(unique);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedUnique_(Boolean unique) {
+ Boolean old = this.specifiedUnique;
+ this.specifiedUnique = unique;
+ this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique);
+ }
+
+ protected Boolean buildSpecifiedUnique() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getUnique();
+ }
+
+ public boolean isDefaultUnique() {
+ return DEFAULT_UNIQUE;
+ }
+
+
+ // ********** nullable **********
+
+ public boolean isNullable() {
+ return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable();
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean nullable) {
+ if (this.valuesAreDifferent(this.specifiedNullable, nullable)) {
+ X xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedNullable_(nullable);
+ xmlColumn.setNullable(nullable);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedNullable_(Boolean nullable) {
+ Boolean old = this.specifiedNullable;
+ this.specifiedNullable = nullable;
+ this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected Boolean buildSpecifiedNullable() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getNullable();
+ }
+
+ public boolean isDefaultNullable() {
+ return DEFAULT_NULLABLE;
+ }
+
+
+ // ********** insertable **********
+
+ public boolean isInsertable() {
+ return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable();
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean insertable) {
+ if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) {
+ X xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedInsertable_(insertable);
+ xmlColumn.setInsertable(insertable);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedInsertable_(Boolean insertable) {
+ Boolean old = this.specifiedInsertable;
+ this.specifiedInsertable = insertable;
+ this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected Boolean buildSpecifiedInsertable() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getInsertable();
+ }
+
+ public boolean isDefaultInsertable() {
+ return DEFAULT_INSERTABLE;
+ }
+
+
+ // ********** updatable **********
+
+ public boolean isUpdatable() {
+ return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable();
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean updatable) {
+ if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) {
+ X xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedUpdatable_(updatable);
+ xmlColumn.setUpdatable(updatable);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedUpdatable_(Boolean updatable) {
+ Boolean old = this.specifiedUpdatable;
+ this.specifiedUpdatable = updatable;
+ this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected Boolean buildSpecifiedUpdatable() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getUpdatable();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return DEFAULT_UPDATABLE;
+ }
+
+
+ // ********** misc **********
+
+ protected void initializeFrom(ReadOnlyBaseColumn oldColumn) {
+ super.initializeFrom(oldColumn);
+ this.setSpecifiedTable(oldColumn.getSpecifiedTable());
+ this.setSpecifiedUnique(oldColumn.getSpecifiedUnique());
+ this.setSpecifiedNullable(oldColumn.getSpecifiedNullable());
+ this.setSpecifiedInsertable(oldColumn.getSpecifiedInsertable());
+ this.setSpecifiedUpdatable(oldColumn.getSpecifiedUpdatable());
+ }
+
+ protected void initializeFromVirtual(ReadOnlyBaseColumn virtualColumn) {
+ super.initializeFromVirtual(virtualColumn);
+ this.setSpecifiedTable(virtualColumn.getTable());
+ // ignore other settings?
+ }
+
+ public boolean tableNameIsInvalid() {
+ return this.owner.tableNameIsInvalid(this.getTable());
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.owner.candidateTableNames();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getTableTextRange() {
+ return this.getTextRange(this.getXmlColumnTableTextRange());
+ }
+
+ protected TextRange getXmlColumnTableTextRange() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getTableTextRange();
+ }
+
+ @Override
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmBaseColumnTextRangeResolver(this);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
new file mode 100644
index 0000000000..98cc922c63
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
@@ -0,0 +1,328 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> embedded or embedded ID mapping
+ */
+public abstract class AbstractOrmBaseEmbeddedMapping<X extends AbstractXmlEmbedded>
+ extends AbstractOrmAttributeMapping<X>
+ implements OrmBaseEmbeddedMapping
+{
+ protected final OrmAttributeOverrideContainer attributeOverrideContainer;
+
+ protected Embeddable targetEmbeddable;
+
+
+ protected AbstractOrmBaseEmbeddedMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.attributeOverrideContainer = this.buildAttributeOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.attributeOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.attributeOverrideContainer.update();
+ this.setTargetEmbeddable(this.buildTargetEmbeddable());
+ }
+
+
+ // ********** attribute override container **********
+
+ public OrmAttributeOverrideContainer getAttributeOverrideContainer() {
+ return this.attributeOverrideContainer;
+ }
+
+ protected OrmAttributeOverrideContainer buildAttributeOverrideContainer() {
+ return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildAttributeOverrideContainerOwner());
+ }
+
+ protected OrmAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() {
+ return new AttributeOverrideContainerOwner();
+ }
+
+
+ // ********** target embeddable **********
+
+ public Embeddable getTargetEmbeddable() {
+ return this.targetEmbeddable;
+ }
+
+ protected void setTargetEmbeddable(Embeddable embeddable) {
+ Embeddable old = this.targetEmbeddable;
+ this.targetEmbeddable = embeddable;
+ this.firePropertyChanged(TARGET_EMBEDDABLE_PROPERTY, old, embeddable);
+ }
+
+ protected Embeddable buildTargetEmbeddable() {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ return (javaAttribute == null) ? null : javaAttribute.getEmbeddable();
+ }
+
+
+ // ********** embedded mappings **********
+
+ @Override
+ public Iterator<String> allOverridableAttributeMappingNames() {
+ return this.isJpa2_0Compatible() ?
+ this.embeddableOverridableAttributeMappingNames() :
+ super.allOverridableAttributeMappingNames();
+ }
+
+ protected Iterator<String> embeddableOverridableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ @Override
+ public Iterator<String> allOverridableAssociationMappingNames() {
+ return this.isJpa2_0Compatible() ?
+ this.embeddableOverridableAssociationMappingNames() :
+ super.allOverridableAssociationMappingNames();
+ }
+
+ protected Iterator<String> embeddableOverridableAssociationMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<String> qualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<String, String>(this.embeddableAttributeMappingNames(transformer), this.buildQualifierTransformer());
+ }
+
+ protected Iterator<String> embeddableAttributeMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new CompositeIterator<String>(this.embeddableAttributeMappingNamesLists(transformer));
+ }
+
+ /**
+ * Return a list of lists; each nested list holds the names for one of the
+ * embedded mapping's target embeddable type mapping's attribute mappings
+ * (attribute or association mappings, depending on the specified transformer).
+ */
+ protected Iterator<Iterator<String>> embeddableAttributeMappingNamesLists(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings(), transformer);
+ }
+
+ /**
+ * Return the target embeddable's attribute mappings.
+ */
+ protected Iterator<AttributeMapping> embeddableAttributeMappings() {
+ return ((this.targetEmbeddable != null) && (this.targetEmbeddable != this.getTypeMapping())) ?
+ this.targetEmbeddable.attributeMappings() :
+ EmptyIterator.<AttributeMapping>instance();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected void initializeFromOrmBaseEmbeddedMapping(OrmBaseEmbeddedMapping oldMapping) {
+ super.initializeFromOrmBaseEmbeddedMapping(oldMapping);
+ this.attributeOverrideContainer.initializeFrom(oldMapping.getAttributeOverrideContainer());
+ }
+
+ protected JavaAttributeOverride getSpecifiedJavaAttributeOverrideNamed(String attributeName) {
+ JavaBaseEmbeddedMapping javaMapping = this.getJavaEmbeddedMapping();
+ return (javaMapping == null) ? null : javaMapping.getAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName);
+ }
+
+ protected JavaBaseEmbeddedMapping getJavaEmbeddedMapping() {
+ JavaAttributeMapping javaMapping = this.getJavaAttributeMapping();
+ return ((javaMapping != null) && this.valuesAreEqual(javaMapping.getKey(), this.getKey())) ?
+ (JavaBaseEmbeddedMapping) javaMapping : null;
+ }
+
+ protected JavaAttributeMapping getJavaAttributeMapping() {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ return (javaAttribute == null) ? null : javaAttribute.getMapping();
+ }
+
+ @Override
+ public Column resolveOverriddenColumn(String attributeName) {
+ return this.isJpa2_0Compatible() ? this.resolveOverriddenColumn_(attributeName) : null;
+ }
+
+ protected Column resolveOverriddenColumn_(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName);
+ }
+
+ protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) {
+ return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenColumn(attributeName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ if (this.validateTargetEmbeddable(messages)) {
+ this.validateOverrides(messages, reporter);
+ }
+ }
+
+ protected boolean validateTargetEmbeddable(List<IMessage> messages) {
+ if (this.targetEmbeddable == null) {
+ String targetEmbeddableTypeName = this.getPersistentAttribute().getTypeName();
+ // if the type isn't resolvable, there'll already be a java error
+ if (targetEmbeddableTypeName != null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TARGET_NOT_AN_EMBEDDABLE,
+ new String[] {targetEmbeddableTypeName},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ return false;
+ }
+ return true;
+ }
+
+ protected void validateOverrides(List<IMessage> messages, IReporter reporter) {
+ this.attributeOverrideContainer.validate(messages, reporter);
+ }
+
+
+ // ********** attribute override container owner *********
+
+ protected class AttributeOverrideContainerOwner
+ implements OrmAttributeOverrideContainer.Owner
+ {
+ public OrmTypeMapping getTypeMapping() {
+ return AbstractOrmBaseEmbeddedMapping.this.getTypeMapping();
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractOrmBaseEmbeddedMapping.this.getTargetEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? this.allOverridableAttributeNames_(typeMapping) : EmptyIterator.<String>instance();
+ }
+
+ /**
+ * pre-condition: type mapping is not <code>null</code>
+ * <p>
+ * NB: Overridden in {@link GenericOrmEmbeddedIdMapping.AttributeOverrideContainerOwner}
+ */
+ protected Iterator<String> allOverridableAttributeNames_(TypeMapping typeMapping) {
+ return typeMapping.allOverridableAttributeNames();
+ }
+
+ public EList<XmlAttributeOverride> getXmlOverrides() {
+ return AbstractOrmBaseEmbeddedMapping.this.getXmlAttributeMapping().getAttributeOverrides();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) {
+ JavaAttributeOverride javaOverride = AbstractOrmBaseEmbeddedMapping.this.getSpecifiedJavaAttributeOverrideNamed(attributeName);
+ if (javaOverride != null) {
+ return javaOverride.getColumn();
+ }
+ }
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+ public TextRange getValidationTextRange() {
+ return AbstractOrmBaseEmbeddedMapping.this.getValidationTextRange();
+ }
+
+ protected OrmPersistentAttribute getPersistentAttribute() {
+ return AbstractOrmBaseEmbeddedMapping.this.getPersistentAttribute();
+ }
+
+ protected boolean mappingIsVirtual() {
+ return AbstractOrmBaseEmbeddedMapping.this.isVirtual();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java
new file mode 100644
index 0000000000..60ab3a1f63
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java
@@ -0,0 +1,425 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> basic mapping
+ */
+public abstract class AbstractOrmBasicMapping<X extends XmlBasic>
+ extends AbstractOrmAttributeMapping<X>
+ implements OrmBasicMapping
+{
+ protected final OrmColumn column;
+
+ protected FetchType specifiedFetch;
+ protected FetchType defaultFetch;
+
+ protected Boolean specifiedOptional;
+ protected boolean defaultOptional;
+
+ protected OrmConverter converter; // never null
+
+
+ protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
+ OrmEnumeratedConverter.Adapter.instance(),
+ OrmTemporalConverter.Adapter.instance(),
+ OrmLobConverter.Adapter.instance()
+ };
+ protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractOrmBasicMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.column = this.buildColumn();
+ this.specifiedFetch = this.buildSpecifiedFetch();
+ this.specifiedOptional = this.buildSpecifiedOptional();
+ this.converter = this.buildConverter();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ this.setSpecifiedFetch_(this.buildSpecifiedFetch());
+ this.setSpecifiedOptional_(this.buildSpecifiedOptional());
+ this.syncConverter();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ this.setDefaultFetch(this.buildDefaultFetch());
+ this.setDefaultOptional(this.buildDefaultOptional());
+ this.converter.update();
+ }
+
+
+ // ********** column **********
+
+ public OrmColumn getColumn() {
+ return this.column;
+ }
+
+ protected OrmColumn buildColumn() {
+ return this.getContextNodeFactory().buildOrmColumn(this, this);
+ }
+
+
+ // ********** fetch **********
+
+ public FetchType getFetch() {
+ return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType fetch) {
+ this.setSpecifiedFetch_(fetch);
+ this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch));
+ }
+
+ protected void setSpecifiedFetch_(FetchType fetch) {
+ FetchType old = this.specifiedFetch;
+ this.specifiedFetch = fetch;
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildSpecifiedFetch() {
+ return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch());
+ }
+
+ public FetchType getDefaultFetch() {
+ return this.defaultFetch;
+ }
+
+ protected void setDefaultFetch(FetchType fetch) {
+ FetchType old = this.defaultFetch;
+ this.defaultFetch = fetch;
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+
+ // ********** optional **********
+
+ public boolean isOptional() {
+ return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.isDefaultOptional();
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean optional) {
+ this.setSpecifiedOptional_(optional);
+ this.xmlAttributeMapping.setOptional(optional);
+ }
+
+ protected void setSpecifiedOptional_(Boolean optional) {
+ Boolean old = this.specifiedOptional;
+ this.specifiedOptional = optional;
+ this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ protected Boolean buildSpecifiedOptional() {
+ return this.xmlAttributeMapping.getOptional();
+ }
+
+ public boolean isDefaultOptional() {
+ return this.defaultOptional;
+ }
+
+ protected void setDefaultOptional(boolean optional) {
+ boolean old = this.defaultOptional;
+ this.defaultOptional = optional;
+ this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ protected boolean buildDefaultOptional() {
+ return DEFAULT_OPTIONAL;
+ }
+
+
+ // ********** converter **********
+
+ public OrmConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ // note: we may also clear the XML value we want;
+ // but if we leave it, the resulting sync will screw things up...
+ this.clearXmlConverterValues();
+ OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter.initialize();
+ }
+ }
+
+ protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(OrmConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ protected void clearXmlConverterValues() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ adapter.clearXmlValue(this.xmlAttributeMapping);
+ }
+ }
+
+ protected OrmConverter buildConverter() {
+ OrmXmlContextNodeFactory factory = this.getContextNodeFactory();
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ OrmConverter ormConverter = adapter.buildConverter(this, factory);
+ if (ormConverter != null) {
+ return ormConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
+ if (adapter == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ if (this.converter.getType() == adapter.getConverterType()) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first adapter whose converter value is set in the XML mapping.
+ * Return <code>null</code> if there are no converter values in the XML.
+ */
+ protected OrmConverter.Adapter getXmlConverterAdapter() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.isActive(this.xmlAttributeMapping)) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected OrmConverter buildNullConverter() {
+ return new NullOrmConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected OrmConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<OrmConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmBasicMapping(this);
+ }
+
+ @Override
+ protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
+ super.initializeFromOrmColumnMapping(oldMapping);
+ this.column.initializeFrom(oldMapping.getColumn());
+ }
+
+ public int getXmlSequence() {
+ return 20;
+ }
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+ public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
+ xmlAttributes.getBasics().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
+ xmlAttributes.getBasics().remove(this.xmlAttributeMapping);
+ }
+
+
+ // ********** OrmColumn.Owner implementation **********
+
+ public String getDefaultColumnName() {
+ return this.name;
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public XmlColumn getXmlColumn() {
+ return this.xmlAttributeMapping.getColumn();
+ }
+
+ public XmlColumn buildXmlColumn() {
+ XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
+ this.xmlAttributeMapping.setColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ public void removeXmlColumn() {
+ this.xmlAttributeMapping.setColumn(null);
+ }
+
+
+ //************ refactoring ************
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createConverterRenameTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenameTypeEdits(IType originalType, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenameTypeEdits(originalType, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createConverterMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return (this.converter != null) ?
+ this.converter.createMoveTypeEdits(originalType, newPackage) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createConverterRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenamePackageEdits(originalPackage, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.column.validate(messages, reporter);
+ this.converter.validate(messages, reporter);
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java
new file mode 100644
index 0000000000..e2883a2d88
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+
+/**
+ * <code>orm.xml</code> embeddable type mapping
+ */
+public abstract class AbstractOrmEmbeddable<X extends XmlEmbeddable>
+ extends AbstractOrmTypeMapping<X>
+ implements OrmEmbeddable
+{
+ protected AbstractOrmEmbeddable(OrmPersistentType parent, X resourceMapping) {
+ super(parent, resourceMapping);
+ }
+
+
+ // ********** key **********
+
+ public String getKey() {
+ return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+
+ // ********** id class **********
+
+ public JavaPersistentType getIdClass() {
+ return null;
+ }
+
+
+ // ********** tables **********
+
+ public Iterator<ReadOnlyTable> associatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ReadOnlyTable> allAssociatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> allAssociatedTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+
+ // ********** Java **********
+
+ @Override
+ public JavaEmbeddable getJavaTypeMapping() {
+ return (JavaEmbeddable) super.getJavaTypeMapping();
+ }
+
+ @Override
+ public JavaEmbeddable getJavaTypeMappingForDefaults() {
+ return (JavaEmbeddable) super.getJavaTypeMappingForDefaults();
+ }
+
+
+ // ********** entity mappings **********
+
+ public int getXmlSequence() {
+ return 2;
+ }
+
+ public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) {
+ entityMappings.getEmbeddables().add(this.xmlTypeMapping);
+ }
+
+ public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) {
+ entityMappings.getEmbeddables().remove(this.xmlTypeMapping);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public boolean validatesAgainstDatabase() {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
new file mode 100644
index 0000000000..61ea1f67a5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
@@ -0,0 +1,2285 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.HashBag;
+import org.eclipse.jpt.common.utility.internal.NotNullFilter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported;
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.InheritanceType;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.SecondaryTable;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.DiscriminatorColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTableValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.TableValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.Inheritance;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> entity
+ */
+public abstract class AbstractOrmEntity<X extends XmlEntity>
+ extends AbstractOrmTypeMapping<X>
+ implements OrmEntity, OrmCacheableHolder2_0, OrmIdClassReference.Owner
+{
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected Entity rootEntity;
+ protected final Vector<Entity> descendants = new Vector<Entity>();
+
+ protected final OrmIdClassReference idClassReference;
+
+ protected final OrmTable table;
+ protected boolean specifiedTableIsAllowed;
+ protected boolean tableIsUndefined;
+
+ protected final Vector<OrmSecondaryTable> specifiedSecondaryTables = new Vector<OrmSecondaryTable>();
+ protected final SpecifiedSecondaryTableContainerAdapter specifiedSecondaryTableContainerAdapter = new SpecifiedSecondaryTableContainerAdapter();
+
+ protected final Vector<OrmVirtualSecondaryTable> virtualSecondaryTables = new Vector<OrmVirtualSecondaryTable>();
+ protected final VirtualSecondaryTableContainerAdapter virtualSecondaryTableContainerAdapter = new VirtualSecondaryTableContainerAdapter();
+
+ protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner;
+ protected final Vector<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
+ protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+
+ // this is the default if there are Java columns
+ protected final Vector<OrmVirtualPrimaryKeyJoinColumn> virtualPrimaryKeyJoinColumns = new Vector<OrmVirtualPrimaryKeyJoinColumn>();
+ protected final VirtualPrimaryKeyJoinColumnContainerAdapter virtualPrimaryKeyJoinColumnContainerAdapter = new VirtualPrimaryKeyJoinColumnContainerAdapter();
+
+ // this is the default if there are *no* Java columns
+ protected ReadOnlyPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
+
+ protected InheritanceType specifiedInheritanceStrategy;
+ protected InheritanceType defaultInheritanceStrategy;
+
+ protected String specifiedDiscriminatorValue;
+ protected String defaultDiscriminatorValue;
+ protected boolean specifiedDiscriminatorValueIsAllowed;
+ protected boolean discriminatorValueIsUndefined;
+
+ protected final OrmDiscriminatorColumn discriminatorColumn;
+ protected boolean specifiedDiscriminatorColumnIsAllowed;
+ protected boolean discriminatorColumnIsUndefined;
+
+ protected final OrmAttributeOverrideContainer attributeOverrideContainer;
+ protected final OrmAssociationOverrideContainer associationOverrideContainer;
+
+ protected final OrmGeneratorContainer generatorContainer;
+ protected final OrmQueryContainer queryContainer;
+
+
+ // ********** construction **********
+
+ protected AbstractOrmEntity(OrmPersistentType parent, X xmlEntity) {
+ super(parent, xmlEntity);
+ this.specifiedName = xmlEntity.getName();
+ this.idClassReference = this.buildIdClassReference();
+ this.table = this.buildTable();
+ this.initializeSpecifiedSecondaryTables();
+ this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ this.initializeSpecifiedPrimaryKeyJoinColumns();
+ this.specifiedInheritanceStrategy = this.buildSpecifiedInheritanceStrategy();
+ this.specifiedDiscriminatorValue = xmlEntity.getDiscriminatorValue();
+ this.discriminatorColumn = this.buildDiscriminatorColumn();
+ // start with the entity as the root - it will be recalculated in update()
+ this.rootEntity = this;
+ this.attributeOverrideContainer = this.buildAttributeOverrideContainer();
+ this.associationOverrideContainer = this.buildAssociationOverrideContainer();
+ this.generatorContainer = this.buildGeneratorContainer();
+ this.queryContainer = this.buildQueryContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+
+ this.setSpecifiedName_(this.xmlTypeMapping.getName());
+
+ this.idClassReference.synchronizeWithResourceModel();
+
+ this.table.synchronizeWithResourceModel();
+
+ this.syncSpecifiedSecondaryTables();
+
+ this.syncSpecifiedPrimaryKeyJoinColumns();
+
+ this.setSpecifiedInheritanceStrategy_(this.buildSpecifiedInheritanceStrategy());
+ this.setSpecifiedDiscriminatorValue_(this.xmlTypeMapping.getDiscriminatorValue());
+ this.discriminatorColumn.synchronizeWithResourceModel();
+
+ this.attributeOverrideContainer.synchronizeWithResourceModel();
+ this.associationOverrideContainer.synchronizeWithResourceModel();
+
+ this.generatorContainer.synchronizeWithResourceModel();
+ this.queryContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setDefaultName(this.buildDefaultName());
+
+ // calculate root entity early - other things depend on it
+ this.setRootEntity(this.buildRootEntity());
+ this.updateDescendants();
+
+ this.idClassReference.update();
+
+ this.table.update();
+ this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed());
+ this.setTableIsUndefined(this.buildTableIsUndefined());
+
+ this.updateVirtualSecondaryTables();
+ this.updateNodes(this.getSecondaryTables());
+
+ this.updateDefaultPrimaryKeyJoinColumns();
+ this.updateNodes(this.getPrimaryKeyJoinColumns());
+
+ this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy());
+
+ this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue());
+ this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed());
+ this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined());
+
+ this.discriminatorColumn.update();
+ this.setSpecifiedDiscriminatorColumnIsAllowed(this.buildSpecifiedDiscriminatorColumnIsAllowed());
+ this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined());
+
+ this.attributeOverrideContainer.update();
+ this.associationOverrideContainer.update();
+
+ this.generatorContainer.update();
+ this.queryContainer.update();
+ }
+
+
+ // ********** name **********
+
+ @Override
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String name) {
+ this.setSpecifiedName_(name);
+ this.xmlTypeMapping.setName(name);
+ }
+
+ protected void setSpecifiedName_(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultName() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ if (javaEntity != null) {
+ return javaEntity.getName();
+ }
+ String className = this.getClass_();
+ return StringTools.stringIsEmpty(className) ? null : ClassName.getSimpleName(className);
+ }
+
+
+ // ********** root entity **********
+
+ public Entity getRootEntity() {
+ return this.rootEntity;
+ }
+
+ protected void setRootEntity(Entity entity) {
+ Entity old = this.rootEntity;
+ this.rootEntity = entity;
+ this.firePropertyChanged(ROOT_ENTITY_PROPERTY, old, entity);
+ }
+
+ protected Entity buildRootEntity() {
+ Entity result = this;
+ for (TypeMapping typeMapping : this.getAncestors()) {
+ if (typeMapping instanceof Entity) {
+ result = (Entity) typeMapping;
+ }
+ }
+ return result;
+ }
+
+
+ // ********** descendants **********
+
+ public Iterable<Entity> getDescendants() {
+ return new LiveCloneListIterable<Entity>(this.descendants);
+ }
+
+ protected void updateDescendants() {
+ this.synchronizeCollection(this.buildDescendants(), this.descendants, DESCENDANTS_COLLECTION);
+ }
+
+ protected Iterable<Entity> buildDescendants() {
+ return new FilteringIterable<Entity>(this.getPersistenceUnit().getEntities()) {
+ @Override
+ protected boolean accept(Entity entity) {
+ return AbstractOrmEntity.this.entityIsDescendant(entity);
+ }
+ };
+ }
+
+ /**
+ * Return whether specified entity is a descendant of the entity.
+ */
+ protected boolean entityIsDescendant(Entity entity) {
+ String typeName = this.getPersistentType().getName();
+ String entityTypeName = entity.getPersistentType().getName();
+ String rootEntityTypeName = entity.getRootEntity().getPersistentType().getName();
+ return Tools.valuesAreDifferent(typeName, entityTypeName) &&
+ Tools.valuesAreEqual(typeName, rootEntityTypeName);
+ }
+
+
+ // ********** id class **********
+
+ public OrmIdClassReference getIdClassReference() {
+ return this.idClassReference;
+ }
+
+ protected OrmIdClassReference buildIdClassReference() {
+ return new GenericOrmIdClassReference(this, this);
+ }
+
+ public XmlIdClassContainer getXmlIdClassContainer() {
+ return this.getXmlTypeMapping();
+ }
+
+ public JavaIdClassReference getJavaIdClassReferenceForDefaults() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ return (javaEntity == null) ? null : javaEntity.getIdClassReference();
+ }
+
+ public JavaPersistentType getIdClass() {
+ return this.idClassReference.getIdClass();
+ }
+
+
+ // ********** table **********
+
+ public OrmTable getTable() {
+ return this.table;
+ }
+
+ protected OrmTable buildTable() {
+ return this.getContextNodeFactory().buildOrmTable(this, this.buildTableOwner());
+ }
+
+ protected Table.Owner buildTableOwner() {
+ return new TableOwner();
+ }
+
+ public boolean specifiedTableIsAllowed() {
+ return this.specifiedTableIsAllowed;
+ }
+
+ protected void setSpecifiedTableIsAllowed(boolean specifiedTableIsAllowed) {
+ boolean old = this.specifiedTableIsAllowed;
+ this.specifiedTableIsAllowed = specifiedTableIsAllowed;
+ this.firePropertyChanged(SPECIFIED_TABLE_IS_ALLOWED_PROPERTY, old, specifiedTableIsAllowed);
+ }
+
+ protected boolean buildSpecifiedTableIsAllowed() {
+ return ! this.isAbstractTablePerClass() && ! this.isSingleTableDescendant();
+ }
+
+ public boolean tableIsUndefined() {
+ return this.tableIsUndefined;
+ }
+
+ protected void setTableIsUndefined(boolean tableIsUndefined) {
+ boolean old = this.tableIsUndefined;
+ this.tableIsUndefined = tableIsUndefined;
+ this.firePropertyChanged(TABLE_IS_UNDEFINED_PROPERTY, old, tableIsUndefined);
+ }
+
+ protected boolean buildTableIsUndefined() {
+ return this.isAbstractTablePerClass();
+ }
+
+ public String getDefaultTableName() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ if (javaEntity != null) {
+ String javaName = javaEntity.getTable().getSpecifiedName();
+ if ((javaName != null) && ! this.table.isSpecifiedInResource()) {
+ return javaName;
+ }
+ }
+ return this.isSingleTableDescendant() ?
+ this.rootEntity.getTable().getName() :
+ this.isAbstractTablePerClass() ?
+ null :
+ this.getName();
+ }
+
+ public String getDefaultSchema() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ if (javaEntity != null) {
+ String javaSchema = javaEntity.getTable().getSpecifiedSchema();
+ if ((javaSchema != null) && ! this.table.isSpecifiedInResource()) {
+ return javaSchema;
+ }
+ }
+ return this.isSingleTableDescendant() ?
+ this.rootEntity.getTable().getSchema() :
+ this.isAbstractTablePerClass() ?
+ null :
+ this.getContextDefaultSchema();
+ }
+
+ public String getDefaultCatalog() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ if (javaEntity != null) {
+ String javaCatalog = javaEntity.getTable().getSpecifiedCatalog();
+ if ((javaCatalog != null) && ! this.table.isSpecifiedInResource()) {
+ return javaCatalog;
+ }
+ }
+ return this.isSingleTableDescendant() ?
+ this.rootEntity.getTable().getCatalog() :
+ this.isAbstractTablePerClass() ?
+ null :
+ this.getContextDefaultCatalog();
+ }
+
+ protected static class TableOwner
+ implements Table.Owner
+ {
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return new TableValidator(table, textRangeResolver);
+ }
+ }
+
+
+ // ********** secondary tables **********
+
+ public ListIterator<ReadOnlySecondaryTable> secondaryTables() {
+ return this.getSecondaryTables().iterator();
+ }
+
+ protected ListIterable<ReadOnlySecondaryTable> getSecondaryTables() {
+ return this.specifiedSecondaryTables.isEmpty() ?
+ this.getReadOnlyVirtualSecondaryTables() :
+ this.getReadOnlySpecifiedSecondaryTables();
+ }
+
+ public int secondaryTablesSize() {
+ return this.specifiedSecondaryTables.isEmpty() ?
+ this.virtualSecondaryTables.size() :
+ this.specifiedSecondaryTables.size();
+ }
+
+
+ // ********** specified secondary tables **********
+
+ public ListIterator<OrmSecondaryTable> specifiedSecondaryTables() {
+ return this.getSpecifiedSecondaryTables().iterator();
+ }
+
+ protected ListIterable<OrmSecondaryTable> getSpecifiedSecondaryTables() {
+ return new LiveCloneListIterable<OrmSecondaryTable>(this.specifiedSecondaryTables);
+ }
+
+ protected ListIterable<ReadOnlySecondaryTable> getReadOnlySpecifiedSecondaryTables() {
+ return new LiveCloneListIterable<ReadOnlySecondaryTable>(this.specifiedSecondaryTables);
+ }
+
+ public int specifiedSecondaryTablesSize() {
+ return this.specifiedSecondaryTables.size();
+ }
+
+ public OrmSecondaryTable addSpecifiedSecondaryTable() {
+ return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size());
+ }
+
+ /**
+ * no state check
+ */
+ protected OrmSecondaryTable addSpecifiedSecondaryTable_() {
+ return this.addSpecifiedSecondaryTable_(this.specifiedSecondaryTables.size());
+ }
+
+ /**
+ * @see #setSecondaryTablesAreDefinedInXml(boolean)
+ */
+ public OrmSecondaryTable addSpecifiedSecondaryTable(int index) {
+ if ( ! this.secondaryTablesAreDefinedInXml()) {
+ throw new IllegalStateException("virtual secondary tables exist - call OrmEntity.setSecondaryTablesAreDefinedInXml(true) first"); //$NON-NLS-1$
+ }
+ return this.addSpecifiedSecondaryTable_(index);
+ }
+
+ /**
+ * no state check
+ */
+ protected OrmSecondaryTable addSpecifiedSecondaryTable_(int index) {
+ XmlSecondaryTable xmlSecondaryTable = this.buildXmlSecondaryTable();
+ OrmSecondaryTable secondaryTable = this.addSpecifiedSecondaryTable_(index, xmlSecondaryTable);
+ this.xmlTypeMapping.getSecondaryTables().add(index, xmlSecondaryTable);
+ return secondaryTable;
+ }
+
+ protected XmlSecondaryTable buildXmlSecondaryTable() {
+ return OrmFactory.eINSTANCE.createXmlSecondaryTable();
+ }
+
+ public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) {
+ this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ }
+
+ public void removeSpecifiedSecondaryTable(int index) {
+ this.removeSpecifiedSecondaryTable_(index);
+ this.xmlTypeMapping.getSecondaryTables().remove(index);
+ }
+
+ protected void removeSpecifiedSecondaryTable_(int index) {
+ this.removeItemFromList(index, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ this.xmlTypeMapping.getSecondaryTables().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeSpecifiedSecondaryTables() {
+ for (XmlSecondaryTable xmlTable : this.getXmlSecondaryTables()) {
+ this.specifiedSecondaryTables.add(this.buildSecondaryTable(xmlTable));
+ }
+ }
+
+ protected OrmSecondaryTable buildSecondaryTable(XmlSecondaryTable xmlSecondaryTable) {
+ return this.getContextNodeFactory().buildOrmSecondaryTable(this, this.buildSecondaryTableOwner(), xmlSecondaryTable);
+ }
+
+ protected Table.Owner buildSecondaryTableOwner() {
+ return new SecondaryTableOwner();
+ }
+
+ protected void clearSpecifiedSecondaryTables() {
+ this.clearList(this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ this.xmlTypeMapping.getSecondaryTables().clear();
+ }
+
+ protected void syncSpecifiedSecondaryTables() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedSecondaryTableContainerAdapter);
+ }
+
+ protected Iterable<XmlSecondaryTable> getXmlSecondaryTables() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlSecondaryTable>(this.xmlTypeMapping.getSecondaryTables());
+ }
+
+ protected void moveSpecifiedSecondaryTable_(int index, OrmSecondaryTable secondaryTable) {
+ this.moveItemInList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ protected OrmSecondaryTable addSpecifiedSecondaryTable_(int index, XmlSecondaryTable xmlSecondaryTable) {
+ OrmSecondaryTable secondaryTable = this.buildSecondaryTable(xmlSecondaryTable);
+ this.addItemToList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ return secondaryTable;
+ }
+
+ protected void removeSpecifiedSecondaryTable_(OrmSecondaryTable secondaryTable) {
+ this.removeSpecifiedSecondaryTable_(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ }
+
+ /**
+ * specified secondary table container adapter
+ */
+ protected class SpecifiedSecondaryTableContainerAdapter
+ implements ContextContainerTools.Adapter<OrmSecondaryTable, XmlSecondaryTable>
+ {
+ public Iterable<OrmSecondaryTable> getContextElements() {
+ return AbstractOrmEntity.this.getSpecifiedSecondaryTables();
+ }
+ public Iterable<XmlSecondaryTable> getResourceElements() {
+ return AbstractOrmEntity.this.getXmlSecondaryTables();
+ }
+ public XmlSecondaryTable getResourceElement(OrmSecondaryTable contextElement) {
+ return contextElement.getXmlTable();
+ }
+ public void moveContextElement(int index, OrmSecondaryTable element) {
+ AbstractOrmEntity.this.moveSpecifiedSecondaryTable_(index, element);
+ }
+ public void addContextElement(int index, XmlSecondaryTable resourceElement) {
+ AbstractOrmEntity.this.addSpecifiedSecondaryTable_(index, resourceElement);
+ }
+ public void removeContextElement(OrmSecondaryTable element) {
+ AbstractOrmEntity.this.removeSpecifiedSecondaryTable_(element);
+ }
+ }
+
+ protected static class SecondaryTableOwner
+ implements Table.Owner
+ {
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return new SecondaryTableValidator((SecondaryTable) table, textRangeResolver);
+ }
+ }
+
+
+ // ********** virtual secondary tables **********
+
+ public ListIterator<OrmVirtualSecondaryTable> virtualSecondaryTables() {
+ return this.getVirtualSecondaryTables().iterator();
+ }
+
+ protected ListIterable<OrmVirtualSecondaryTable> getVirtualSecondaryTables() {
+ return new LiveCloneListIterable<OrmVirtualSecondaryTable>(this.virtualSecondaryTables);
+ }
+
+ protected ListIterable<ReadOnlySecondaryTable> getReadOnlyVirtualSecondaryTables() {
+ return new LiveCloneListIterable<ReadOnlySecondaryTable>(this.virtualSecondaryTables);
+ }
+
+ public int virtualSecondaryTablesSize() {
+ return this.virtualSecondaryTables.size();
+ }
+
+ protected void clearVirtualSecondaryTables() {
+ this.clearList(this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
+ }
+
+ /**
+ * If there are any specified secondary tables, then there are no virtual
+ * secondary tables.
+ * If there are Java specified secondary tables, then those are the virtual
+ * secondary tables.
+ * @see #getJavaSecondaryTablesForVirtuals()
+ */
+ protected void updateVirtualSecondaryTables() {
+ ContextContainerTools.update(this.virtualSecondaryTableContainerAdapter);
+ }
+
+ protected Iterable<JavaSecondaryTable> getJavaSecondaryTablesForVirtuals() {
+ if (this.specifiedSecondaryTables.size() > 0) {
+ return EmptyIterable.instance();
+ }
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ return (javaEntity == null) ?
+ EmptyIterable.<JavaSecondaryTable>instance() :
+ CollectionTools.iterable(javaEntity.secondaryTables());
+ }
+
+ protected void moveVirtualSecondaryTable(int index, OrmVirtualSecondaryTable secondaryTable) {
+ this.moveItemInList(index, secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
+ }
+
+ protected OrmVirtualSecondaryTable addVirtualSecondaryTable(int index, JavaSecondaryTable javaSecondaryTable) {
+ OrmVirtualSecondaryTable secondaryTable = this.buildVirtualSecondaryTable(javaSecondaryTable);
+ this.addItemToList(index, secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
+ return secondaryTable;
+ }
+
+ protected OrmVirtualSecondaryTable buildVirtualSecondaryTable(JavaSecondaryTable javaSecondaryTable) {
+ return this.getContextNodeFactory().buildOrmVirtualSecondaryTable(this, javaSecondaryTable);
+ }
+
+ protected void removeVirtualSecondaryTable(OrmVirtualSecondaryTable secondaryTable) {
+ this.removeItemFromList(secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
+ }
+
+ /**
+ * virtual secondary table container adapter
+ */
+ protected class VirtualSecondaryTableContainerAdapter
+ implements ContextContainerTools.Adapter<OrmVirtualSecondaryTable, JavaSecondaryTable>
+ {
+ public Iterable<OrmVirtualSecondaryTable> getContextElements() {
+ return AbstractOrmEntity.this.getVirtualSecondaryTables();
+ }
+ public Iterable<JavaSecondaryTable> getResourceElements() {
+ return AbstractOrmEntity.this.getJavaSecondaryTablesForVirtuals();
+ }
+ public JavaSecondaryTable getResourceElement(OrmVirtualSecondaryTable contextElement) {
+ return contextElement.getOverriddenTable();
+ }
+ public void moveContextElement(int index, OrmVirtualSecondaryTable element) {
+ AbstractOrmEntity.this.moveVirtualSecondaryTable(index, element);
+ }
+ public void addContextElement(int index, JavaSecondaryTable resourceElement) {
+ AbstractOrmEntity.this.addVirtualSecondaryTable(index, resourceElement);
+ }
+ public void removeContextElement(OrmVirtualSecondaryTable element) {
+ AbstractOrmEntity.this.removeVirtualSecondaryTable(element);
+ }
+ }
+
+
+ // ********** secondary table transitions **********
+
+ /**
+ * If the list of virtual secondary tables is empty, then either the
+ * secondary tables are defined in XML or there are no secondary tables at
+ * all (implying they are defined in XML).
+ */
+ public boolean secondaryTablesAreDefinedInXml() {
+ return this.virtualSecondaryTables.isEmpty();
+ }
+
+ public void setSecondaryTablesAreDefinedInXml(boolean defineInXml) {
+ if (defineInXml != this.secondaryTablesAreDefinedInXml()) {
+ this.setSecondaryTablesAreDefinedInXml_(defineInXml);
+ }
+ }
+
+ protected void setSecondaryTablesAreDefinedInXml_(boolean defineInXml) {
+ if (defineInXml) {
+ this.specifySecondaryTablesInXml();
+ } else {
+ this.removeSecondaryTablesFromXml();
+ }
+ }
+
+ /**
+ * This is used to take all the Java secondary tables and specify them in
+ * the XML. You must use {@link #setSecondaryTablesAreDefinedInXml(boolean)}
+ * before calling {@link #addSpecifiedSecondaryTable()}.
+ */
+ protected void specifySecondaryTablesInXml() {
+ Iterable<OrmVirtualSecondaryTable> oldVirtualSecondaryTables = new SnapshotCloneIterable<OrmVirtualSecondaryTable>(this.virtualSecondaryTables);
+ for (OrmVirtualSecondaryTable oldVirtualSecondaryTable : oldVirtualSecondaryTables) {
+ this.addSpecifiedSecondaryTable_().initializeFrom(oldVirtualSecondaryTable);
+ }
+ // the virtual secondary tables will be cleared during the update
+ }
+
+ protected void removeSecondaryTablesFromXml() {
+ this.clearSpecifiedSecondaryTables();
+ // the virtual secondary tables will be built during the update
+ }
+
+
+ // ********** primary key join columns **********
+
+ public ListIterator<ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.getPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.isEmpty() ?
+ this.getDefaultPrimaryKeyJoinColumns() :
+ this.getReadOnlySpecifiedPrimaryKeyJoinColumns();
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.isEmpty() ?
+ this.defaultPrimaryKeyJoinColumnsSize() :
+ this.specifiedPrimaryKeyJoinColumnsSize();
+ }
+
+ protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlPkJoinColumn) {
+ return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlPkJoinColumn);
+ }
+
+
+ // ********** specified primary key join columns **********
+
+ public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getReadOnlySpecifiedPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<ReadOnlyPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ }
+
+ public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ this.clearDefaultPrimaryKeyJoinColumns(); // could leave for update?
+
+ XmlPrimaryKeyJoinColumn xmlPkJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
+ OrmPrimaryKeyJoinColumn pkJoinColumn = this.addSpecifiedPrimaryKeyJoinColumn_(index, xmlPkJoinColumn);
+ this.xmlTypeMapping.getPrimaryKeyJoinColumns().add(index, xmlPkJoinColumn);
+ return pkJoinColumn;
+ }
+
+ protected XmlPrimaryKeyJoinColumn buildXmlPrimaryKeyJoinColumn() {
+ return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn();
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ this.removeSpecifiedPrimaryKeyJoinColumn_(index);
+ this.xmlTypeMapping.getPrimaryKeyJoinColumns().remove(index);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.xmlTypeMapping.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
+ }
+
+ protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected void initializeSpecifiedPrimaryKeyJoinColumns() {
+ for (XmlPrimaryKeyJoinColumn xmlPkJoinColumn : this.getXmlPrimaryKeyJoinColumns()) {
+ this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlPkJoinColumn));
+ }
+ }
+
+ protected void syncSpecifiedPrimaryKeyJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlPrimaryKeyJoinColumn>(this.xmlTypeMapping.getPrimaryKeyJoinColumns());
+ }
+
+ protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn pkJoinColumn) {
+ this.moveItemInList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlPkJoinColumn) {
+ OrmPrimaryKeyJoinColumn pkJoinColumn = this.buildPrimaryKeyJoinColumn(xmlPkJoinColumn);
+ this.addItemToList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ return pkJoinColumn;
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn pkJoinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(pkJoinColumn));
+ }
+
+ /**
+ * specified primary key join column container adapter
+ */
+ protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
+ {
+ public Iterable<OrmPrimaryKeyJoinColumn> getContextElements() {
+ return AbstractOrmEntity.this.getSpecifiedPrimaryKeyJoinColumns();
+ }
+ public Iterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
+ return AbstractOrmEntity.this.getXmlPrimaryKeyJoinColumns();
+ }
+ public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getXmlColumn();
+ }
+ public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) {
+ AbstractOrmEntity.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) {
+ AbstractOrmEntity.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(OrmPrimaryKeyJoinColumn element) {
+ AbstractOrmEntity.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
+ }
+ }
+
+
+ // ********** default primary key join columns **********
+
+ public ListIterator<ReadOnlyPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
+ return this.getDefaultPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
+ int virtualSize = this.virtualPrimaryKeyJoinColumns.size();
+ return (virtualSize != 0) ?
+ this.getReadOnlyVirtualPrimaryKeyJoinColumns() :
+ this.getReadOnlyDefaultPrimaryKeyJoinColumns();
+ }
+
+ public int defaultPrimaryKeyJoinColumnsSize() {
+ int virtualSize = this.virtualPrimaryKeyJoinColumns.size();
+ return (virtualSize != 0) ?
+ virtualSize :
+ (this.defaultPrimaryKeyJoinColumn != null) ? 1 : 0;
+ }
+
+ /**
+ * This is (blindly) called whenever a specified pk join column is added.
+ */
+ protected void clearDefaultPrimaryKeyJoinColumns() {
+ int virtualSize = this.virtualPrimaryKeyJoinColumns.size();
+ if (virtualSize != 0) {
+ this.clearVirtualPrimaryKeyJoinColumns();
+ } else {
+ if (this.defaultPrimaryKeyJoinColumn != null) {
+ this.removeDefaultPrimaryKeyJoinColumn();
+ } else {
+ // nothing to clear
+ }
+ }
+ }
+
+ /**
+ * If there are any specified pk join columns, then there are no default
+ * pk join columns.
+ * If there are Java specified pk join columns, then those are the default
+ * pk join columns.
+ * Otherwise, there is a single, spec-defined, default pk join column.
+ */
+ protected void updateDefaultPrimaryKeyJoinColumns() {
+ if (this.specifiedPrimaryKeyJoinColumns.size() > 0) {
+ // specified/java/default => specified
+ this.clearDefaultPrimaryKeyJoinColumns();
+ } else {
+ // specified
+ if (this.defaultPrimaryKeyJoinColumnsSize() == 0) {
+ if (this.javaPrimaryKeyJoinColumnsWillBeDefaults()) {
+ // specified => java
+ this.initializeVirtualPrimaryKeyJoinColumns();
+ } else {
+ // specified => default
+ this.addDefaultPrimaryKeyJoinColumn();
+ }
+ } else {
+ // default
+ if (this.defaultPrimaryKeyJoinColumn != null) {
+ if (this.javaPrimaryKeyJoinColumnsWillBeDefaults()) {
+ // default => java
+ this.removeDefaultPrimaryKeyJoinColumn();
+ this.initializeVirtualPrimaryKeyJoinColumns();
+ } else {
+ // default => default (no change)
+ }
+ // java
+ } else {
+ if (this.javaPrimaryKeyJoinColumnsWillBeDefaults()) {
+ // java => java ("normal" update)
+ this.updateVirtualPrimaryKeyJoinColumns();
+ } else {
+ // java => default
+ this.clearVirtualPrimaryKeyJoinColumns();
+ this.addDefaultPrimaryKeyJoinColumn();
+ }
+ }
+ }
+ }
+ }
+
+ protected void updateVirtualPrimaryKeyJoinColumns() {
+ ContextContainerTools.update(this.virtualPrimaryKeyJoinColumnContainerAdapter);
+ }
+
+ /**
+ * Return whether we have Java pk join columns that will be used to populate
+ * our virtual pk join column collection.
+ */
+ protected boolean javaPrimaryKeyJoinColumnsWillBeDefaults() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ return (javaEntity != null) && (javaEntity.primaryKeyJoinColumnsSize() > 0);
+ }
+
+
+ // ********** virtual primary key join columns **********
+
+ protected ListIterable<OrmVirtualPrimaryKeyJoinColumn> getVirtualPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<OrmVirtualPrimaryKeyJoinColumn>(this.virtualPrimaryKeyJoinColumns);
+ }
+
+ protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getReadOnlyVirtualPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<ReadOnlyPrimaryKeyJoinColumn>(this.virtualPrimaryKeyJoinColumns);
+ }
+
+ protected void initializeVirtualPrimaryKeyJoinColumns() {
+ for (JavaPrimaryKeyJoinColumn javaPkJoinColumn : this.getJavaPrimaryKeyJoinColumnsForVirtuals()) {
+ this.addVirtualPrimaryKeyJoinColumn(this.buildVirtualPrimaryKeyJoinColumn(javaPkJoinColumn));
+ }
+ }
+
+ protected void addVirtualPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
+ this.addVirtualPrimaryKeyJoinColumn(this.virtualPrimaryKeyJoinColumns.size(), pkJoinColumn);
+ }
+
+ protected void addVirtualPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
+ this.addItemToList(index, pkJoinColumn, this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected void clearVirtualPrimaryKeyJoinColumns() {
+ this.clearList(this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ /**
+ * This will only be called when there are Java pk join columns to return.
+ * @see #javaPrimaryKeyJoinColumnsWillBeDefaults()
+ */
+ protected Iterable<JavaPrimaryKeyJoinColumn> getJavaPrimaryKeyJoinColumnsForVirtuals() {
+ return CollectionTools.iterable(this.getJavaTypeMappingForDefaults().primaryKeyJoinColumns());
+ }
+
+ protected void moveVirtualPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
+ this.moveItemInList(index, pkJoinColumn, this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmVirtualPrimaryKeyJoinColumn addVirtualPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) {
+ OrmVirtualPrimaryKeyJoinColumn pkJoinColumn = this.buildVirtualPrimaryKeyJoinColumn(javaPrimaryKeyJoinColumn);
+ this.addVirtualPrimaryKeyJoinColumn(index, pkJoinColumn);
+ return pkJoinColumn;
+ }
+
+ protected OrmVirtualPrimaryKeyJoinColumn buildVirtualPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) {
+ return this.getContextNodeFactory().buildOrmVirtualPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, javaPrimaryKeyJoinColumn);
+ }
+
+ protected void removeVirtualPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
+ this.removeItemFromList(pkJoinColumn, this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ /**
+ * virtual primary key join column container adapter
+ */
+ protected class VirtualPrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn>
+ {
+ public Iterable<OrmVirtualPrimaryKeyJoinColumn> getContextElements() {
+ return AbstractOrmEntity.this.getVirtualPrimaryKeyJoinColumns();
+ }
+ public Iterable<JavaPrimaryKeyJoinColumn> getResourceElements() {
+ return AbstractOrmEntity.this.getJavaPrimaryKeyJoinColumnsForVirtuals();
+ }
+ public JavaPrimaryKeyJoinColumn getResourceElement(OrmVirtualPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, OrmVirtualPrimaryKeyJoinColumn element) {
+ AbstractOrmEntity.this.moveVirtualPrimaryKeyJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JavaPrimaryKeyJoinColumn resourceElement) {
+ AbstractOrmEntity.this.addVirtualPrimaryKeyJoinColumn(index, resourceElement);
+ }
+ public void removeContextElement(OrmVirtualPrimaryKeyJoinColumn element) {
+ AbstractOrmEntity.this.removeVirtualPrimaryKeyJoinColumn(element);
+ }
+ }
+
+
+ // ********** default primary key join column **********
+
+ protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getReadOnlyDefaultPrimaryKeyJoinColumns() {
+ return (this.defaultPrimaryKeyJoinColumn != null) ?
+ new SingleElementListIterable<ReadOnlyPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
+ EmptyListIterable.<ReadOnlyPrimaryKeyJoinColumn>instance();
+ }
+
+ protected void addDefaultPrimaryKeyJoinColumn() {
+ this.defaultPrimaryKeyJoinColumn = this.buildPrimaryKeyJoinColumn(null);
+ this.fireItemAdded(DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST, 0, this.defaultPrimaryKeyJoinColumn);
+ }
+
+ protected void removeDefaultPrimaryKeyJoinColumn() {
+ ReadOnlyPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn;
+ this.defaultPrimaryKeyJoinColumn = null;
+ this.fireItemRemoved(DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST, 0, old);
+ }
+
+ protected ReadOnlyPrimaryKeyJoinColumn buildDefaultPrimaryKeyJoinColumn() {
+ return this.buildPrimaryKeyJoinColumn(null);
+ }
+
+
+ // ********** inheritance strategy **********
+
+ public InheritanceType getInheritanceStrategy() {
+ return (this.specifiedInheritanceStrategy != null) ? this.specifiedInheritanceStrategy : this.defaultInheritanceStrategy;
+ }
+
+ public InheritanceType getSpecifiedInheritanceStrategy() {
+ return this.specifiedInheritanceStrategy;
+ }
+
+ public void setSpecifiedInheritanceStrategy(InheritanceType inheritanceType) {
+ if (this.valuesAreDifferent(this.specifiedInheritanceStrategy, inheritanceType)) {
+ Inheritance xmlInheritance = this.getXmlInheritanceForUpdate();
+ this.setSpecifiedInheritanceStrategy_(inheritanceType);
+ xmlInheritance.setStrategy(InheritanceType.toOrmResourceModel(inheritanceType));
+ this.removeXmlInheritanceIfUnset();
+ }
+ }
+
+ protected void setSpecifiedInheritanceStrategy_(InheritanceType inheritanceType) {
+ InheritanceType old = this.specifiedInheritanceStrategy;
+ this.specifiedInheritanceStrategy = inheritanceType;
+ this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ }
+
+ protected InheritanceType buildSpecifiedInheritanceStrategy() {
+ Inheritance xmlInheritance = this.xmlTypeMapping.getInheritance();
+ return (xmlInheritance == null) ? null : InheritanceType.fromOrmResourceModel(xmlInheritance.getStrategy());
+ }
+
+ protected Inheritance getXmlInheritanceForUpdate() {
+ Inheritance xmlInheritance = this.xmlTypeMapping.getInheritance();
+ return (xmlInheritance != null) ? xmlInheritance : this.buildXmlInheritance();
+ }
+
+ protected Inheritance buildXmlInheritance() {
+ Inheritance xmlInheritance = OrmFactory.eINSTANCE.createInheritance();
+ this.xmlTypeMapping.setInheritance(xmlInheritance);
+ return xmlInheritance;
+ }
+
+ protected void removeXmlInheritanceIfUnset() {
+ if (this.xmlTypeMapping.getInheritance().isUnset()) {
+ this.xmlTypeMapping.setInheritance(null);
+ }
+ }
+
+ public InheritanceType getDefaultInheritanceStrategy() {
+ return this.defaultInheritanceStrategy;
+ }
+
+ protected void setDefaultInheritanceStrategy(InheritanceType inheritanceType) {
+ InheritanceType old = this.defaultInheritanceStrategy;
+ this.defaultInheritanceStrategy = inheritanceType;
+ this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ }
+
+ protected InheritanceType buildDefaultInheritanceStrategy() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ if ((javaEntity != null) && (this.xmlTypeMapping.getInheritance() == null)) {
+ return javaEntity.getInheritanceStrategy();
+ }
+ return this.isRoot() ?
+ InheritanceType.SINGLE_TABLE :
+ this.rootEntity.getInheritanceStrategy();
+ }
+
+
+ // ********** discriminator value **********
+
+ public String getDiscriminatorValue() {
+ return (this.specifiedDiscriminatorValue != null) ? this.specifiedDiscriminatorValue : this.defaultDiscriminatorValue;
+ }
+
+ public String getSpecifiedDiscriminatorValue() {
+ return this.specifiedDiscriminatorValue;
+ }
+
+ public void setSpecifiedDiscriminatorValue(String discriminatorValue) {
+ this.setSpecifiedDiscriminatorValue_(discriminatorValue);
+ this.xmlTypeMapping.setDiscriminatorValue(discriminatorValue);
+ }
+
+ protected void setSpecifiedDiscriminatorValue_(String discriminatorValue) {
+ String old = this.specifiedDiscriminatorValue;
+ this.specifiedDiscriminatorValue = discriminatorValue;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ }
+
+ public String getDefaultDiscriminatorValue() {
+ return this.defaultDiscriminatorValue;
+ }
+
+ protected void setDefaultDiscriminatorValue(String discriminatorValue) {
+ String old = this.defaultDiscriminatorValue;
+ this.defaultDiscriminatorValue = discriminatorValue;
+ this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ }
+
+ /**
+ * 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 buildDefaultDiscriminatorValue() {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ if (javaEntity != null) {
+ return javaEntity.getDiscriminatorValue();
+ }
+ if (this.discriminatorValueIsUndefined) {
+ return null;
+ }
+ return (this.getDiscriminatorType() == DiscriminatorType.STRING) ? this.getName() : null;
+ }
+
+ protected DiscriminatorType getDiscriminatorType() {
+ return this.discriminatorColumn.getDiscriminatorType();
+ }
+
+ public boolean specifiedDiscriminatorValueIsAllowed() {
+ return this.specifiedDiscriminatorValueIsAllowed;
+ }
+
+ protected void setSpecifiedDiscriminatorValueIsAllowed(boolean allowed) {
+ boolean old = this.specifiedDiscriminatorValueIsAllowed;
+ this.specifiedDiscriminatorValueIsAllowed = allowed;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY, old, allowed);
+ }
+
+ protected boolean buildSpecifiedDiscriminatorValueIsAllowed() {
+ return ! this.isTablePerClass() && ! this.isAbstract();
+ }
+
+ public boolean discriminatorValueIsUndefined() {
+ return this.discriminatorValueIsUndefined;
+ }
+
+ protected void setDiscriminatorValueIsUndefined(boolean undefined) {
+ boolean old = this.discriminatorValueIsUndefined;
+ this.discriminatorValueIsUndefined = undefined;
+ this.firePropertyChanged(DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY, old, undefined);
+ }
+
+ protected boolean buildDiscriminatorValueIsUndefined() {
+ return this.isTablePerClass() ||
+ this.isAbstract() ||
+ this.isRootNoDescendantsNoStrategyDefined();
+ }
+
+
+ // ********** discriminator column **********
+
+ public OrmDiscriminatorColumn getDiscriminatorColumn() {
+ return this.discriminatorColumn;
+ }
+
+ protected OrmDiscriminatorColumn buildDiscriminatorColumn() {
+ return this.getContextNodeFactory().buildOrmDiscriminatorColumn(this, this.buildDiscriminatorColumnOwner());
+ }
+
+ protected OrmDiscriminatorColumn.Owner buildDiscriminatorColumnOwner() {
+ return new DiscriminatorColumnOwner();
+ }
+
+ public boolean specifiedDiscriminatorColumnIsAllowed() {
+ return this.specifiedDiscriminatorColumnIsAllowed;
+ }
+
+ protected void setSpecifiedDiscriminatorColumnIsAllowed(boolean allowed) {
+ boolean old = this.specifiedDiscriminatorColumnIsAllowed;
+ this.specifiedDiscriminatorColumnIsAllowed = allowed;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY, old, allowed);
+ }
+
+ protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() {
+ return ! this.isTablePerClass() && this.isRoot();
+ }
+
+ public boolean discriminatorColumnIsUndefined() {
+ return this.discriminatorColumnIsUndefined;
+ }
+
+ protected void setDiscriminatorColumnIsUndefined(boolean undefined) {
+ boolean old = this.discriminatorColumnIsUndefined;
+ this.discriminatorColumnIsUndefined = undefined;
+ this.firePropertyChanged(DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY, old, undefined);
+ }
+
+ protected boolean buildDiscriminatorColumnIsUndefined() {
+ return this.isTablePerClass() ||
+ this.isRootNoDescendantsNoStrategyDefined();
+ }
+
+
+ // ********** attribute override container **********
+
+ public OrmAttributeOverrideContainer getAttributeOverrideContainer() {
+ return this.attributeOverrideContainer;
+ }
+
+ protected OrmAttributeOverrideContainer buildAttributeOverrideContainer() {
+ return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, new AttributeOverrideContainerOwner());
+ }
+
+ protected TypeMapping getOverridableTypeMapping() {
+ PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType();
+ return (superPersistentType == null) ? null : superPersistentType.getMapping();
+ }
+
+ protected Column resolveOverriddenColumnForAttributeOverride(String attributeName) {
+ if ( ! this.isMetadataComplete()) {
+ JavaPersistentType javaType = this.getJavaPersistentType();
+ if (javaType != null) {
+ Column column = javaType.getMapping().resolveOverriddenColumn(attributeName);
+ if (column != null) {
+ return column;
+ }
+ }
+ }
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ protected JavaReadOnlyAttributeOverride getJavaAttributeOverrideNamedForVirtual(String attributeName) {
+ JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
+ return (javaEntity == null) ? null : javaEntity.getAttributeOverrideContainer().getOverrideNamed(attributeName);
+ }
+
+
+ // ********** association override container **********
+
+ public OrmAssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.associationOverrideContainer;
+ }
+
+ protected OrmAssociationOverrideContainer buildAssociationOverrideContainer() {
+ return this.getContextNodeFactory().buildOrmAssociationOverrideContainer(this, new AssociationOverrideContainerOwner());
+ }
+
+ @Override
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ if (this.isJpa2_0Compatible()) {
+ // strip off the first segment
+ int dotIndex = attributeName.indexOf('.');
+ if (dotIndex != -1) {
+ AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName.substring(dotIndex + 1));
+ if (override != null) {
+ return override.getRelationship();
+ }
+ }
+ }
+ return super.resolveOverriddenRelationship(attributeName);
+ }
+
+ protected Relationship resolveOverriddenRelationshipForAssociationOverride(String attributeName) {
+ if ( ! this.isMetadataComplete()) {
+ JavaPersistentType javaType = this.getJavaPersistentType();
+ if (javaType != null) {
+ Relationship relationship = javaType.getMapping().resolveOverriddenRelationship(attributeName);
+ if (relationship != null) {
+ return relationship;
+ }
+ }
+ }
+ return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
+ }
+
+
+ // ********** generator container **********
+
+ public OrmGeneratorContainer getGeneratorContainer() {
+ return this.generatorContainer;
+ }
+
+ protected OrmGeneratorContainer buildGeneratorContainer() {
+ return this.getContextNodeFactory().buildOrmGeneratorContainer(this, this.xmlTypeMapping);
+ }
+
+
+ // ********** query container **********
+
+ public OrmQueryContainer getQueryContainer() {
+ return this.queryContainer;
+ }
+
+ protected OrmQueryContainer buildQueryContainer() {
+ return this.getContextNodeFactory().buildOrmQueryContainer(this, this.xmlTypeMapping);
+ }
+
+
+ // ********** associated tables **********
+
+ public Iterator<ReadOnlyTable> associatedTables() {
+ return this.getAssociatedTables().iterator();
+ }
+
+ public Iterable<ReadOnlyTable> getAssociatedTables() {
+ return new CompositeIterable<ReadOnlyTable>(this.table, this.getSecondaryTables());
+ }
+
+ public Iterator<ReadOnlyTable> allAssociatedTables() {
+ return new CompositeIterator<ReadOnlyTable>(this.allAssociatedTablesLists());
+ }
+
+ public Iterable<ReadOnlyTable> getAllAssociatedTables() {
+ return CollectionTools.iterable(this.allAssociatedTables());
+ }
+
+ // TODO eliminate duplicate tables?
+ protected Iterator<Iterator<ReadOnlyTable>> allAssociatedTablesLists() {
+ return new TransformationIterator<TypeMapping, Iterator<ReadOnlyTable>>(this.inheritanceHierarchy(), TypeMappingTools.ASSOCIATED_TABLES_TRANSFORMER);
+ }
+
+ public Iterator<String> allAssociatedTableNames() {
+ return this.getAllAssociatedTableNames().iterator();
+ }
+
+ public Iterable<String> getAllAssociatedTableNames() {
+ return this.convertToNames(this.getAllAssociatedTables());
+ }
+
+ /**
+ * strip out <code>null</code> names
+ */
+ protected Iterable<String> convertToNames(Iterable<ReadOnlyTable> tables) {
+ return new FilteringIterable<String>(this.convertToNames_(tables), NotNullFilter.<String>instance());
+ }
+
+ protected Iterable<String> convertToNames_(Iterable<ReadOnlyTable> tables) {
+ return new TransformationIterable<ReadOnlyTable, String>(tables) {
+ @Override
+ protected String transform(ReadOnlyTable t) {
+ return t.getName();
+ }
+ };
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return ! this.tableNameIsValid(tableName);
+ }
+
+ protected boolean tableNameIsValid(String tableName) {
+ return this.tableIsUndefined || CollectionTools.contains(this.getAllAssociatedTableNames(), tableName);
+ }
+
+
+ // ********** Java **********
+
+ @Override
+ public JavaEntity getJavaTypeMapping() {
+ return (JavaEntity) super.getJavaTypeMapping();
+ }
+
+ @Override
+ public JavaEntity getJavaTypeMappingForDefaults() {
+ return (JavaEntity) super.getJavaTypeMappingForDefaults();
+ }
+
+
+ // ********** database **********
+
+ @Override
+ public String getPrimaryTableName() {
+ return this.table.getName();
+ }
+
+ @Override
+ public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() {
+ return this.table.getDbTable();
+ }
+
+ @Override
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ // matching database objects and identifiers is database platform-specific
+ return this.getDataSource().selectDatabaseObjectForIdentifier(this.getAllAssociatedDbTables(), tableName);
+ }
+
+ /**
+ * strip out null db tables
+ */
+ protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables() {
+ return new FilteringIterable<org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedDbTables_(), NotNullFilter.<org.eclipse.jpt.jpa.db.Table>instance());
+ }
+
+ protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables_() {
+ return new TransformationIterable<ReadOnlyTable, org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedTables()) {
+ @Override
+ protected org.eclipse.jpt.jpa.db.Table transform(ReadOnlyTable t) {
+ return t.getDbTable();
+ }
+ };
+ }
+
+ @Override
+ public Schema getDbSchema() {
+ return this.table.getDbSchema();
+ }
+
+
+ // ********** primary key **********
+
+ public String getPrimaryKeyColumnName() {
+ return MappingTools.getPrimaryKeyColumnName(this);
+ }
+
+ public PersistentAttribute getIdAttribute() {
+ Iterator<AttributeMapping> idAttributeMappings = this.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY).iterator();
+ if (idAttributeMappings.hasNext()) {
+ PersistentAttribute attribute = idAttributeMappings.next().getPersistentAttribute();
+ return idAttributeMappings.hasNext() ? null /*more than one*/: attribute;
+ }
+ return null;
+ }
+
+
+ // ********** key **********
+
+ public String getKey() {
+ return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+
+ // ********** entity mappings **********
+
+ public int getXmlSequence() {
+ return 1;
+ }
+
+ public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) {
+ entityMappings.getEntities().add(this.xmlTypeMapping);
+ }
+
+ public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) {
+ entityMappings.getEntities().remove(this.xmlTypeMapping);
+ }
+
+
+ // ********** attribute mappings **********
+
+ @Override
+ public Column resolveOverriddenColumn(String attributeName) {
+ if (this.isJpa2_0Compatible()) {
+ // strip off the first segment
+ int dotIndex = attributeName.indexOf('.');
+ if (dotIndex != -1) {
+ AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName.substring(dotIndex + 1));
+ if (override != null) {
+ return override.getColumn();
+ }
+ }
+ }
+ return super.resolveOverriddenColumn(attributeName);
+ }
+
+ @Override
+ public Iterator<String> overridableAttributeNames() {
+ return this.isTablePerClass() ?
+ super.overridableAttributeNames() :
+ EmptyIterator.<String>instance();
+ }
+
+ @Override
+ public Iterator<String> overridableAssociationNames() {
+ return this.isTablePerClass() ?
+ super.overridableAssociationNames() :
+ EmptyIterator.<String>instance();
+ }
+
+ public AttributeMapping resolveAttributeMapping(String name) {
+ for (AttributeMapping attributeMapping : CollectionTools.iterable(this.allAttributeMappings())) {
+ AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** inheritance **********
+
+ public Entity getParentEntity() {
+ for (TypeMapping typeMapping : this.getAncestors()) {
+ if (typeMapping instanceof Entity) {
+ return (Entity) typeMapping;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return whether the entity is the top of an inheritance hierarchy.
+ */
+ public boolean isRoot() {
+ return this == this.rootEntity;
+ }
+
+ /**
+ * Return whether the entity is a descendant in (as opposed to the root of)
+ * an inheritance hierarchy.
+ */
+ protected boolean isDescendant() {
+ return ! this.isRoot();
+ }
+
+ /**
+ * Return whether the entity is a descendant of the root entity
+ * of a "single table" inheritance hierarchy.
+ */
+ protected boolean isSingleTableDescendant() {
+ return this.isDescendant() &&
+ (this.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE);
+ }
+
+ /**
+ * Return whether the entity is the top of an inheritance hierarchy
+ * and has no descendants and no specified inheritance strategy has been defined.
+ */
+ protected boolean isRootNoDescendantsNoStrategyDefined() {
+ return this.isRoot() &&
+ this.descendants.isEmpty() &&
+ (this.specifiedInheritanceStrategy == null);
+ }
+
+ /**
+ * Return whether the entity is abstract and is a part of a
+ * "table per class" inheritance hierarchy.
+ */
+ protected boolean isAbstractTablePerClass() {
+ return this.isAbstract() && this.isTablePerClass();
+ }
+
+ protected boolean resourceTableIsSpecified() {
+ return this.table.isSpecifiedInResource() || this.javaResourceTableIsSpecified();
+ }
+
+ protected boolean javaResourceTableIsSpecified() {
+ JavaEntity javaEntity = this.getJavaTypeMapping();
+ return (javaEntity != null) && javaEntity.getTable().isSpecifiedInResource();
+ }
+
+ /**
+ * Return whether the entity is a part of a "table per class"
+ * inheritance hierarchy.
+ */
+ protected boolean isTablePerClass() {
+ return this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS;
+ }
+
+ /**
+ * Return whether the type is abstract; false if no java type exists.
+ */
+ protected boolean isAbstract() {
+ JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
+ return (jrpt != null) && jrpt.isAbstract();
+ }
+
+ /**
+ * Return whether the entity's type is abstract.
+ */
+ protected boolean isFinal() {
+ JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
+ return (jrpt != null) && jrpt.isFinal();
+ }
+
+ /**
+ * Return whether the entity's type is a member of another type.
+ */
+ protected boolean isMember() {
+ JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
+ return (jrpt != null) && jrpt.isMemberType();
+ }
+
+ /**
+ * Return whether the entity's type is static.
+ */
+ protected boolean isStatic() {
+ JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
+ return (jrpt != null) && jrpt.isStatic();
+ }
+
+
+ // ********** refactoring **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createIdClassRenameTypeEdits(originalType, newName));
+ }
+
+ protected Iterable<ReplaceEdit> createIdClassRenameTypeEdits(IType originalType, String newName) {
+ return this.idClassReference.createRenameTypeEdits(originalType, newName);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createIdClassMoveTypeEdits(originalType, newPackage));
+ }
+
+ protected Iterable<ReplaceEdit> createIdClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return this.idClassReference.createMoveTypeEdits(originalType, newPackage);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createIdClassRenamePackageEdits(originalPackage, newName));
+ }
+
+ protected Iterable<ReplaceEdit> createIdClassRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return this.idClassReference.createRenamePackageEdits(originalPackage, newName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ this.validatePrimaryKey(messages, reporter);
+ this.validateTable(messages, reporter);
+ for (OrmSecondaryTable secondaryTable : this.getSpecifiedSecondaryTables()) {
+ secondaryTable.validate(messages, reporter);
+ }
+ this.validateInheritance(messages, reporter);
+ for (OrmPrimaryKeyJoinColumn pkJoinColumn : this.getSpecifiedPrimaryKeyJoinColumns()) {
+ pkJoinColumn.validate(messages, reporter);
+ }
+ this.attributeOverrideContainer.validate(messages, reporter);
+ this.associationOverrideContainer.validate(messages, reporter);
+ this.generatorContainer.validate(messages, reporter);
+ this.queryContainer.validate(messages, reporter);
+ this.validateEntityName(messages, reporter);
+ this.validateDuplicateEntityNames(messages, reporter);
+ }
+
+ protected void validateEntityName(List<IMessage> messages, IReporter reporter) {
+ if (StringTools.stringIsEmpty(this.getName())){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_NAME_MISSING,
+ new String[] {this.getClass_()},
+ this,
+ this.getNameTextRange()
+ )
+ );
+ }
+ }
+
+ protected void validateDuplicateEntityNames(List<IMessage> messages,
+ IReporter reporter) {
+ HashBag<String> ormEntityNames = new HashBag<String>();
+ CollectionTools.addAll(ormEntityNames, this.getPersistenceUnit().ormEntityNames());
+ HashBag<String> javaEntityNamesExclOverridden = new HashBag<String>();
+ CollectionTools.addAll(javaEntityNamesExclOverridden, this.getPersistenceUnit().javaEntityNamesExclOverridden());
+ String name = this.getName();
+ if ((name != null) &&
+ // Check whether or not this entity name has duplicates among the orm entities
+ ((ormEntityNames.count(name) > 1)
+ // Check whether or not this entity name has duplicates among
+ // the java entities that are not defined in the mapping files
+ || (javaEntityNamesExclOverridden.contains(name)))) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_ENTITY_NAME_ATTRIBUTE_MISSING,
+ new String[] {name},
+ this,
+ this.getClassTextRange()
+ )
+ );
+ }
+ }
+
+ protected void validatePrimaryKey(List<IMessage> messages, IReporter reporter) {
+ this.buildPrimaryKeyValidator().validate(messages, reporter);
+ }
+
+ protected JptValidator buildPrimaryKeyValidator() {
+ return new GenericEntityPrimaryKeyValidator(this, this.buildTextRangeResolver());
+ // TODO - JPA 2.0 validation
+ }
+
+ @Override
+ protected EntityTextRangeResolver buildTextRangeResolver() {
+ return new OrmEntityTextRangeResolver(this);
+ }
+
+ protected void validateTable(List<IMessage> messages, IReporter reporter) {
+ if (this.isAbstractTablePerClass()) {
+ if (this.resourceTableIsSpecified()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE,
+ new String[] {this.getName()},
+ this,
+ this.table.getValidationTextRange()
+ )
+ );
+ }
+ return;
+ }
+ if (this.isSingleTableDescendant()) {
+ if (this.resourceTableIsSpecified()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE,
+ new String[] {this.getName()},
+ this,
+ this.table.getValidationTextRange()
+ )
+ );
+ }
+ return;
+ }
+ this.table.validate(messages, reporter);
+ }
+
+ protected void validateInheritance(List<IMessage> messages, IReporter reporter) {
+ this.validateInheritanceStrategy(messages);
+ this.validateDiscriminatorColumn(messages, reporter);
+ this.validateDiscriminatorValue(messages);
+ }
+
+ protected void validateDiscriminatorColumn(List<IMessage> messages, IReporter reporter) {
+ if (this.specifiedDiscriminatorColumnIsAllowed && ! this.discriminatorColumnIsUndefined) {
+ this.discriminatorColumn.validate(messages, reporter);
+ }
+ else if (this.discriminatorColumn.isResourceSpecified()) {
+ if (this.isDescendant()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorColumnTextRange()
+ )
+ );
+ }
+ else if (this.isTablePerClass()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorColumnTextRange()
+ )
+ );
+
+ }
+ }
+ }
+
+ protected void validateDiscriminatorValue(List<IMessage> messages) {
+ if (this.discriminatorValueIsUndefined && (this.specifiedDiscriminatorValue != null)) {
+ if (this.isAbstract()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorValueTextRange()
+ )
+ );
+ }
+ else if (this.isTablePerClass()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED,
+ new String[] {this.getName()},
+ this,
+ this.getDiscriminatorValueTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ protected void validateInheritanceStrategy(List<IMessage> messages) {
+ Supported tablePerConcreteClassInheritanceIsSupported = this.getJpaPlatformVariation().getTablePerConcreteClassInheritanceIsSupported();
+ if (tablePerConcreteClassInheritanceIsSupported == Supported.YES) {
+ return;
+ }
+ if ((this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS) && this.isRoot()) {
+ if (tablePerConcreteClassInheritanceIsSupported == Supported.NO) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM,
+ new String[] {this.getName()},
+ this,
+ this.getInheritanceStrategyTextRange()
+ )
+ );
+ }
+ else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM,
+ new String[] {this.getName()},
+ this,
+ this.getInheritanceStrategyTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ protected TextRange getDiscriminatorValueTextRange() {
+ return this.xmlTypeMapping.getDiscriminatorValueTextRange();
+ }
+
+ protected TextRange getDiscriminatorColumnTextRange() {
+ return this.xmlTypeMapping.getDiscriminatorColumn().getValidationTextRange();
+ }
+
+ protected TextRange getInheritanceStrategyTextRange() {
+ return this.xmlTypeMapping.getInheritanceStrategyTextRange();
+ }
+
+
+ // ********** OrmOverrideContainer.Owner implementation **********
+
+ /**
+ * some common behavior
+ */
+ protected abstract class OverrideContainerOwner
+ implements OrmOverrideContainer.Owner
+ {
+ public OrmTypeMapping getTypeMapping() {
+ return AbstractOrmEntity.this;
+ }
+
+ public TextRange getValidationTextRange() {
+ return AbstractOrmEntity.this.getValidationTextRange();
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractOrmEntity.this.getOverridableTypeMapping();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? this.allOverridableNames_(typeMapping) : EmptyIterator.<String>instance();
+ }
+
+ /**
+ * pre-condition: <code>typeMapping</code> is not <code>null</code>
+ */
+ protected abstract Iterator<String> allOverridableNames_(TypeMapping typeMapping);
+
+ public String getDefaultTableName() {
+ return AbstractOrmEntity.this.getPrimaryTableName();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return AbstractOrmEntity.this.tableNameIsInvalid(tableName);
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return AbstractOrmEntity.this.resolveDbTable(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return AbstractOrmEntity.this.allAssociatedTableNames();
+ }
+ }
+
+
+ // ********** OrmAttributeOverrideContainer.Owner implementation **********
+
+ protected class AttributeOverrideContainerOwner
+ extends OverrideContainerOwner
+ implements OrmAttributeOverrideContainer.Owner
+ {
+ @Override
+ protected Iterator<String> allOverridableNames_(TypeMapping typeMapping) {
+ final Collection<String> mappedByRelationshipAttributes = CollectionTools.collection(
+ new TransformationIterator<SingleRelationshipMapping2_0, String>(this.getMapsIdRelationships()) {
+ @Override
+ protected String transform(SingleRelationshipMapping2_0 mapping) {
+ return mapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getValue();
+ }
+ });
+ return new FilteringIterator<String>(typeMapping.allOverridableAttributeNames()) {
+ @Override
+ protected boolean accept(String name) {
+ if (mappedByRelationshipAttributes.isEmpty()) {
+ return true;
+ }
+ // overridable names are (usually?) qualified with a container mapping,
+ // which may also be the one mapped by a relationship
+ int index = name.indexOf('.');
+ String qualifier = (index > 0) ? name.substring(0, index) : name;
+ return ! mappedByRelationshipAttributes.contains(qualifier);
+ }
+ };
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getMapsIdRelationships() {
+ return new FilteringIterable<SingleRelationshipMapping2_0>(this.getSingleRelationshipMappings()) {
+ @Override
+ protected boolean accept(SingleRelationshipMapping2_0 mapping) {
+ return mapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy();
+ }
+ };
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getSingleRelationshipMappings() {
+ return new SubIterableWrapper<AttributeMapping, SingleRelationshipMapping2_0>(this.getSingleRelationshipMappings_());
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<AttributeMapping> getSingleRelationshipMappings_() {
+ return new CompositeIterable<AttributeMapping>(
+ this.getTypeMapping().getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY),
+ this.getTypeMapping().getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)
+ );
+ }
+
+ public EList<XmlAttributeOverride> getXmlOverrides() {
+ return AbstractOrmEntity.this.xmlTypeMapping.getAttributeOverrides();
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ return AbstractOrmEntity.this.resolveOverriddenColumnForAttributeOverride(attributeName);
+ }
+ }
+
+
+ // ********** OrmAssociationOverrideContainer.Owner implementation **********
+
+ protected class AssociationOverrideContainerOwner
+ extends OverrideContainerOwner
+ implements OrmAssociationOverrideContainer.Owner
+ {
+ @Override
+ protected Iterator<String> allOverridableNames_(TypeMapping typeMapping) {
+ return typeMapping.allOverridableAssociationNames();
+ }
+
+ public EList<XmlAssociationOverride> getXmlOverrides() {
+ return AbstractOrmEntity.this.xmlTypeMapping.getAssociationOverrides();
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ return AbstractOrmEntity.this.resolveOverriddenRelationshipForAssociationOverride(attributeName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table t, TableTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinTableValidator(override, (JoinTable) t, textRangeResolver);
+ }
+ }
+
+
+ // ********** OrmNamedColumn.Owner implementation **********
+
+ /**
+ * some common behavior
+ */
+ protected abstract class NamedColumnOwner
+ implements OrmNamedColumn.Owner
+ {
+ public TypeMapping getTypeMapping() {
+ return AbstractOrmEntity.this;
+ }
+
+ public String getDefaultTableName() {
+ return AbstractOrmEntity.this.getPrimaryTableName();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return AbstractOrmEntity.this.resolveDbTable(tableName);
+ }
+
+ public TextRange getValidationTextRange() {
+ return AbstractOrmEntity.this.getValidationTextRange();
+ }
+ }
+
+
+ // ********** OrmBaseJoinColumn.Owner implementation **********
+
+ protected class PrimaryKeyJoinColumnOwner
+ extends NamedColumnOwner
+ implements OrmBaseJoinColumn.Owner
+ {
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ Entity parentEntity = AbstractOrmEntity.this.getParentEntity();
+ return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return AbstractOrmEntity.this.primaryKeyJoinColumnsSize();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return CollectionTools.contains(AbstractOrmEntity.this.defaultPrimaryKeyJoinColumns(), joinColumn);
+ }
+
+ public String getDefaultColumnName() {
+ if (this.joinColumnsSize() != 1) {
+ return null;
+ }
+ Entity parentEntity = AbstractOrmEntity.this.getParentEntity();
+ return (parentEntity == null) ? AbstractOrmEntity.this.getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new EntityPrimaryKeyJoinColumnValidator((BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+
+
+ // ********** OrmDiscriminatorColumn.Owner implementation **********
+
+ protected class DiscriminatorColumnOwner
+ extends NamedColumnOwner
+ implements OrmDiscriminatorColumn.Owner
+ {
+ public String getDefaultColumnName() {
+ if (this.getXmlColumn() == null) {
+ JavaEntity javaEntity = this.getJavaEntityForDefaults();
+ if (javaEntity != null) {
+ String name = javaEntity.getDiscriminatorColumn().getSpecifiedName();
+ if (name != null) {
+ return name;
+ }
+ }
+ }
+ return AbstractOrmEntity.this.isDescendant() ?
+ this.getRootDiscriminatorColumn().getName() :
+ this.isTablePerClass() ? null : DiscriminatorColumn.DEFAULT_NAME;
+ }
+
+ public int getDefaultLength() {
+ if (this.getXmlColumn() == null) {
+ JavaEntity javaEntity = this.getJavaEntityForDefaults();
+ if (javaEntity != null) {
+ Integer length = javaEntity.getDiscriminatorColumn().getSpecifiedLength();
+ if (length != null) {
+ return length.intValue();
+ }
+ }
+ }
+ return AbstractOrmEntity.this.isDescendant() ?
+ this.getRootDiscriminatorColumn().getLength() :
+ this.isTablePerClass() ? 0 : DiscriminatorColumn.DEFAULT_LENGTH;
+ }
+
+ public DiscriminatorType getDefaultDiscriminatorType() {
+ if (this.getXmlColumn() == null) {
+ JavaEntity javaEntity = this.getJavaEntityForDefaults();
+ if (javaEntity != null) {
+ DiscriminatorType dt = javaEntity.getDiscriminatorColumn().getSpecifiedDiscriminatorType();
+ if (dt != null) {
+ return dt;
+ }
+ }
+ }
+ return AbstractOrmEntity.this.isDescendant() ?
+ this.getRootDiscriminatorColumn().getDiscriminatorType() :
+ this.isTablePerClass() ? null : DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new DiscriminatorColumnValidator(column, textRangeResolver);
+ }
+
+ public XmlDiscriminatorColumn getXmlColumn() {
+ return this.getXmlEntity().getDiscriminatorColumn();
+ }
+
+ public XmlDiscriminatorColumn buildXmlColumn() {
+ XmlDiscriminatorColumn xmlColumn = OrmFactory.eINSTANCE.createXmlDiscriminatorColumn();
+ this.getXmlEntity().setDiscriminatorColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ public void removeXmlColumn() {
+ this.getXmlEntity().setDiscriminatorColumn(null);
+ }
+
+ protected XmlEntity getXmlEntity() {
+ return AbstractOrmEntity.this.getXmlTypeMapping();
+ }
+
+ protected DiscriminatorColumn getRootDiscriminatorColumn() {
+ return AbstractOrmEntity.this.rootEntity.getDiscriminatorColumn();
+ }
+
+ protected boolean isMetadataComplete() {
+ return AbstractOrmEntity.this.isMetadataComplete();
+ }
+
+ protected boolean isTablePerClass() {
+ return AbstractOrmEntity.this.isTablePerClass();
+ }
+
+ protected JavaEntity getJavaEntityForDefaults() {
+ return AbstractOrmEntity.this.getJavaTypeMappingForDefaults();
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java
new file mode 100644
index 0000000000..1a57454851
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * <code>orm.xml</code> sequence or table generator
+ */
+public abstract class AbstractOrmGenerator<X extends XmlGenerator>
+ extends AbstractOrmXmlContextNode
+ implements OrmGenerator
+{
+ protected final X xmlGenerator;
+
+ protected String name;
+
+ protected Integer specifiedInitialValue;
+ protected int defaultInitialValue;
+
+ protected Integer specifiedAllocationSize;
+ protected int defaultAllocationSize;
+
+
+ protected AbstractOrmGenerator(XmlContextNode parent, X xmlGenerator) {
+ super(parent);
+ this.xmlGenerator = xmlGenerator;
+ this.name = xmlGenerator.getName();
+ this.specifiedInitialValue = xmlGenerator.getInitialValue();
+ this.specifiedAllocationSize = xmlGenerator.getAllocationSize();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.xmlGenerator.getName());
+ this.setSpecifiedInitialValue_(this.xmlGenerator.getInitialValue());
+ this.setSpecifiedAllocationSize_(this.xmlGenerator.getAllocationSize());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultInitialValue(this.buildDefaultInitialValue());
+ this.setDefaultAllocationSize(this.buildDefaultAllocationSize());
+ this.getPersistenceUnit().addGenerator(this);
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.setName_(name);
+ this.xmlGenerator.setName(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** initial value **********
+
+ public int getInitialValue() {
+ return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue;
+ }
+
+ public Integer getSpecifiedInitialValue() {
+ return this.specifiedInitialValue;
+ }
+
+ public void setSpecifiedInitialValue(Integer specifiedInitialValue) {
+ this.setSpecifiedInitialValue_(specifiedInitialValue);
+ this.xmlGenerator.setInitialValue(specifiedInitialValue);
+ }
+
+ protected void setSpecifiedInitialValue_(Integer specifiedInitialValue) {
+ Integer old = this.specifiedInitialValue;
+ this.specifiedInitialValue = specifiedInitialValue;
+ this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, specifiedInitialValue);
+ }
+
+ public int getDefaultInitialValue() {
+ return this.defaultInitialValue;
+ }
+
+ protected void setDefaultInitialValue(int defaultInitialValue) {
+ int old = this.defaultInitialValue;
+ this.defaultInitialValue = defaultInitialValue;
+ this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, defaultInitialValue);
+ }
+
+ protected abstract int buildDefaultInitialValue();
+
+
+ // ********** allocation size **********
+
+ public int getAllocationSize() {
+ return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize;
+ }
+
+ public Integer getSpecifiedAllocationSize() {
+ return this.specifiedAllocationSize;
+ }
+
+ public void setSpecifiedAllocationSize(Integer specifiedAllocationSize) {
+ this.setSpecifiedAllocationSize_(specifiedAllocationSize);
+ this.xmlGenerator.setAllocationSize(specifiedAllocationSize);
+ }
+
+ protected void setSpecifiedAllocationSize_(Integer specifiedAllocationSize) {
+ Integer old = this.specifiedAllocationSize;
+ this.specifiedAllocationSize = specifiedAllocationSize;
+ this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, specifiedAllocationSize);
+ }
+
+ public int getDefaultAllocationSize() {
+ return this.defaultAllocationSize;
+ }
+
+ protected void setDefaultAllocationSize(int defaultAllocationSize) {
+ int old = this.defaultAllocationSize;
+ this.defaultAllocationSize = defaultAllocationSize;
+ this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, defaultAllocationSize);
+ }
+
+ protected int buildDefaultAllocationSize() {
+ return DEFAULT_ALLOCATION_SIZE;
+ }
+
+
+ // ********** text ranges **********
+
+ public TextRange getValidationTextRange() {
+ TextRange validationTextRange = this.xmlGenerator.getValidationTextRange();
+ return (validationTextRange != null) ? validationTextRange : this.getParent().getValidationTextRange();
+ }
+
+ public TextRange getNameTextRange() {
+ TextRange nameTextRange = this.xmlGenerator.getNameTextRange();
+ return (nameTextRange != null) ? nameTextRange : this.getValidationTextRange();
+ }
+
+
+ // ********** database stuff **********
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ protected abstract String getSchema();
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ protected abstract String getCatalog();
+
+
+ // ********** misc **********
+
+ public X getXmlGenerator() {
+ return this.xmlGenerator;
+ }
+
+ @Override
+ public XmlContextNode getParent() {
+ return (XmlContextNode) super.getParent();
+ }
+
+ public boolean overrides(Generator other) {
+ return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST);
+ }
+
+ public boolean duplicates(Generator other) {
+ return MappingTools.nodesAreDuplicates(this, other);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java
new file mode 100644
index 0000000000..6b01a760a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java
@@ -0,0 +1,508 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.IdMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> ID mapping
+ */
+public abstract class AbstractOrmIdMapping<X extends XmlId>
+ extends AbstractOrmAttributeMapping<X>
+ implements OrmIdMapping, IdMapping2_0
+{
+ protected final OrmColumn column;
+
+ protected final OrmGeneratorContainer generatorContainer;
+
+ protected OrmGeneratedValue generatedValue;
+
+ protected OrmConverter converter; // never null
+
+ /* 2.0 feature - a relationship may map this ID */
+ protected boolean mappedByRelationship;
+
+
+ protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
+ OrmTemporalConverter.Adapter.instance(),
+ };
+ protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractOrmIdMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.column = this.buildColumn();
+ this.generatorContainer = this.buildGeneratorContainer();
+ this.generatedValue = this.buildGeneratedValue();
+ this.converter = this.buildConverter();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ this.generatorContainer.synchronizeWithResourceModel();
+ this.syncGeneratedValue();
+ this.syncConverter();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ this.generatorContainer.update();
+ if (this.generatedValue != null) {
+ this.generatedValue.update();
+ }
+ this.converter.update();
+ this.setMappedByRelationship(this.buildMappedByRelationship());
+ }
+
+
+ // ********** column **********
+
+ public OrmColumn getColumn() {
+ return this.column;
+ }
+
+ protected OrmColumn buildColumn() {
+ return this.getContextNodeFactory().buildOrmColumn(this, this);
+ }
+
+
+ // ********** generator container **********
+
+ public OrmGeneratorContainer getGeneratorContainer() {
+ return this.generatorContainer;
+ }
+
+ protected OrmGeneratorContainer buildGeneratorContainer() {
+ return this.getContextNodeFactory().buildOrmGeneratorContainer(this, this.xmlAttributeMapping);
+ }
+
+
+ // ********** generated value **********
+
+ public OrmGeneratedValue getGeneratedValue() {
+ return this.generatedValue;
+ }
+
+ public OrmGeneratedValue addGeneratedValue() {
+ if (this.generatedValue != null) {
+ throw new IllegalStateException("generated value already exists: " + this.generatedValue); //$NON-NLS-1$
+ }
+ XmlGeneratedValue xmlGeneratedValue = this.buildXmlGeneratedValue();
+ OrmGeneratedValue value = this.buildGeneratedValue(xmlGeneratedValue);
+ this.setGeneratedValue(value);
+ this.xmlAttributeMapping.setGeneratedValue(xmlGeneratedValue);
+ return value;
+ }
+
+ protected XmlGeneratedValue buildXmlGeneratedValue() {
+ return OrmFactory.eINSTANCE.createXmlGeneratedValue();
+ }
+
+ public void removeGeneratedValue() {
+ if (this.generatedValue == null) {
+ throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$
+ }
+ this.setGeneratedValue(null);
+ this.xmlAttributeMapping.setGeneratedValue(null);
+ }
+
+ protected void setGeneratedValue(OrmGeneratedValue value) {
+ OrmGeneratedValue old = this.generatedValue;
+ this.generatedValue = value;
+ this.firePropertyChanged(GENERATED_VALUE_PROPERTY, old, value);
+ }
+
+ protected OrmGeneratedValue buildGeneratedValue() {
+ XmlGeneratedValue xmlGeneratedValue = this.xmlAttributeMapping.getGeneratedValue();
+ return (xmlGeneratedValue == null) ? null : this.buildGeneratedValue(xmlGeneratedValue);
+ }
+
+ protected OrmGeneratedValue buildGeneratedValue(XmlGeneratedValue xmlGeneratedValue) {
+ return this.getContextNodeFactory().buildOrmGeneratedValue(this, xmlGeneratedValue);
+ }
+
+ protected void syncGeneratedValue() {
+ XmlGeneratedValue xmlGeneratedValue = this.xmlAttributeMapping.getGeneratedValue();
+ if (xmlGeneratedValue == null) {
+ if (this.generatedValue != null) {
+ this.setGeneratedValue(null);
+ }
+ } else {
+ if ((this.generatedValue != null) && (this.generatedValue.getXmlGeneratedValue() == xmlGeneratedValue)) {
+ this.generatedValue.synchronizeWithResourceModel();
+ } else {
+ this.setGeneratedValue(this.buildGeneratedValue(xmlGeneratedValue));
+ }
+ }
+ }
+
+
+ // ********** converter **********
+
+ public OrmConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ // note: we may also clear the XML value we want;
+ // but if we leave it, the resulting sync will screw things up...
+ this.clearXmlConverterValues();
+ OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter.initialize();
+ }
+ }
+
+ protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(OrmConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ protected void clearXmlConverterValues() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ adapter.clearXmlValue(this.xmlAttributeMapping);
+ }
+ }
+
+ protected OrmConverter buildConverter() {
+ OrmXmlContextNodeFactory factory = this.getContextNodeFactory();
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ OrmConverter ormConverter = adapter.buildConverter(this, factory);
+ if (ormConverter != null) {
+ return ormConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
+ if (adapter == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ if (this.converter.getType() == adapter.getConverterType()) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first adapter whose converter value is set in the XML mapping.
+ * Return <code>null</code> if there are no converter values in the XML.
+ */
+ protected OrmConverter.Adapter getXmlConverterAdapter() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.isActive(this.xmlAttributeMapping)) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected OrmConverter buildNullConverter() {
+ return new NullOrmConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected OrmConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<OrmConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** mapped by relationship **********
+
+ public boolean isMappedByRelationship() {
+ return this.mappedByRelationship;
+ }
+
+ protected void setMappedByRelationship(boolean value) {
+ boolean old = this.mappedByRelationship;
+ this.mappedByRelationship = value;
+ this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, value);
+ }
+
+ protected boolean buildMappedByRelationship() {
+ return this.isJpa2_0Compatible() && this.buildMappedByRelationship_();
+ }
+
+ protected boolean buildMappedByRelationship_() {
+ return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.getName());
+ }
+
+ protected Iterable<String> getMappedByRelationshipAttributeNames() {
+ return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 0;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmIdMapping(this);
+ }
+
+ @Override
+ protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
+ super.initializeFromOrmColumnMapping(oldMapping);
+ this.column.initializeFrom(oldMapping.getColumn());
+ }
+
+ @Override
+ public String getPrimaryKeyColumnName() {
+ return this.column.getName();
+ }
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ resourceAttributes.getIds().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ resourceAttributes.getIds().remove(this.xmlAttributeMapping);
+ }
+
+
+ // ********** OrmColumn.Owner implementation **********
+
+ public String getDefaultColumnName() {
+ return (this.mappedByRelationship && ! this.isColumnSpecified()) ? null : this.name;
+ }
+
+ public String getDefaultTableName() {
+ return (this.mappedByRelationship && ! this.isColumnSpecified()) ? null : this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public XmlColumn getXmlColumn() {
+ return this.xmlAttributeMapping.getColumn();
+ }
+
+ public XmlColumn buildXmlColumn() {
+ XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
+ this.xmlAttributeMapping.setColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ public void removeXmlColumn() {
+ this.xmlAttributeMapping.setColumn(null);
+ }
+
+ protected boolean isColumnSpecified() {
+ return this.getXmlColumn() != null;
+ }
+
+
+ // ********** refactoring **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createConverterRenameTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenameTypeEdits(IType originalType, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenameTypeEdits(originalType, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createConverterMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return (this.converter != null) ?
+ this.converter.createMoveTypeEdits(originalType, newPackage) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createConverterRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenamePackageEdits(originalPackage, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ // [JPA 2.0] if the column is specified, or if the id is not mapped by a relationship,
+ // then the column is validated.
+ // (In JPA 1.0, the column will always be validated, since the id is never mapped by a
+ // relationship)
+ if (this.isColumnSpecified() || ! this.isMappedByRelationship()) {
+ this.column.validate(messages, reporter);
+ }
+
+ // [JPA 2.0] if the column is specified and the id is mapped by a relationship,
+ // then that is an error
+ // (In JPA 1.0, this will never be the case, since the id is never mapped by a relationship)
+ if (this.isColumnSpecified() && this.isMappedByRelationship()) {
+ messages.add(this.buildMappedByRelationshipAndColumnSpecifiedMessage());
+ }
+
+ if (this.generatedValue != null) {
+ this.generatedValue.validate(messages, reporter);
+ }
+ this.generatorContainer.validate(messages, reporter);
+ this.converter.validate(messages, reporter);
+ }
+
+ protected IMessage buildMappedByRelationshipAndColumnSpecifiedMessage() {
+ return this.buildMessage(
+ JpaValidationMessages.ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ this.column.getValidationTextRange()
+ );
+ }
+
+ protected IMessage buildMessage(String msgID, String[] parms, TextRange textRange) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ ArrayTools.add(parms, 0, this.buildAttributeDescription()),
+ this,
+ textRange
+ );
+ }
+
+ protected String buildAttributeDescription() {
+ return NLS.bind(this.getAttributeDescriptionTemplate(), this.getPersistentAttribute().getName());
+ }
+
+ protected String getAttributeDescriptionTemplate() {
+ return this.getPersistentAttribute().isVirtual() ?
+ JpaValidationDescriptionMessages.VIRTUAL_ATTRIBUTE_DESC :
+ JpaValidationDescriptionMessages.ATTRIBUTE_DESC;
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..80c03483f2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractOrmJoinColumnRelationshipStrategy
+ extends AbstractOrmXmlContextNode
+ implements OrmJoinColumnRelationshipStrategy
+{
+ protected final Vector<OrmJoinColumn> specifiedJoinColumns = new Vector<OrmJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final OrmJoinColumn.Owner joinColumnOwner;
+
+ protected OrmJoinColumn defaultJoinColumn;
+
+
+ protected AbstractOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) {
+ super(parent);
+ this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ this.initializeSpecifiedJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedJoinColumns();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedJoinColumns());
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** XML join column container **********
+
+ protected XmlJoinColumnContainer getXmlJoinColumnContainer() {
+ return this.getRelationship().getXmlContainer();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<OrmJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public OrmJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ public OrmJoinColumn addSpecifiedJoinColumn() {
+ return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ }
+
+ public OrmJoinColumn addSpecifiedJoinColumn(int index) {
+ XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
+ OrmJoinColumn joinColumn = this.addSpecifiedJoinColumn_(index, xmlJoinColumn);
+ this.getXmlJoinColumnContainer().getJoinColumns().add(index, xmlJoinColumn);
+ return joinColumn;
+ }
+
+ protected XmlJoinColumn buildXmlJoinColumn() {
+ return OrmFactory.eINSTANCE.createXmlJoinColumn();
+ }
+
+ public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ this.removeSpecifiedJoinColumn_(index);
+ this.getXmlJoinColumnContainer().getJoinColumns().remove(index);
+ }
+
+ protected void removeSpecifiedJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.getXmlJoinColumnContainer().getJoinColumns().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeSpecifiedJoinColumns() {
+ for (XmlJoinColumn xmlJoinColumn : this.getXmlJoinColumns()) {
+ this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn));
+ }
+ }
+
+ protected void syncSpecifiedJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<XmlJoinColumn> getXmlJoinColumns() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlJoinColumn>(this.getXmlJoinColumnContainer().getJoinColumns());
+ }
+
+ protected void moveSpecifiedJoinColumn_(int index, OrmJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmJoinColumn addSpecifiedJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
+ OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn);
+ this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
+ return new SpecifiedJoinColumnContainerAdapter();
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
+ {
+ public Iterable<OrmJoinColumn> getContextElements() {
+ return AbstractOrmJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<XmlJoinColumn> getResourceElements() {
+ return AbstractOrmJoinColumnRelationshipStrategy.this.getXmlJoinColumns();
+ }
+ public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
+ return contextElement.getXmlColumn();
+ }
+ public void moveContextElement(int index, OrmJoinColumn element) {
+ AbstractOrmJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, XmlJoinColumn resourceElement) {
+ AbstractOrmJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(OrmJoinColumn element) {
+ AbstractOrmJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn_(element);
+ }
+ }
+
+ protected abstract OrmJoinColumn.Owner buildJoinColumnOwner();
+
+
+ // ********** default join column **********
+
+ public OrmJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(OrmJoinColumn joinColumn) {
+ OrmJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<OrmJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<OrmJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<OrmJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ if (this.buildsDefaultJoinColumn()) {
+ if (this.defaultJoinColumn == null) {
+ this.setDefaultJoinColumn(this.buildJoinColumn(null));
+ } else {
+ this.defaultJoinColumn.update();
+ }
+ } else {
+ this.setDefaultJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultJoinColumn() {
+ return ! this.hasSpecifiedJoinColumns() &&
+ this.getRelationship().mayHaveDefaultJoinColumn();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmJoinColumnRelationship getParent() {
+ return (OrmJoinColumnRelationship) super.getParent();
+ }
+
+ public OrmJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected OrmJoinColumn buildJoinColumn(XmlJoinColumn xmlJoinColumn) {
+ return this.getContextNodeFactory().buildOrmJoinColumn(this, this.joinColumnOwner, xmlJoinColumn);
+ }
+
+ public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldStrategy.specifiedJoinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
+ }
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) {
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualStrategy.joinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
+ }
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ public String getTableName() {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping == null) ? null : typeMapping.getPrimaryTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping == null) ? null : typeMapping.resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping != null) && typeMapping.tableNameIsInvalid(tableName);
+ }
+
+ // subclasses like this to be public
+ public Table getReferencedColumnDbTable() {
+ TypeMapping relationshipTarget = this.getRelationshipTarget();
+ return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
+ }
+
+ protected Iterator<String> candidateTableNames() {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping != null) ? typeMapping.allAssociatedTableNames() : EmptyIterator.<String>instance();
+ }
+
+ public void addStrategy() {
+ if (this.specifiedJoinColumnsSize() == 0) {
+ this.addSpecifiedJoinColumn();
+ }
+ }
+
+ public void removeStrategy() {
+ for (int i = this.specifiedJoinColumns.size(); i-- > 0; ) {
+ this.removeSpecifiedJoinColumn(i);
+ }
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ for (OrmJoinColumn joinColumn : this.getJoinColumns()) {
+ joinColumn.validate(messages, reporter);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..922e5bcd64
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractOrmJoinTableRelationshipStrategy
+ extends AbstractOrmXmlContextNode
+ implements OrmJoinTableRelationshipStrategy, Table.Owner
+{
+ protected OrmJoinTable joinTable;
+
+
+ protected AbstractOrmJoinTableRelationshipStrategy(OrmJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ if (this.joinTable != null) {
+ this.joinTable.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinTable();
+ }
+
+
+ // ********** join table **********
+
+ public OrmJoinTable getJoinTable() {
+ return this.joinTable;
+ }
+
+ protected void setJoinTable(OrmJoinTable joinTable) {
+ OrmJoinTable old = this.joinTable;
+ this.joinTable = joinTable;
+ this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable);
+ }
+
+ protected void updateJoinTable() {
+ if (this.buildsJoinTable()) {
+ if (this.joinTable == null) {
+ this.setJoinTable(this.buildJoinTable());
+ } else {
+ this.joinTable.update();
+ }
+ } else {
+ if (this.joinTable != null) {
+ this.setJoinTable(null);
+ }
+ }
+ }
+
+ /**
+ * The strategy can have a join table if either the XML table is present
+ * or the [mapping] relationship supports a default join table.
+ */
+ protected boolean buildsJoinTable() {
+ return (this.getXmlJoinTable() != null) ||
+ this.getRelationship().mayHaveDefaultJoinTable();
+ }
+
+ protected OrmJoinTable buildJoinTable() {
+ return this.getContextNodeFactory().buildOrmJoinTable(this, this);
+ }
+
+
+ // ********** XML join table **********
+
+ public XmlJoinTable getXmlJoinTable() {
+ return this.getXmlJoinTableContainer().getJoinTable();
+ }
+
+ public XmlJoinTable buildXmlJoinTable() {
+ XmlJoinTable xmlJoinTable = OrmFactory.eINSTANCE.createXmlJoinTable();
+ this.getXmlJoinTableContainer().setJoinTable(xmlJoinTable);
+ return xmlJoinTable;
+ }
+
+ public void removeXmlJoinTable() {
+ this.getXmlJoinTableContainer().setJoinTable(null);
+ }
+
+ protected XmlJoinTableContainer getXmlJoinTableContainer() {
+ return this.getRelationship().getXmlContainer();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ if (this.joinTable != null) {
+ this.joinTable.validate(messages, reporter);
+ }
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmJoinTableRelationship getParent() {
+ return (OrmJoinTableRelationship) super.getParent();
+ }
+
+ public OrmJoinTableRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) {
+ ReadOnlyJoinTable oldJoinTable = oldStrategy.getJoinTable();
+ if (oldJoinTable != null) {
+ this.addStrategy();
+ this.joinTable.initializeFrom(oldJoinTable);
+ }
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) {
+ ReadOnlyJoinTable oldJoinTable = virtualStrategy.getJoinTable();
+ if (oldJoinTable != null) {
+ this.addStrategy();
+ this.joinTable.initializeFromVirtual(oldJoinTable);
+ }
+ }
+
+ public String getTableName() {
+ return (this.joinTable == null) ? null : this.joinTable.getName();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return (this.joinTable == null) ? null : this.joinTable.getDbTable();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getTableName(), tableName);
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE;
+ }
+
+ public String getJoinTableDefaultName() {
+ return MappingTools.buildJoinTableDefaultName(this.getRelationship());
+ }
+
+ public void addStrategy() {
+ if (this.joinTable == null) {
+ this.setJoinTable(this.buildJoinTable());
+ this.buildXmlJoinTable();
+ }
+ }
+
+ public void removeStrategy() {
+ if (this.joinTable != null) {
+ this.setJoinTable(null);
+ this.removeXmlJoinTable();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java
new file mode 100644
index 0000000000..e131cef90a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToManyMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+
+public abstract class AbstractOrmManyToManyMapping<X extends XmlManyToMany>
+ extends AbstractOrmMultiRelationshipMapping<X>
+ implements OrmManyToManyMapping2_0
+{
+ protected AbstractOrmManyToManyMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ public OrmManyToManyRelationship getRelationship() {
+ return (OrmManyToManyRelationship) super.getRelationship();
+ }
+
+ @Override
+ protected OrmMappingRelationship buildRelationship() {
+ return new GenericOrmManyToManyRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 70;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmManyToManyMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ resourceAttributes.getManyToManys().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ resourceAttributes.getManyToManys().remove(this.xmlAttributeMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java
new file mode 100644
index 0000000000..d5927bd21d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneRelationship2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+
+/**
+ * <code>orm.xml</code> 1:1 mapping
+ */
+public abstract class AbstractOrmManyToOneMapping<X extends XmlManyToOne>
+ extends AbstractOrmSingleRelationshipMapping<X>
+ implements OrmManyToOneMapping2_0
+{
+ protected AbstractOrmManyToOneMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ protected OrmManyToOneRelationship2_0 buildRelationship() {
+ return new GenericOrmManyToOneRelationship(this);
+ }
+
+ @Override
+ public OrmManyToOneRelationship2_0 getRelationship() {
+ return (OrmManyToOneRelationship2_0) super.getRelationship();
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 40;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmManyToOneMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ resourceAttributes.getManyToOnes().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ resourceAttributes.getManyToOnes().remove(this.xmlAttributeMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java
new file mode 100644
index 0000000000..1f503a14be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> mapped superclass
+ */
+public abstract class AbstractOrmMappedSuperclass<X extends XmlMappedSuperclass>
+ extends AbstractOrmTypeMapping<X>
+ implements OrmMappedSuperclass, OrmIdClassReference.Owner
+{
+ protected final OrmIdClassReference idClassReference;
+
+
+ protected AbstractOrmMappedSuperclass(OrmPersistentType parent, X xmlMappedSuperclass) {
+ super(parent, xmlMappedSuperclass);
+ this.idClassReference = this.buildIdClassReference();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.idClassReference.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.idClassReference.update();
+ }
+
+
+ // ********** key **********
+
+ public String getKey() {
+ return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
+ }
+
+
+ // ********** id class **********
+
+ public OrmIdClassReference getIdClassReference() {
+ return this.idClassReference;
+ }
+
+ protected OrmIdClassReference buildIdClassReference() {
+ return new GenericOrmIdClassReference(this, this);
+ }
+
+ public JavaPersistentType getIdClass() {
+ return this.idClassReference.getIdClass();
+ }
+
+ public XmlIdClassContainer getXmlIdClassContainer() {
+ return this.getXmlTypeMapping();
+ }
+
+ public JavaIdClassReference getJavaIdClassReferenceForDefaults() {
+ JavaMappedSuperclass javaMappedSuperclass = this.getJavaTypeMappingForDefaults();
+ return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getIdClassReference();
+ }
+
+
+ // ********** entity mappings **********
+
+ public int getXmlSequence() {
+ return 0;
+ }
+
+ public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) {
+ entityMappings.getMappedSuperclasses().add(this.xmlTypeMapping);
+ }
+
+ public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) {
+ entityMappings.getMappedSuperclasses().remove(this.xmlTypeMapping);
+ }
+
+
+ // ********** Java **********
+
+ @Override
+ public JavaMappedSuperclass getJavaTypeMapping() {
+ return (JavaMappedSuperclass) super.getJavaTypeMapping();
+ }
+
+ @Override
+ public JavaMappedSuperclass getJavaTypeMappingForDefaults() {
+ return (JavaMappedSuperclass) super.getJavaTypeMappingForDefaults();
+ }
+
+
+ // ********** tables **********
+
+ public Iterator<ReadOnlyTable> associatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ReadOnlyTable> allAssociatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> allAssociatedTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+
+ // ********** refactoring **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createIdClassReplaceTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createIdClassReplaceTypeEdits(IType originalType, String newName) {
+ return this.idClassReference.createRenameTypeEdits(originalType, newName);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createIdClassMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createIdClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return this.idClassReference.createMoveTypeEdits(originalType, newPackage);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createIdClassRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createIdClassRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return this.idClassReference.createRenamePackageEdits(originalPackage, newName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validatePrimaryKey(messages, reporter);
+ }
+
+ @Override
+ public boolean validatesAgainstDatabase() {
+ return false;
+ }
+
+ protected void validatePrimaryKey(List<IMessage> messages, IReporter reporter) {
+ this.buildPrimaryKeyValidator().validate(messages, reporter);
+ }
+
+ protected JptValidator buildPrimaryKeyValidator() {
+ return new GenericMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver());
+ // TODO - JPA 2.0 validation
+ }
+
+ @Override
+ protected PrimaryKeyTextRangeResolver buildTextRangeResolver() {
+ return new OrmMappedSuperclassTextRangeResolver(this);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java
new file mode 100644
index 0000000000..b5cc9a7179
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
+
+/**
+ * <strong>NB:</strong> Subclasses will want to set the {@link #strategy} at the
+ * end of their constructors; otherwise, it will be <code>null</code> until it
+ * is set during {@link #update()}.
+ */
+public abstract class AbstractOrmMappingRelationship<M extends OrmRelationshipMapping>
+ extends AbstractOrmXmlContextNode
+ implements OrmMappingRelationship
+{
+ protected OrmRelationshipStrategy strategy;
+
+
+ protected AbstractOrmMappingRelationship(M parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateStrategy();
+ }
+
+
+ // ********** strategy **********
+
+ public OrmRelationshipStrategy getStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(OrmRelationshipStrategy strategy) {
+ RelationshipStrategy old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected abstract OrmRelationshipStrategy buildStrategy();
+
+ /**
+ * This is called by subclasses when the various supported strategies are
+ * added or removed; allowing the strategy to be set synchronously. (?)
+ */
+ protected void updateStrategy() {
+ this.setStrategy(this.buildStrategy());
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeFrom(ReadOnlyRelationship oldRelationship) {
+ oldRelationship.initializeOn(this);
+ }
+
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ // NOP
+ }
+
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ // NOP
+ }
+
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ // NOP
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public M getParent() {
+ return (M) super.getParent();
+ }
+
+ public M getMapping() {
+ return this.getParent();
+ }
+
+ protected AbstractXmlRelationshipMapping getXmlMapping() {
+ return this.getMapping().getXmlAttributeMapping();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getMapping().getTypeMapping();
+ }
+
+ public Entity getEntity() {
+ TypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public boolean isOverridable() {
+ return this.strategy.isOverridable();
+ }
+
+ public boolean isVirtual() {
+ return this.getMapping().getPersistentAttribute().isVirtual();
+ }
+
+ public boolean isTargetForeignKey() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getMapping().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
new file mode 100644
index 0000000000..7179f06f50
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
@@ -0,0 +1,813 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMultiRelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.MapKey;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> multi-relationship (1:m, m:m) mapping
+ */
+public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlMultiRelationshipMapping>
+ extends AbstractOrmRelationshipMapping<X>
+ implements OrmMultiRelationshipMapping, OrmCollectionMapping2_0
+{
+ protected final OrmOrderable orderable;
+
+ protected String specifiedMapKey;
+ protected boolean noMapKey = false;
+ protected boolean pkMapKey = false;
+ protected boolean customMapKey = false;
+
+ protected String specifiedMapKeyClass;
+ protected String defaultMapKeyClass;
+
+ protected Type valueType;
+ protected Type keyType;
+
+ protected final OrmColumn mapKeyColumn;
+
+ protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer;
+
+
+ protected AbstractOrmMultiRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.orderable = this.buildOrderable();
+
+ this.specifiedMapKey = this.buildSpecifiedMapKey();
+ this.noMapKey = this.buildNoMapKey();
+ this.pkMapKey = this.buildPkMapKey();
+ this.customMapKey = this.buildCustomMapKey();
+
+ this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
+
+ this.mapKeyColumn = this.buildMapKeyColumn();
+ this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.orderable.synchronizeWithResourceModel();
+
+ this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
+ this.setNoMapKey_(this.buildNoMapKey());
+ this.setPkMapKey_(this.buildPkMapKey());
+ this.setCustomMapKey_(this.buildCustomMapKey());
+
+ this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
+
+ this.mapKeyColumn.synchronizeWithResourceModel();
+
+ this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.orderable.update();
+
+ this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
+
+ this.setValueType(this.buildValueType());
+ this.setKeyType(this.buildKeyType());
+
+ this.mapKeyColumn.update();
+
+ this.mapKeyAttributeOverrideContainer.update();
+ }
+
+
+ // ********** orderable **********
+
+ public OrmOrderable getOrderable() {
+ return this.orderable;
+ }
+
+ protected OrmOrderable buildOrderable() {
+ return this.isJpa2_0Compatible() ?
+ this.getContextNodeFactory2_0().buildOrmOrderable(this, this.buildOrderableOwner()) :
+ this.getContextNodeFactory().buildOrmOrderable(this);
+ }
+
+ protected Orderable2_0.Owner buildOrderableOwner() {
+ return new OrderableOwner();
+ }
+
+ protected class OrderableOwner
+ implements Orderable2_0.Owner
+ {
+ public String getTableName() {
+ return this.getRelationshipStrategy().getTableName();
+ }
+ public Table resolveDbTable(String tableName) {
+ return this.getRelationshipStrategy().resolveDbTable(tableName);
+ }
+ protected OrmRelationshipStrategy getRelationshipStrategy() {
+ return AbstractOrmMultiRelationshipMapping.this.getRelationship().getStrategy();
+ }
+ }
+
+
+ // ********** map key **********
+
+ public String getMapKey() {
+ if (this.noMapKey) {
+ return null;
+ }
+ if (this.pkMapKey) {
+ return this.getTargetEntityIdAttributeName();
+ }
+ if (this.customMapKey) {
+ return this.specifiedMapKey;
+ }
+ throw new IllegalStateException("unknown map key"); //$NON-NLS-1$
+ }
+
+
+ // ********** specified map key **********
+
+ public String getSpecifiedMapKey() {
+ return this.specifiedMapKey;
+ }
+
+ public void setSpecifiedMapKey(String mapKey) {
+ if (mapKey != null) {
+ this.setSpecifiedMapKey_(mapKey);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(true);
+
+ MapKey xmlMapKey = this.getXmlMapKey();
+ if (xmlMapKey == null) {
+ xmlMapKey = this.buildXmlMapKey();
+ }
+ xmlMapKey.setName(mapKey);
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setSpecifiedMapKey_(String mapKey) {
+ String old = this.specifiedMapKey;
+ this.specifiedMapKey = mapKey;
+ this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
+ }
+
+ protected String buildSpecifiedMapKey() {
+ MapKey xmlMapKey = this.getXmlMapKey();
+ return (xmlMapKey == null) ? null : xmlMapKey.getName();
+ }
+
+
+ // ********** no map key **********
+
+ public boolean isNoMapKey() {
+ return this.noMapKey;
+ }
+
+ public void setNoMapKey(boolean noMapKey) {
+ if (noMapKey) {
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(true);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(false);
+
+ if (this.getXmlMapKey() != null) {
+ this.removeXmlMapKey();
+ }
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setNoMapKey_(boolean noMapKey) {
+ boolean old = this.noMapKey;
+ this.noMapKey = noMapKey;
+ this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
+ }
+
+ protected boolean buildNoMapKey() {
+ return this.getXmlMapKey() == null;
+ }
+
+
+ // ********** pk map key **********
+
+ public boolean isPkMapKey() {
+ return this.pkMapKey;
+ }
+
+ public void setPkMapKey(boolean pkMapKey) {
+ if (pkMapKey) {
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(true);
+ this.setCustomMapKey_(false);
+
+ MapKey xmlMapKey = this.getXmlMapKey();
+ if (xmlMapKey == null) {
+ this.buildXmlMapKey();
+ } else {
+ xmlMapKey.setName(null);
+ }
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setPkMapKey_(boolean pkMapKey) {
+ boolean old = this.pkMapKey;
+ this.pkMapKey = pkMapKey;
+ this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
+ }
+
+ protected boolean buildPkMapKey() {
+ MapKey xmlMapKey = this.getXmlMapKey();
+ return (xmlMapKey != null) && (xmlMapKey.getName() == null);
+ }
+
+
+ // ********** custom map key **********
+
+ public boolean isCustomMapKey() {
+ return this.customMapKey;
+ }
+
+ public void setCustomMapKey(boolean customMapKey) {
+ if (customMapKey) {
+ this.setSpecifiedMapKey(""); //$NON-NLS-1$
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setCustomMapKey_(boolean customMapKey) {
+ boolean old = this.customMapKey;
+ this.customMapKey = customMapKey;
+ this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
+ }
+
+ protected boolean buildCustomMapKey() {
+ MapKey xmlMapKey = this.getXmlMapKey();
+ return (xmlMapKey != null) && (xmlMapKey.getName() != null);
+ }
+
+
+ // ********** xml map key **********
+
+ protected MapKey getXmlMapKey() {
+ return this.xmlAttributeMapping.getMapKey();
+ }
+
+ protected MapKey buildXmlMapKey() {
+ MapKey mapKey = OrmFactory.eINSTANCE.createMapKey();
+ this.xmlAttributeMapping.setMapKey(mapKey);
+ return mapKey;
+ }
+
+ protected void removeXmlMapKey() {
+ this.xmlAttributeMapping.setMapKey(null);
+ }
+
+
+ // ********** map key class **********
+
+ public String getMapKeyClass() {
+ return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass;
+ }
+
+ public String getSpecifiedMapKeyClass() {
+ return this.specifiedMapKeyClass;
+ }
+
+ public void setSpecifiedMapKeyClass(String mapKeyClass) {
+ if (this.setSpecifiedMapKeyClass_(mapKeyClass)) {
+ XmlClassReference xmlClassRef = this.xmlAttributeMapping.getMapKeyClass();
+ if (mapKeyClass == null) {
+ if (xmlClassRef != null) {
+ this.xmlAttributeMapping.setMapKeyClass(null);
+ }
+ } else {
+ if (xmlClassRef == null) {
+ xmlClassRef = this.buildXmlMapKeyClassReference();
+ }
+ xmlClassRef.setClassName(mapKeyClass);
+ }
+ }
+ }
+
+ protected boolean setSpecifiedMapKeyClass_(String mapKeyClass) {
+ String old = this.specifiedMapKeyClass;
+ this.specifiedMapKeyClass = mapKeyClass;
+ return this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected XmlClassReference buildXmlMapKeyClassReference() {
+ XmlClassReference mapKeyClass = OrmFactory.eINSTANCE.createXmlClassReference();
+ this.xmlAttributeMapping.setMapKeyClass(mapKeyClass);
+ return mapKeyClass;
+ }
+
+ protected String buildSpecifiedMapKeyClass() {
+ XmlClassReference xmlClassRef = this.xmlAttributeMapping.getMapKeyClass();
+ return (xmlClassRef == null) ? null : xmlClassRef.getClassName();
+ }
+
+ public String getDefaultMapKeyClass() {
+ return this.defaultMapKeyClass;
+ }
+
+ protected void setDefaultMapKeyClass(String mapKeyClass) {
+ String old = this.defaultMapKeyClass;
+ this.defaultMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildDefaultMapKeyClass() {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ return (javaAttribute == null) ? null : javaAttribute.getMultiReferenceMapKeyTypeName();
+ }
+
+ public char getMapKeyClassEnclosingTypeSeparator() {
+ return '$';
+ }
+
+
+ // ********** resolved map key embeddable/entity **********
+
+ protected Embeddable getResolvedMapKeyEmbeddable() {
+ TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping();
+ return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
+ }
+
+ protected Entity getResolvedMapKeyEntity() {
+ TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ protected TypeMapping getResolvedMapKeyTypeMapping() {
+ PersistentType resolvedMapKeyType = this.getResolvedMapKeyType();
+ return (resolvedMapKeyType == null) ? null : resolvedMapKeyType.getMapping();
+ }
+
+ protected PersistentType getResolvedMapKeyType() {
+ return this.resolvePersistentType(this.getMapKeyClass());
+ }
+
+
+ // ********** value type **********
+
+ public Type getValueType() {
+ return this.valueType;
+ }
+
+ protected void setValueType(Type valueType) {
+ Type old = this.valueType;
+ this.valueType = valueType;
+ this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType);
+ }
+
+ protected Type buildValueType() {
+ if (this.getResolvedTargetEntity() != null) {
+ return Type.ENTITY_TYPE;
+ }
+ if (this.getResolvedTargetEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getTargetEntity() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+ protected Embeddable getResolvedTargetEmbeddable() {
+ TypeMapping typeMapping = this.getResolvedTargetTypeMapping();
+ return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
+ }
+
+
+ // ********** key type **********
+
+ public Type getKeyType() {
+ return this.keyType;
+ }
+
+ protected void setKeyType(Type keyType) {
+ Type old = this.keyType;
+ this.keyType = keyType;
+ this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType);
+ }
+
+ protected Type buildKeyType() {
+ if (this.getResolvedMapKeyEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getResolvedMapKeyEntity() != null) {
+ return Type.ENTITY_TYPE;
+ }
+ if (this.getMapKeyClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+
+ // ********** map key column **********
+
+ public OrmColumn getMapKeyColumn() {
+ return this.mapKeyColumn;
+ }
+
+ protected OrmColumn buildMapKeyColumn() {
+ return this.getContextNodeFactory().buildOrmColumn(this, this.buildMapKeyColumnOwner());
+ }
+
+ protected OrmColumn.Owner buildMapKeyColumnOwner() {
+ return new MapKeyColumnOwner();
+ }
+
+ protected XmlColumn getXmlMapKeyColumn() {
+ return this.xmlAttributeMapping.getMapKeyColumn();
+ }
+
+ protected XmlColumn buildXmlMapKeyColumn() {
+ XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
+ this.xmlAttributeMapping.setMapKeyColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ protected void removeXmlMapKeyColumn() {
+ this.xmlAttributeMapping.setMapKeyColumn(null);
+ }
+
+
+ // ********** map key attribute override container **********
+
+ public OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer() {
+ return this.mapKeyAttributeOverrideContainer;
+ }
+
+ protected OrmAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() {
+ return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner());
+ }
+
+ protected OrmAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() {
+ return new MapKeyAttributeOverrideContainerOwner();
+ }
+
+ protected JavaAttributeOverride getSpecifiedJavaMapKeyAttributeOverrideNamed(String attributeName) {
+ JavaCollectionMapping2_0 javaCollectionMapping = this.getJavaCollectionMapping();
+ return (javaCollectionMapping == null) ? null :
+ javaCollectionMapping.getMapKeyAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName);
+ }
+
+ protected JavaCollectionMapping2_0 getJavaCollectionMapping() {
+ AttributeMapping javaAttributeMapping = this.getJavaAttributeMapping();
+ return (javaAttributeMapping.getKey() == this.getKey()) ?
+ (JavaCollectionMapping2_0) javaAttributeMapping :
+ null;
+ }
+
+ protected AttributeMapping getJavaAttributeMapping() {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ return (javaAttribute == null) ? null : javaAttribute.getMapping();
+ }
+
+
+ // ********** misc **********
+
+ /**
+ * pre-condition: the mapping's Java persistent attribute is not
+ * <code>null</code>.
+ */
+ @Override
+ protected String getJavaTargetType() {
+ return this.getJavaPersistentAttribute().getMultiReferenceTargetTypeName();
+ }
+
+ @Override
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+ public Iterator<String> candidateMapKeyNames() {
+ return this.allTargetEntityAttributeNames();
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ protected String getMetamodelFieldTypeName() {
+ return ((OrmPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName();
+ }
+
+ @Override
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames);
+ super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ }
+
+ protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) {
+ String keyTypeName = ((OrmPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName();
+ if (keyTypeName != null) {
+ typeArgumentNames.add(keyTypeName);
+ }
+ }
+
+ public String getMetamodelFieldMapKeyTypeName() {
+ return MappingTools.getMetamodelFieldMapKeyTypeName(this);
+ }
+
+
+ //************* refactoring *************
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createMapKeyClassRenameTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createMapKeyClassRenameTypeEdits(IType originalType, String newName) {
+ if (this.specifiedMapKeyClass != null) {
+ PersistentType mapKeyType = this.getResolvedMapKeyType();
+ if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.createMapKeyClassRenameTypeEdit(originalType, newName));
+ }
+ }
+ return EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createMapKeyClassRenameTypeEdit(IType originalType, String newName) {
+ return this.xmlAttributeMapping.createRenameMapKeyClassEdit(originalType, newName);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createMapKeyClassMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createMapKeyClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ if (this.specifiedMapKeyClass != null) {
+ PersistentType mapKeyType = this.getResolvedMapKeyType();
+ if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.createMapKeyClassRenamePackageEdit(newPackage.getElementName()));
+ }
+ }
+ return EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createMapKeyClassRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createMapKeyClassRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ if (this.specifiedMapKeyClass != null) {
+ PersistentType mapKeyType = this.getResolvedMapKeyType();
+ if ((mapKeyType != null) && mapKeyType.isIn(originalPackage)) {
+ return new SingleElementIterable<ReplaceEdit>(this.createMapKeyClassRenamePackageEdit(newName));
+ }
+ }
+ return EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createMapKeyClassRenamePackageEdit(String newName) {
+ return this.xmlAttributeMapping.createRenameMapKeyClassPackageEdit(newName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.orderable.validate(messages, reporter);
+ this.validateMapKey(messages, reporter);
+ }
+
+ public void validateMapKey(List<IMessage> messages, IReporter reporter) {
+ if (this.getMapKey() != null) {
+ //TODO validate that the map key refers to an existing attribute
+ return;
+ }
+ if (this.keyType == Type.BASIC_TYPE) {
+ this.mapKeyColumn.validate(messages, reporter);
+ //validate map key converter
+ }
+ else if (this.keyType == Type.ENTITY_TYPE) {
+ //validate map key join columns
+ }
+ else if (this.keyType == Type.EMBEDDABLE_TYPE) {
+ this.mapKeyAttributeOverrideContainer.validate(messages, reporter);
+ //validate map key association overrides
+ }
+ }
+
+
+ // ********** abstract owner **********
+
+ /**
+ * some common behavior
+ */
+ protected class AbstractOwner
+ {
+ public OrmTypeMapping getTypeMapping() {
+ return AbstractOrmMultiRelationshipMapping.this.getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ return this.getRelationshipStrategy().getTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getRelationshipStrategy().resolveDbTable(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public TextRange getValidationTextRange() {
+ return AbstractOrmMultiRelationshipMapping.this.getValidationTextRange();
+ }
+
+ protected OrmRelationshipStrategy getRelationshipStrategy() {
+ return AbstractOrmMultiRelationshipMapping.this.getRelationship().getStrategy();
+ }
+
+ protected String getMappingName() {
+ return AbstractOrmMultiRelationshipMapping.this.getName();
+ }
+
+ protected boolean mappingIsVirtual() {
+ return AbstractOrmMultiRelationshipMapping.this.isVirtual();
+ }
+
+ protected OrmPersistentAttribute getPersistentAttribute() {
+ return AbstractOrmMultiRelationshipMapping.this.getPersistentAttribute();
+ }
+ }
+
+
+ // ********** map key column owner **********
+
+ protected class MapKeyColumnOwner
+ extends AbstractOwner
+ implements OrmColumn.Owner
+ {
+ public String getDefaultColumnName() {
+ return this.getMappingName() + "_KEY"; //$NON-NLS-1$
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getRelationshipStrategy().tableNameIsInvalid(tableName);
+ }
+
+ public XmlColumn getXmlColumn() {
+ return AbstractOrmMultiRelationshipMapping.this.getXmlMapKeyColumn();
+ }
+
+ public XmlColumn buildXmlColumn() {
+ return AbstractOrmMultiRelationshipMapping.this.buildXmlMapKeyColumn();
+ }
+
+ public void removeXmlColumn() {
+ AbstractOrmMultiRelationshipMapping.this.removeXmlMapKeyColumn();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy()));
+ }
+ }
+
+
+ // ********** map key attribute override container owner **********
+
+ protected class MapKeyAttributeOverrideContainerOwner
+ extends AbstractOwner
+ implements OrmAttributeOverrideContainer.Owner
+ {
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractOrmMultiRelationshipMapping.this.getResolvedMapKeyEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.<String>instance();
+ }
+
+ protected JavaAttributeOverride getSpecifiedJavaAttributeOverrideNamed(String attributeName) {
+ return AbstractOrmMultiRelationshipMapping.this.getSpecifiedJavaMapKeyAttributeOverrideNamed(attributeName);
+ }
+
+ public EList<XmlAttributeOverride> getXmlOverrides() {
+ return AbstractOrmMultiRelationshipMapping.this.xmlAttributeMapping.getMapKeyAttributeOverrides();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) {
+ JavaAttributeOverride javaOverride = this.getSpecifiedJavaAttributeOverrideNamed(attributeName);
+ if (javaOverride != null) {
+ return javaOverride.getColumn();
+ }
+ }
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ /**
+ * If there is a specified table name it needs to be the same
+ * the default table name. the table is always the collection table
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy()));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java
new file mode 100644
index 0000000000..7bee99543e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn;
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code><ul>
+ * <li>column
+ * <li>join column
+ * <li>discriminator column
+ * <li>order column
+ * <li>primary key join column
+ * </ul>
+ * <strong>NB:</strong> any subclass that directly holds its XML column must:<ul>
+ * <li>call the "super" constructor that takes an XML column
+ * {@link #AbstractOrmNamedColumn(XmlContextNode, OrmNamedColumn.Owner, AbstractXmlNamedColumn)}
+ * <li>override {@link #setXmlColumn(AbstractXmlNamedColumn)} to set the XML column
+ * so it is in place before the column's state (e.g. {@link #specifiedName})
+ * is initialized
+ * </ul>
+ * Typically, a column belonging to a list of columns will directly hold its XML
+ * column; since the context column only exists if the XML column exists.
+ */
+public abstract class AbstractOrmNamedColumn<X extends AbstractXmlNamedColumn, O extends OrmNamedColumn.Owner>
+ extends AbstractOrmXmlContextNode
+ implements OrmNamedColumn
+{
+ protected final O owner;
+
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String columnDefinition;
+
+
+ // ********** constructor/initialization **********
+
+ protected AbstractOrmNamedColumn(XmlContextNode parent, O owner) {
+ this(parent, owner, null);
+ }
+
+ protected AbstractOrmNamedColumn(XmlContextNode parent, O owner, X xmlColumn) {
+ super(parent);
+ this.owner = owner;
+ this.setXmlColumn(xmlColumn);
+ this.specifiedName = this.buildSpecifiedName();
+ this.columnDefinition = this.buildColumnDefinition();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedName_(this.buildSpecifiedName());
+ this.setColumnDefinition_(this.buildColumnDefinition());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultName(this.buildDefaultName());
+ }
+
+
+ // ********** XML column **********
+
+ /**
+ * Return <code>null</code> if XML column does not exists.
+ */
+ public abstract X getXmlColumn();
+
+ /**
+ * see class comment...
+ */
+ protected void setXmlColumn(X xmlColumn) {
+ if (xmlColumn != null) {
+ throw new IllegalArgumentException("this method must be overridden if the XML column is not null: " + xmlColumn); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Build the XML column if it does not exist.
+ */
+ protected X getXmlColumnForUpdate() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn != null) ? xmlColumn : this.buildXmlColumn();
+ }
+
+ protected abstract X buildXmlColumn();
+
+ protected void removeXmlColumnIfUnset() {
+ if (this.getXmlColumn().isUnset()) {
+ this.removeXmlColumn();
+ }
+ }
+
+ protected abstract void removeXmlColumn();
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String name) {
+ if (this.valuesAreDifferent(this.specifiedName, name)) {
+ X xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedName_(name);
+ xmlColumn.setName(name);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedName_(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultName() {
+ return this.owner.getDefaultColumnName();
+ }
+
+
+ // ********** column definition **********
+
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ public void setColumnDefinition(String columnDefinition) {
+ if (this.valuesAreDifferent(this.columnDefinition, columnDefinition)) {
+ X xmlColumn = this.getXmlColumnForUpdate();
+ this.setColumnDefinition_(columnDefinition);
+ xmlColumn.setColumnDefinition(columnDefinition);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setColumnDefinition_(String columnDefinition) {
+ String old = this.columnDefinition;
+ this.columnDefinition = columnDefinition;
+ this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
+ }
+
+ protected String buildColumnDefinition() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getColumnDefinition();
+ }
+
+
+ // ********** database stuff **********
+
+ protected Column getDbColumn() {
+ Table table = this.getDbTable();
+ return (table == null) ? null : table.getColumnForIdentifier(this.getName());
+ }
+
+ public Table getDbTable() {
+ return this.owner.resolveDbTable(this.getTable());
+ }
+
+ /**
+ * Return the name of the column's table. This is overridden in
+ * {@link AbstractOrmBaseColumn} (and other places) where a table can be
+ * defined.
+ */
+ public String getTable() {
+ return this.owner.getTypeMapping().getPrimaryTableName();
+ }
+
+ public boolean isResolved() {
+ return this.getDbColumn() != null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.buildColumnValidator().validate(messages, reporter);
+ }
+
+ protected JptValidator buildColumnValidator() {
+ return this.owner.buildColumnValidator(this, this.buildTextRangeResolver());
+ }
+
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmNamedColumnTextRangeResolver(this);
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getTextRange(this.getXmlColumnTextRange());
+ }
+
+ protected TextRange getXmlColumnTextRange() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getValidationTextRange();
+ }
+
+ public TextRange getNameTextRange() {
+ return this.getTextRange(this.getXmlColumnNameTextRange());
+ }
+
+ protected TextRange getXmlColumnNameTextRange() {
+ X xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getNameTextRange();
+ }
+
+ protected TextRange getTextRange(TextRange textRange) {
+ return (textRange != null) ? textRange : this.owner.getValidationTextRange();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public XmlContextNode getParent() {
+ return (XmlContextNode) super.getParent();
+ }
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ protected void initializeFrom(ReadOnlyNamedColumn oldColumn) {
+ this.setSpecifiedName(oldColumn.getSpecifiedName());
+ this.setColumnDefinition(oldColumn.getColumnDefinition());
+ }
+
+ protected void initializeFromVirtual(ReadOnlyNamedColumn virtualColumn) {
+ this.setSpecifiedName(virtualColumn.getName());
+ this.setColumnDefinition(virtualColumn.getColumnDefinition());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ String table = this.getTable();
+ if (table != null) {
+ sb.append(table);
+ sb.append('.');
+ }
+ sb.append(this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java
new file mode 100644
index 0000000000..3bfa99022a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+
+
+public abstract class AbstractOrmOneToManyMapping<X extends XmlOneToMany>
+ extends AbstractOrmMultiRelationshipMapping<X>
+ implements OrmOneToManyMapping2_0, OrmOrphanRemovalHolder2_0
+{
+ protected final OrmOrphanRemovable2_0 orphanRemoval;
+
+
+ protected AbstractOrmOneToManyMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.orphanRemoval = this.buildOrphanRemoval();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.orphanRemoval.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.orphanRemoval.update();
+ }
+
+
+ // ********** orphan removal **********
+
+ public OrmOrphanRemovable2_0 getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ protected OrmOrphanRemovable2_0 buildOrphanRemoval() {
+ return this.isJpa2_0Compatible() ?
+ this.getContextNodeFactory2_0().buildOrmOrphanRemoval(this) :
+ new NullOrmOrphanRemoval2_0(this);
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ protected OrmOneToManyRelationship2_0 buildRelationship() {
+ return new GenericOrmOneToManyRelationship(this, this.isJpa2_0Compatible());
+ }
+
+ @Override
+ public OrmOneToManyRelationship2_0 getRelationship() {
+ return (OrmOneToManyRelationship2_0) super.getRelationship();
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 50;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmOneToManyMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ resourceAttributes.getOneToManys().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ resourceAttributes.getOneToManys().remove(this.xmlAttributeMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java
new file mode 100644
index 0000000000..5305983e1c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneRelationship2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+
+/**
+ * <code>orm.xml</code> 1:1 mapping
+ */
+public abstract class AbstractOrmOneToOneMapping<X extends XmlOneToOne>
+ extends AbstractOrmSingleRelationshipMapping<X>
+ implements OrmOneToOneMapping2_0, OrmOrphanRemovalHolder2_0
+{
+ protected final OrmOrphanRemovable2_0 orphanRemoval;
+
+
+ protected AbstractOrmOneToOneMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.orphanRemoval = this.buildOrphanRemoval();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.orphanRemoval.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.orphanRemoval.update();
+ }
+
+
+ // ********** orphan removal **********
+
+ public OrmOrphanRemovable2_0 getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ protected OrmOrphanRemovable2_0 buildOrphanRemoval() {
+ return this.isJpa2_0Compatible() ?
+ this.getContextNodeFactory2_0().buildOrmOrphanRemoval(this) :
+ new NullOrmOrphanRemoval2_0(this);
+ }
+
+
+ // ********** relationship **********
+
+ @Override
+ public OrmOneToOneRelationship2_0 getRelationship() {
+ return (OrmOneToOneRelationship2_0) super.getRelationship();
+ }
+
+ @Override
+ protected OrmMappingRelationship buildRelationship() {
+ return new GenericOrmOneToOneRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 60;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmOneToOneMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ resourceAttributes.getOneToOnes().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ resourceAttributes.getOneToOnes().remove(this.xmlAttributeMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java
new file mode 100644
index 0000000000..df72433811
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Vector;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.QueryHint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
+
+/**
+ * <code>orm.xml</code> query
+ */
+public abstract class AbstractOrmQuery<X extends XmlQuery>
+ extends AbstractOrmXmlContextNode
+ implements OrmQuery
+{
+ protected final X xmlQuery;
+
+ protected String name;
+
+ protected String query;
+
+ protected final Vector<OrmQueryHint> hints = new Vector<OrmQueryHint>();
+ protected final HintContainerAdapter hintContainerAdapter = new HintContainerAdapter();
+
+
+ protected AbstractOrmQuery(XmlContextNode parent, X xmlQuery) {
+ super(parent);
+ this.xmlQuery = xmlQuery;
+ this.name = xmlQuery.getName();
+ this.query = xmlQuery.getQuery();
+ this.initializeHints();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.xmlQuery.getName());
+ this.setQuery_(this.xmlQuery.getQuery());
+ this.syncHints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getHints());
+ this.getPersistenceUnit().addQuery(this);
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.setName_(name);
+ this.xmlQuery.setName(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** query **********
+
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String query) {
+ this.setQuery_(query);
+ this.xmlQuery.setQuery(query);
+ }
+
+ protected void setQuery_(String query) {
+ String old = this.query;
+ this.query = query;
+ this.firePropertyChanged(QUERY_PROPERTY, old, query);
+ }
+
+
+ // ********** hints **********
+
+ public ListIterable<OrmQueryHint> getHints() {
+ return new LiveCloneListIterable<OrmQueryHint>(this.hints);
+ }
+
+ public int getHintsSize() {
+ return this.hints.size();
+ }
+
+ public OrmQueryHint addHint() {
+ return this.addHint(this.hints.size());
+ }
+
+ public OrmQueryHint addHint(int index) {
+ XmlQueryHint xmlHint = this.buildXmlQueryHint();
+ OrmQueryHint hint = this.addHint_(index, xmlHint);
+ this.xmlQuery.getHints().add(index, xmlHint);
+ return hint;
+ }
+
+ protected XmlQueryHint buildXmlQueryHint() {
+ return OrmFactory.eINSTANCE.createXmlQueryHint();
+ }
+
+ public void removeHint(QueryHint hint) {
+ this.removeHint(this.hints.indexOf(hint));
+ }
+
+ public void removeHint(int index) {
+ this.removeHint_(index);
+ this.xmlQuery.getHints().remove(index);
+ }
+
+ protected void removeHint_(int index) {
+ this.removeItemFromList(index, this.hints, HINTS_LIST);
+ }
+
+ public void moveHint(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.hints, HINTS_LIST);
+ this.xmlQuery.getHints().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeHints() {
+ for (XmlQueryHint xmlHint : this.getXmlHints()) {
+ this.hints.add(this.buildHint(xmlHint));
+ }
+ }
+
+ protected OrmQueryHint buildHint(XmlQueryHint xmlHint) {
+ return this.getContextNodeFactory().buildOrmQueryHint(this, xmlHint);
+ }
+
+ protected void syncHints() {
+ ContextContainerTools.synchronizeWithResourceModel(this.hintContainerAdapter);
+ }
+
+ protected Iterable<XmlQueryHint> getXmlHints() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlQueryHint>(this.xmlQuery.getHints());
+ }
+
+ protected void moveHint_(int index, OrmQueryHint hint) {
+ this.moveItemInList(index, hint, this.hints, HINTS_LIST);
+ }
+
+ protected OrmQueryHint addHint_(int index, XmlQueryHint xmlHint) {
+ OrmQueryHint hint = this.buildHint(xmlHint);
+ this.addItemToList(index, hint, this.hints, HINTS_LIST);
+ return hint;
+ }
+
+ protected void removeHint_(OrmQueryHint hint) {
+ this.removeHint_(this.hints.indexOf(hint));
+ }
+
+ /**
+ * hint container adapter
+ */
+ protected class HintContainerAdapter
+ implements ContextContainerTools.Adapter<OrmQueryHint, XmlQueryHint>
+ {
+ public Iterable<OrmQueryHint> getContextElements() {
+ return AbstractOrmQuery.this.getHints();
+ }
+ public Iterable<XmlQueryHint> getResourceElements() {
+ return AbstractOrmQuery.this.getXmlHints();
+ }
+ public XmlQueryHint getResourceElement(OrmQueryHint contextElement) {
+ return contextElement.getXmlQueryHint();
+ }
+ public void moveContextElement(int index, OrmQueryHint element) {
+ AbstractOrmQuery.this.moveHint_(index, element);
+ }
+ public void addContextElement(int index, XmlQueryHint resourceElement) {
+ AbstractOrmQuery.this.addHint_(index, resourceElement);
+ }
+ public void removeContextElement(OrmQueryHint element) {
+ AbstractOrmQuery.this.removeHint_(element);
+ }
+ }
+
+
+ // ********** misc **********
+
+ public X getXmlQuery() {
+ return this.xmlQuery;
+ }
+
+ public boolean overrides(Query other) {
+ return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST);
+ }
+
+ public boolean duplicates(Query other) {
+ return MappingTools.nodesAreDuplicates(this, other);
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.xmlQuery.getValidationTextRange();
+ }
+
+ public TextRange getNameTextRange() {
+ return this.xmlQuery.getNameTextRange();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java
new file mode 100644
index 0000000000..caa97f18dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyUniqueConstraint;
+
+public abstract class AbstractOrmReadOnlyUniqueConstraint
+ extends AbstractOrmXmlContextNode
+ implements OrmReadOnlyUniqueConstraint
+{
+ protected final Vector<String> columnNames = new Vector<String>();
+
+
+ public AbstractOrmReadOnlyUniqueConstraint(XmlContextNode parent) {
+ super(parent);
+ }
+
+
+ // ********** column names **********
+
+ public Iterable<String> getColumnNames() {
+ return new LiveCloneListIterable<String>(this.columnNames);
+ }
+
+ public int getColumnNamesSize() {
+ return this.columnNames.size();
+ }
+
+ public String getColumnName(int index) {
+ return this.columnNames.get(index);
+ }
+
+ protected void syncColumnNames() {
+ this.synchronizeList(this.getResourceColumnNames(), this.columnNames, COLUMN_NAMES_LIST);
+ }
+
+ protected abstract Iterable<String> getResourceColumnNames();
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.columnNames);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
new file mode 100644
index 0000000000..9382f0a57f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
@@ -0,0 +1,418 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmCascade;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmCascade;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> relationship mapping (1:1, 1:m, m:1, m:m)
+ */
+public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelationshipMapping>
+ extends AbstractOrmAttributeMapping<X>
+ implements OrmRelationshipMapping
+{
+ protected String specifiedTargetEntity;
+ protected String defaultTargetEntity;
+
+ protected final OrmMappingRelationship relationship;
+
+ protected final OrmCascade cascade;
+
+ protected FetchType specifiedFetch;
+ protected FetchType defaultFetch;
+
+
+ protected AbstractOrmRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.specifiedTargetEntity = xmlMapping.getTargetEntity();
+ this.relationship = this.buildRelationship();
+ this.cascade = this.buildCascade();
+ this.specifiedFetch = this.buildSpecifiedFetch();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTargetEntity_(this.xmlAttributeMapping.getTargetEntity());
+ this.relationship.synchronizeWithResourceModel();
+ this.cascade.synchronizeWithResourceModel();
+ this.setSpecifiedFetch_(this.buildSpecifiedFetch());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
+ this.relationship.update();
+ this.cascade.update();
+ this.setDefaultFetch(this.buildDefaultFetch());
+ }
+
+
+ // ********** target entity **********
+
+ public String getTargetEntity() {
+ return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
+ }
+
+ public String getSpecifiedTargetEntity() {
+ return this.specifiedTargetEntity;
+ }
+
+ public void setSpecifiedTargetEntity(String entity) {
+ this.setSpecifiedTargetEntity_(entity);
+ this.xmlAttributeMapping.setTargetEntity(entity);
+ }
+
+ protected void setSpecifiedTargetEntity_(String entity) {
+ String old = this.specifiedTargetEntity;
+ this.specifiedTargetEntity = entity;
+ this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity);
+ }
+
+ public String getDefaultTargetEntity() {
+ return this.defaultTargetEntity;
+ }
+
+ protected void setDefaultTargetEntity(String entity) {
+ String old = this.defaultTargetEntity;
+ this.defaultTargetEntity = entity;
+ this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity);
+ }
+
+ protected String buildDefaultTargetEntity() {
+ return (this.getJavaPersistentAttribute() == null) ? null : this.getJavaTargetType();
+ }
+
+ /**
+ * pre-condition: the mapping's Java persistent attribute is not
+ * <code>null</code>.
+ */
+ protected abstract String getJavaTargetType();
+
+ public Entity getResolvedTargetEntity() {
+ TypeMapping typeMapping = this.getResolvedTargetTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ protected TypeMapping getResolvedTargetTypeMapping() {
+ PersistentType resolvedTargetType = this.getResolvedTargetType();
+ return (resolvedTargetType == null) ? null : resolvedTargetType.getMapping();
+ }
+
+ // sub-classes like this to be public
+ public PersistentType getResolvedTargetType() {
+ return this.resolvePersistentType(this.getTargetEntity());
+ }
+
+ public char getTargetEntityEnclosingTypeSeparator() {
+ return '$';
+ }
+
+
+ // ********** relationship reference **********
+
+ public OrmMappingRelationship getRelationship() {
+ return this.relationship;
+ }
+
+ protected abstract OrmMappingRelationship buildRelationship();
+
+
+ // ********** cascade **********
+
+ public OrmCascade getCascade() {
+ return this.cascade;
+ }
+
+ protected OrmCascade buildCascade() {
+ // NB: we don't use the platform
+ return new GenericOrmCascade(this);
+ }
+
+
+ // ********** fetch **********
+
+ public FetchType getFetch() {
+ return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType fetch) {
+ this.setSpecifiedFetch_(fetch);
+ this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch));
+ }
+
+ protected void setSpecifiedFetch_(FetchType fetch) {
+ FetchType old = this.specifiedFetch;
+ this.specifiedFetch = fetch;
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildSpecifiedFetch() {
+ return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch());
+ }
+
+ public FetchType getDefaultFetch() {
+ return this.defaultFetch;
+ }
+
+ protected void setDefaultFetch(FetchType fetch) {
+ FetchType old = this.defaultFetch;
+ this.defaultFetch = fetch;
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected abstract FetchType buildDefaultFetch();
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isRelationshipOwner() {
+ return this.relationship.isOwner();
+ }
+
+ @Override
+ public boolean isOwnedBy(AttributeMapping mapping) {
+ return mapping.isRelationshipOwner() &&
+ this.relationship.isOwnedBy((RelationshipMapping) mapping);
+ }
+
+ public RelationshipMapping getRelationshipOwner() {
+ Entity entity = this.getResolvedTargetEntity();
+ if (entity == null) {
+ return null;
+ }
+ for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(entity.getPersistentType().allAttributes())) {
+ AttributeMapping mapping = attribute.getMapping();
+ if (this.isOwnedBy(mapping)) {
+ return (RelationshipMapping) mapping;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isOverridableAssociationMapping() {
+ return this.relationship.isOverridable();
+ }
+
+ @Override
+ protected void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) {
+ super.initializeFromOrmRelationshipMapping(oldMapping);
+ this.setSpecifiedTargetEntity(oldMapping.getSpecifiedTargetEntity());
+ this.setSpecifiedFetch(oldMapping.getSpecifiedFetch());
+ oldMapping.getRelationship().initializeOn(this.relationship);
+ this.cascade.initializeFrom(oldMapping.getCascade());
+ //TODO should we set the fetch type from a BasicMapping??
+ }
+
+ public Iterator<String> allTargetEntityAttributeNames() {
+ return new CompositeIterator<String>(this.allTargetEntityAttributeNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> allTargetEntityAttributeNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.allTargetEntityAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<AttributeMapping> allTargetEntityAttributeMappings() {
+ Entity entity = this.getResolvedTargetEntity();
+ return (entity != null) ? entity.allAttributeMappings() : EmptyIterator.<AttributeMapping>instance();
+ }
+
+ protected String getTargetEntityIdAttributeName() {
+ PersistentAttribute attribute = this.getTargetEntityIdAttribute();
+ return (attribute == null) ? null : attribute.getName();
+ }
+
+ protected PersistentAttribute getTargetEntityIdAttribute() {
+ Entity entity = this.getResolvedTargetEntity();
+ return (entity == null) ? null : entity.getIdAttribute();
+ }
+
+
+ //************ refactoring ************
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createTargetEntityRenameTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createTargetEntityRenameTypeEdits(IType originalType, String newName) {
+ if (this.specifiedTargetEntity != null) {
+ PersistentType targetType = this.getResolvedTargetType();
+ if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.createTargetEntityRenameTypeEdit(originalType, newName));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected ReplaceEdit createTargetEntityRenameTypeEdit(IType originalType, String newName) {
+ return this.xmlAttributeMapping.createRenameTargetEntityEdit(originalType, newName);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createTargetEntityMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createTargetEntityMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ if (this.specifiedTargetEntity != null) {
+ PersistentType targetType = this.getResolvedTargetType();
+ if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.createTargetEntityRenamePackageEdit(newPackage.getElementName()));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createTargetEntityRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createTargetEntityRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ if (this.specifiedTargetEntity != null) {
+ PersistentType targetType = this.getResolvedTargetType();
+ if ((targetType != null) && targetType.isIn(originalPackage)) {
+ return new SingleElementIterable<ReplaceEdit>(this.createTargetEntityRenamePackageEdit(newName));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected ReplaceEdit createTargetEntityRenamePackageEdit(String newName) {
+ return this.xmlAttributeMapping.createRenameTargetEntityPackageEdit(newName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateTargetEntity(messages);
+ this.relationship.validate(messages, reporter);
+ }
+
+ protected void validateTargetEntity(List<IMessage> messages) {
+ if (this.getTargetEntity() == null) {
+ String msg = this.isVirtual() ?
+ JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED :
+ JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED;
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msg,
+ new String[] {this.name},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ else if (this.getResolvedTargetEntity() == null) {
+ if (this.isVirtual()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY,
+ new String[] {this.name, this.getTargetEntity()},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ } else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY,
+ new String[] {this.getTargetEntity(), this.name},
+ this,
+ this.getTargetEntityTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ protected TextRange getTextRange(TextRange textRange) {
+ return (textRange != null) ? textRange : this.getPersistentAttribute().getValidationTextRange();
+ }
+
+ protected TextRange getTargetEntityTextRange() {
+ return this.getTextRange(this.xmlAttributeMapping.getTargetEntityTextRange());
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ public String getMetamodelTypeName() {
+ PersistentType resolvedTargetType = this.getResolvedTargetType();
+ if (resolvedTargetType == null) {
+ return MetamodelField.DEFAULT_TYPE_NAME;
+ }
+ String targetTypeName = resolvedTargetType.getName();
+ return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java
new file mode 100644
index 0000000000..ee4611f4f6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+
+/**
+ * <code>orm.xml</code> sequence generator
+ */
+public abstract class AbstractOrmSequenceGenerator
+ extends AbstractOrmGenerator<XmlSequenceGenerator>
+ implements OrmSequenceGenerator
+{
+ protected String specifiedSequenceName;
+ protected String defaultSequenceName;
+
+
+ protected AbstractOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) {
+ super(parent, xmlSequenceGenerator);
+ this.specifiedSequenceName = xmlSequenceGenerator.getSequenceName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedSequenceName_(this.xmlGenerator.getSequenceName());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultSequenceName(this.buildDefaultSequenceName());
+ }
+
+
+ // ********** initial value **********
+
+ @Override
+ protected int buildDefaultInitialValue() {
+ return DEFAULT_INITIAL_VALUE;
+ }
+
+
+ // ********** sequence name **********
+
+ public String getSequenceName() {
+ return (this.specifiedSequenceName != null) ? this.specifiedSequenceName : this.defaultSequenceName;
+ }
+
+ public String getSpecifiedSequenceName() {
+ return this.specifiedSequenceName;
+ }
+
+ public void setSpecifiedSequenceName(String specifiedSequenceName) {
+ this.setSpecifiedSequenceName_(specifiedSequenceName);
+ this.xmlGenerator.setSequenceName(specifiedSequenceName);
+ }
+
+ protected void setSpecifiedSequenceName_(String specifiedSequenceName) {
+ String old = this.specifiedSequenceName;
+ this.specifiedSequenceName = specifiedSequenceName;
+ this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, specifiedSequenceName);
+ }
+
+ public String getDefaultSequenceName() {
+ return this.defaultSequenceName;
+ }
+
+ protected void setDefaultSequenceName(String defaultSequenceName) {
+ String old = this.defaultSequenceName;
+ this.defaultSequenceName = defaultSequenceName;
+ this.firePropertyChanged(DEFAULT_SEQUENCE_NAME_PROPERTY, old, defaultSequenceName);
+ }
+
+ protected String buildDefaultSequenceName() {
+ return null; // TODO the default sequence name is determined by the runtime provider...
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
new file mode 100644
index 0000000000..fd744c2e1d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSingleRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> single relationship mapping (1:1, m:1)
+ */
+public abstract class AbstractOrmSingleRelationshipMapping<X extends AbstractXmlSingleRelationshipMapping>
+ extends AbstractOrmRelationshipMapping<X>
+ implements OrmSingleRelationshipMapping2_0
+{
+ protected Boolean specifiedOptional;
+ protected boolean defaultOptional;
+
+ protected final OrmDerivedIdentity2_0 derivedIdentity;
+
+
+ protected AbstractOrmSingleRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.specifiedOptional = xmlMapping.getOptional();
+ this.derivedIdentity = this.buildDerivedIdentity();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedOptional_(this.xmlAttributeMapping.getOptional());
+ this.derivedIdentity.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultOptional(this.buildDefaultOptional());
+ this.derivedIdentity.update();
+ }
+
+
+ // ********** optional **********
+
+ public boolean isOptional() {
+ return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.defaultOptional;
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean optional) {
+ this.setSpecifiedOptional_(optional);
+ this.xmlAttributeMapping.setOptional(optional);
+ }
+
+ protected void setSpecifiedOptional_(Boolean optional) {
+ Boolean old = this.specifiedOptional;
+ this.specifiedOptional = optional;
+ this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ public boolean isDefaultOptional() {
+ return this.defaultOptional;
+ }
+
+ protected void setDefaultOptional(boolean optional) {
+ boolean old = this.defaultOptional;
+ this.defaultOptional = optional;
+ this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional);
+ }
+
+ protected boolean buildDefaultOptional() {
+ return DEFAULT_OPTIONAL;
+ }
+
+
+ // ********** derived identity **********
+
+ public OrmDerivedIdentity2_0 getDerivedIdentity() {
+ return this.derivedIdentity;
+ }
+
+ protected OrmDerivedIdentity2_0 buildDerivedIdentity() {
+ return this.isJpa2_0Compatible() ?
+ this.getContextNodeFactory2_0().buildOrmDerivedIdentity(this) :
+ new NullOrmDerivedIdentity2_0(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
+ super.initializeFromOrmSingleRelationshipMapping(oldMapping);
+ if (this.isJpa2_0Compatible()) {
+ this.derivedIdentity.initializeFrom(((OrmSingleRelationshipMapping2_0) oldMapping).getDerivedIdentity());
+ }
+ }
+
+ /**
+ * pre-condition: the mapping's Java persistent attribute is not
+ * <code>null</code>.
+ */
+ @Override
+ protected String getJavaTargetType() {
+ return this.getJavaPersistentAttribute().getSingleReferenceTargetTypeName();
+ }
+
+ @Override
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.derivedIdentity.validate(messages, reporter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java
new file mode 100644
index 0000000000..c7d5a9e302
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java
@@ -0,0 +1,541 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.NameTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> table, secondary table, join table, or collection table
+ * <p>
+ * <strong>NB:</strong> any subclass that directly holds its XML table must:<ul>
+ * <li>call the "super" constructor that takes an XML table
+ * {@link #AbstractOrmTable(XmlContextNode, Owner, AbstractXmlTable)}
+ * <li>override {@link #setXmlTable(AbstractXmlTable)} to set the XML table
+ * so it is in place before the table's state (e.g. {@link #specifiedName})
+ * is initialized
+ * </ul>
+ */
+public abstract class AbstractOrmTable<X extends AbstractXmlTable>
+ extends AbstractOrmXmlContextNode
+ implements OrmTable, UniqueConstraint.Owner
+{
+ protected final Owner owner;
+
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected final Vector<OrmUniqueConstraint> uniqueConstraints = new Vector<OrmUniqueConstraint>();
+ protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+
+
+ // ********** constructor/initialization **********
+
+ protected AbstractOrmTable(XmlContextNode parent, Owner owner) {
+ this(parent, owner, null);
+ }
+
+ protected AbstractOrmTable(XmlContextNode parent, Owner owner, X xmlTable) {
+ super(parent);
+ this.owner = owner;
+ this.setXmlTable(xmlTable);
+ this.specifiedName = this.buildSpecifiedName();
+ this.specifiedSchema = this.buildSpecifiedSchema();
+ this.specifiedCatalog = this.buildSpecifiedCatalog();
+ this.initializeUniqueContraints();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedName_(this.buildSpecifiedName());
+ this.setSpecifiedSchema_(this.buildSpecifiedSchema());
+ this.setSpecifiedCatalog_(this.buildSpecifiedCatalog());
+ this.syncUniqueConstraints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultName(this.buildDefaultName());
+ this.setDefaultSchema(this.buildDefaultSchema());
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.updateNodes(this.getUniqueConstraints());
+ }
+
+
+ // ********** XML table **********
+
+ /**
+ * Return null if XML table does not exists.
+ */
+ protected abstract X getXmlTable();
+
+ /**
+ * see class comment...
+ */
+ protected void setXmlTable(X xmlTable) {
+ if (xmlTable != null) {
+ throw new IllegalArgumentException("this method must be overridden if the XML table is not null: " + xmlTable); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Build the XML table if it does not exist.
+ */
+ protected X getXmlTableForUpdate() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable != null) ? xmlTable : this.buildXmlTable();
+ }
+
+ protected abstract X buildXmlTable();
+
+ protected void removeXmlTableIfUnset() {
+ if (this.getXmlTable().isUnset()) {
+ this.removeXmlTable();
+ }
+ }
+
+ protected abstract void removeXmlTable();
+
+ public boolean isSpecifiedInResource() {
+ return this.getXmlTable() != null;
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String name) {
+ if (this.valuesAreDifferent(this.specifiedName, name)) {
+ X xmlTable = this.getXmlTableForUpdate();
+ this.setSpecifiedName_(name);
+ xmlTable.setName(name);
+ this.removeXmlTableIfUnset();
+ }
+ }
+
+ protected void setSpecifiedName_(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ? null : xmlTable.getName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected abstract String buildDefaultName();
+
+
+ // ********** schema **********
+
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ if (this.valuesAreDifferent(this.specifiedSchema, schema)) {
+ X xmlTable = this.getXmlTableForUpdate();
+ this.setSpecifiedSchema_(schema);
+ xmlTable.setSchema(schema);
+ this.removeXmlTableIfUnset();
+ }
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildSpecifiedSchema() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ? null : xmlTable.getSchema();
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected abstract String buildDefaultSchema();
+
+
+ // ********** catalog **********
+
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ if (this.valuesAreDifferent(this.specifiedCatalog, catalog)) {
+ X xmlTable = this.getXmlTableForUpdate();
+ this.setSpecifiedCatalog_(catalog);
+ xmlTable.setCatalog(catalog);
+ this.removeXmlTableIfUnset();
+ }
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildSpecifiedCatalog() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ? null : xmlTable.getCatalog();
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected abstract String buildDefaultCatalog();
+
+
+ // ********** unique constraints **********
+
+ public ListIterator<OrmUniqueConstraint> uniqueConstraints() {
+ return this.getUniqueConstraints().iterator();
+ }
+
+ protected ListIterable<OrmUniqueConstraint> getUniqueConstraints() {
+ return new LiveCloneListIterable<OrmUniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public OrmUniqueConstraint getUniqueConstraint(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public OrmUniqueConstraint addUniqueConstraint() {
+ return this.addUniqueConstraint(this.uniqueConstraints.size());
+ }
+
+ public OrmUniqueConstraint addUniqueConstraint(int index) {
+ X xmlTable = this.getXmlTableForUpdate();
+ XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint();
+ OrmUniqueConstraint constraint = this.addUniqueConstraint_(index, xmlConstraint);
+ xmlTable.getUniqueConstraints().add(index, xmlConstraint);
+ return constraint;
+ }
+
+ protected XmlUniqueConstraint buildXmlUniqueConstraint() {
+ return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
+ }
+
+ public void removeUniqueConstraint(UniqueConstraint constraint) {
+ this.removeUniqueConstraint(this.uniqueConstraints.indexOf(constraint));
+ }
+
+ public void removeUniqueConstraint(int index) {
+ this.removeUniqueConstraint_(index);
+ this.getXmlTable().getUniqueConstraints().remove(index);
+ this.removeXmlTableIfUnset();
+ }
+
+ protected void removeUniqueConstraint_(int index) {
+ this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.getXmlTable().getUniqueConstraints().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeUniqueContraints() {
+ for (XmlUniqueConstraint xmlConstraint : this.getXmlUniqueConstraints()) {
+ this.uniqueConstraints.add(this.buildUniqueConstraint(xmlConstraint));
+ }
+ }
+
+ protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint xmlConstraint) {
+ return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, xmlConstraint);
+ }
+
+ protected void syncUniqueConstraints() {
+ ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
+ }
+
+ protected Iterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ?
+ EmptyIterable.<XmlUniqueConstraint>instance() :
+ // clone to reduce chance of concurrency problems
+ new LiveCloneIterable<XmlUniqueConstraint>(xmlTable.getUniqueConstraints());
+ }
+
+ protected void moveUniqueConstraint_(int index, OrmUniqueConstraint constraint) {
+ this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected OrmUniqueConstraint addUniqueConstraint_(int index, XmlUniqueConstraint xmlConstraint) {
+ OrmUniqueConstraint constraint = this.buildUniqueConstraint(xmlConstraint);
+ this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ return constraint;
+ }
+
+ protected void removeUniqueConstraint_(OrmUniqueConstraint constraint) {
+ this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(constraint));
+ }
+
+ /**
+ * unique constraint container adapter
+ */
+ protected class UniqueConstraintContainerAdapter
+ implements ContextContainerTools.Adapter<OrmUniqueConstraint, XmlUniqueConstraint>
+ {
+ public Iterable<OrmUniqueConstraint> getContextElements() {
+ return AbstractOrmTable.this.getUniqueConstraints();
+ }
+ public Iterable<XmlUniqueConstraint> getResourceElements() {
+ return AbstractOrmTable.this.getXmlUniqueConstraints();
+ }
+ public XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
+ return contextElement.getXmlUniqueConstraint();
+ }
+ public void moveContextElement(int index, OrmUniqueConstraint element) {
+ AbstractOrmTable.this.moveUniqueConstraint_(index, element);
+ }
+ public void addContextElement(int index, XmlUniqueConstraint resourceElement) {
+ AbstractOrmTable.this.addUniqueConstraint_(index, resourceElement);
+ }
+ public void removeContextElement(OrmUniqueConstraint element) {
+ AbstractOrmTable.this.removeUniqueConstraint_(element);
+ }
+ }
+
+
+ // ********** database stuff **********
+
+ public org.eclipse.jpt.jpa.db.Table getDbTable() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
+ }
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ public boolean isResolved() {
+ return this.getDbTable() != null;
+ }
+
+ public boolean schemaIsResolved() {
+ return this.getDbSchema() != null;
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public boolean catalogIsResolved() {
+ String catalog = this.getCatalog();
+ return (catalog == null) || (this.resolveDbCatalog(catalog) != null);
+ }
+
+
+ // ********** UniqueConstraint.Owner implementation **********
+
+ public Iterator<String> candidateUniqueConstraintColumnNames() {
+ org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
+ return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.<String>instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.buildTableValidator().validate(messages, reporter);
+ }
+
+ protected JptValidator buildTableValidator() {
+ return this.owner.buildTableValidator(this, this.buildTextRangeResolver());
+ }
+
+ protected TableTextRangeResolver buildTextRangeResolver() {
+ return new OrmTableTextRangeResolver(this);
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getTextRange(this.getXmlTableValidationTextRange());
+ }
+
+ protected TextRange getXmlTableValidationTextRange() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ? null : xmlTable.getValidationTextRange();
+ }
+
+ public TextRange getNameTextRange() {
+ return this.getTextRange(this.getXmlTableNameTextRange());
+ }
+
+ protected TextRange getXmlTableNameTextRange() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ? null : xmlTable.getNameTextRange();
+ }
+
+ public TextRange getSchemaTextRange() {
+ return this.getTextRange(this.getXmlTableSchemaTextRange());
+ }
+
+ protected TextRange getXmlTableSchemaTextRange() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ? null : xmlTable.getSchemaTextRange();
+ }
+
+ public TextRange getCatalogTextRange() {
+ return this.getTextRange(this.getXmlTableCatalogTextRange());
+ }
+
+ protected TextRange getXmlTableCatalogTextRange() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ? null : xmlTable.getCatalogTextRange();
+ }
+
+ protected TextRange getTextRange(TextRange textRange) {
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
+ }
+
+
+ // ********** misc **********
+
+ /**
+ * covariant override
+ */
+ @Override
+ public XmlContextNode getParent() {
+ return (XmlContextNode) super.getParent();
+ }
+
+ protected void initializeFrom(ReadOnlyTable oldTable) {
+ this.setSpecifiedName(oldTable.getSpecifiedName());
+ this.setSpecifiedCatalog(oldTable.getSpecifiedCatalog());
+ this.setSpecifiedSchema(oldTable.getSpecifiedSchema());
+ for (ReadOnlyUniqueConstraint constraint : CollectionTools.iterable(oldTable.uniqueConstraints())) {
+ this.addUniqueConstraint().initializeFrom(constraint);
+ }
+ }
+
+ protected void initializeFromVirtual(ReadOnlyTable virtualTable) {
+ this.setSpecifiedName(virtualTable.getName());
+ // ignore other settings?
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.buildQualifiedName());
+ }
+
+ protected String buildQualifiedName() {
+ return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
new file mode 100644
index 0000000000..13f8643112
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
@@ -0,0 +1,482 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> type mapping
+ */
+public abstract class AbstractOrmTypeMapping<X extends XmlTypeMapping>
+ extends AbstractOrmXmlContextNode
+ implements OrmTypeMapping
+{
+ protected final X xmlTypeMapping;
+
+ protected String class_;
+
+ protected Boolean specifiedMetadataComplete;
+ protected boolean overrideMetadataComplete;
+
+
+ protected AbstractOrmTypeMapping(OrmPersistentType parent, X xmlTypeMapping) {
+ super(parent);
+ this.xmlTypeMapping = xmlTypeMapping;
+ this.class_ = xmlTypeMapping.getClassName();
+ this.specifiedMetadataComplete = xmlTypeMapping.getMetadataComplete();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setClass_(this.xmlTypeMapping.getClassName());
+ this.setSpecifiedMetadataComplete_(this.xmlTypeMapping.getMetadataComplete());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setOverrideMetadataComplete(this.buildOverrideMetadataComplete());
+ }
+
+
+ // ********** class **********
+
+ public String getClass_() {
+ return this.class_;
+ }
+
+ public void setClass(String class_) {
+ this.setClass_(class_);
+ this.xmlTypeMapping.setClassName(class_);
+ }
+
+ protected void setClass_(String class_) {
+ String old = this.class_;
+ this.class_ = class_;
+ if (this.firePropertyChanged(CLASS_PROPERTY, old, class_)) {
+ this.getPersistentType().mappingClassChanged(old, class_);
+ }
+ }
+
+
+ // ********** metadata complete **********
+
+ /**
+ * If <code>entity-mappings/persistence-unit-metadata/xml-mapping-metadata-complete</code>
+ * is specified, it overrides anything set here.
+ */
+ public boolean isMetadataComplete() {
+ if (this.overrideMetadataComplete) {
+ return true;
+ }
+ return (this.specifiedMetadataComplete != null) ? this.specifiedMetadataComplete.booleanValue() : false;
+ }
+
+ public Boolean getSpecifiedMetadataComplete() {
+ return this.specifiedMetadataComplete;
+ }
+
+ public void setSpecifiedMetadataComplete(Boolean metadataComplete) {
+ this.setSpecifiedMetadataComplete_(metadataComplete);
+ this.xmlTypeMapping.setMetadataComplete(metadataComplete);
+ }
+
+ protected void setSpecifiedMetadataComplete_(Boolean metadataComplete) {
+ Boolean old = this.specifiedMetadataComplete;
+ this.specifiedMetadataComplete = metadataComplete;
+ this.firePropertyChanged(SPECIFIED_METADATA_COMPLETE_PROPERTY, old, metadataComplete);
+ }
+
+ public boolean isOverrideMetadataComplete() {
+ return this.overrideMetadataComplete;
+ }
+
+ protected void setOverrideMetadataComplete(boolean metadataComplete) {
+ boolean old = this.overrideMetadataComplete;
+ this.overrideMetadataComplete = metadataComplete;
+ this.firePropertyChanged(OVERRIDE_METADATA_COMPLETE_PROPERTY, old, metadataComplete);
+ }
+
+ protected boolean buildOverrideMetadataComplete() {
+ return this.getPersistenceUnit().isXmlMappingMetadataComplete();
+ }
+
+
+ // ********** Java type mapping **********
+
+ public JavaTypeMapping getJavaTypeMapping() {
+ JavaPersistentType javaType = this.getJavaPersistentType();
+ if (javaType == null) {
+ return null;
+ }
+ return (javaType.getMappingKey() == this.getKey()) ? javaType.getMapping() : null;
+ }
+
+ public JavaTypeMapping getJavaTypeMappingForDefaults() {
+ return this.isMetadataComplete() ? null : this.getJavaTypeMapping();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmPersistentType getParent() {
+ return (OrmPersistentType) super.getParent();
+ }
+
+ public OrmPersistentType getPersistentType() {
+ return this.getParent();
+ }
+
+ public String getName() {
+ return this.getPersistentType().getName();
+ }
+
+ protected JavaPersistentType getJavaPersistentType() {
+ return this.getPersistentType().getJavaPersistentType();
+ }
+
+ protected JavaResourcePersistentType getJavaResourcePersistentType() {
+ JavaPersistentType javaType = this.getJavaPersistentType();
+ return (javaType == null) ? null : javaType.getResourcePersistentType();
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ /**
+ * A type's mapping is being changed. Copy the common settings from the old
+ * mapping to the new (this).
+ */
+ public void initializeFrom(OrmTypeMapping oldMapping) {
+ this.setClass(oldMapping.getClass_());
+ this.setSpecifiedMetadataComplete(oldMapping.getSpecifiedMetadataComplete());
+ this.setOverrideMetadataComplete(oldMapping.isOverrideMetadataComplete());
+ }
+
+
+ // ********** tables **********
+
+ public String getPrimaryTableName() {
+ return null;
+ }
+
+ public Table getPrimaryDbTable() {
+ return null;
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return null;
+ }
+
+ public Schema getDbSchema() {
+ return null;
+ }
+
+
+ // ********** attribute mappings **********
+
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return true;
+ }
+
+ public Iterator<AttributeMapping> attributeMappings() {
+ return new TransformationIterator<OrmReadOnlyPersistentAttribute, AttributeMapping>(this.getPersistentType().attributes()) {
+ @Override
+ protected AttributeMapping transform(OrmReadOnlyPersistentAttribute attribute) {
+ return attribute.getMapping();
+ }
+ };
+ }
+
+ public Iterator<AttributeMapping> allAttributeMappings() {
+ return new CompositeIterator<AttributeMapping>(this.allAttributeMappingsLists());
+ }
+
+ protected Iterator<Iterator<AttributeMapping>> allAttributeMappingsLists() {
+ return new TransformationIterator<TypeMapping, Iterator<AttributeMapping>>(this.inheritanceHierarchy(), TypeMappingTools.ATTRIBUTE_MAPPINGS_TRANSFORMER);
+ }
+
+ public Iterator<String> overridableAttributeNames() {
+ return new CompositeIterator<String>(this.overridableAttributeNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> overridableAttributeNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return new CompositeIterator<String>(this.allOverridableAttributeNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> allOverridableAttributeNamesLists() {
+ return new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER);
+ }
+
+ public Iterable<AttributeMapping> getAttributeMappings(final String mappingKey) {
+ return new FilteringIterable<AttributeMapping>(CollectionTools.collection(this.attributeMappings())) {
+ @Override
+ protected boolean accept(AttributeMapping o) {
+ return Tools.valuesAreEqual(o.getKey(), mappingKey);
+ }
+ };
+ }
+
+ public Iterable<AttributeMapping> getAllAttributeMappings(final String mappingKey) {
+ return new FilteringIterable<AttributeMapping>(CollectionTools.collection(this.allAttributeMappings())) {
+ @Override
+ protected boolean accept(AttributeMapping o) {
+ return Tools.valuesAreEqual(o.getKey(), mappingKey);
+ }
+ };
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) {
+ Column column = attributeMapping.resolveOverriddenColumn(attributeName);
+ if (column != null) {
+ return column;
+ }
+ }
+ if ( ! this.isMetadataComplete()) {
+ JavaPersistentType javaPersistentType = this.getJavaPersistentType();
+ if (javaPersistentType != null) {
+ return javaPersistentType.getMapping().resolveOverriddenColumn(attributeName);
+ }
+ }
+ return null;
+ }
+
+ public Iterator<String> overridableAssociationNames() {
+ return new CompositeIterator<String>(this.overridableAssociationNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> overridableAssociationNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ public Iterator<String> allOverridableAssociationNames() {
+ return new CompositeIterator<String>(this.allOverridableAssociationNamesLists());
+ }
+
+ protected Iterator<Iterator<String>> allOverridableAssociationNamesLists() {
+ return new TransformationIterator<TypeMapping, Iterator<String>>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER);
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) {
+ Relationship relationship = attributeMapping.resolveOverriddenRelationship(attributeName);
+ if (relationship != null) {
+ return relationship;
+ }
+ }
+ if ( ! this.isMetadataComplete()) {
+ JavaPersistentType javaPersistentType = this.getJavaPersistentType();
+ if (javaPersistentType != null) {
+ return javaPersistentType.getMapping().resolveOverriddenRelationship(attributeName);
+ }
+ }
+ return null;
+ }
+
+
+ // ********** inheritance hierarchy **********
+
+ public TypeMapping getSuperTypeMapping() {
+ PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType();
+ return (superPersistentType == null) ? null : superPersistentType.getMapping();
+ }
+
+ public Iterator<TypeMapping> inheritanceHierarchy() {
+ return this.convertToMappings(this.getPersistentType().inheritanceHierarchy());
+ }
+
+ protected Iterable<TypeMapping> getInheritanceHierarchy() {
+ return CollectionTools.iterable(this.inheritanceHierarchy());
+ }
+
+ /**
+ * Return the type mapping's "persistence" ancestors,
+ * <em>excluding</em> the type mapping itself.
+ * The returned iterator will return elements infinitely if the hierarchy
+ * has a loop.
+ */
+ protected Iterator<TypeMapping> ancestors() {
+ return this.convertToMappings(this.getPersistentType().ancestors());
+ }
+
+ protected Iterable<TypeMapping> getAncestors() {
+ return CollectionTools.iterable(this.ancestors());
+ }
+
+ protected Iterator<TypeMapping> convertToMappings(Iterator<PersistentType> types) {
+ return new TransformationIterator<PersistentType, TypeMapping>(types) {
+ @Override
+ protected TypeMapping transform(PersistentType type) {
+ return type.getMapping();
+ }
+ };
+ }
+
+
+ // ********** misc **********
+
+ public X getXmlTypeMapping() {
+ return this.xmlTypeMapping;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getPersistentType().getName());
+ }
+
+
+ // ********** text ranges **********
+
+ public JpaStructureNode getStructureNode(int offset) {
+ return this.xmlTypeMapping.containsOffset(offset) ? this.getPersistentType() : null;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.xmlTypeMapping.getSelectionTextRange();
+ }
+
+ public TextRange getClassTextRange() {
+ return this.xmlTypeMapping.getClassTextRange();
+ }
+
+ public TextRange getAttributesTextRange() {
+ return this.xmlTypeMapping.getAttributesTextRange();
+ }
+
+ public TextRange getNameTextRange() {
+ return this.xmlTypeMapping.getNameTextRange();
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return this.xmlTypeMapping.containsOffset(textOffset);
+ }
+
+
+ // ********** refactoring **********
+
+ public DeleteEdit createDeleteEdit() {
+ return this.xmlTypeMapping.createDeleteEdit();
+ }
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return this.getPersistentType().isFor(originalType.getFullyQualifiedName('.')) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenameTypeEdit(originalType, newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenameTypeEdit(IType originalType, String newName) {
+ return this.xmlTypeMapping.createRenameTypeEdit(originalType, newName);
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return this.getPersistentType().isFor(originalType.getFullyQualifiedName('.')) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return this.getPersistentType().isIn(originalPackage) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenamePackageEdit(String newName) {
+ return this.xmlTypeMapping.createRenamePackageEdit(newName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateClass(messages, reporter);
+ }
+
+ protected void validateClass(List<IMessage> messages, IReporter reporter) {
+ if (StringTools.stringIsEmpty(this.class_)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_TYPE_UNSPECIFIED_CLASS,
+ this,
+ this.getClassTextRange()
+ )
+ );
+ return;
+ }
+ this.buildTypeMappingValidator().validate(messages, reporter);
+ }
+
+ protected JptValidator buildTypeMappingValidator() {
+ return new GenericTypeMappingValidator(this, this.getJavaResourcePersistentType(), this.buildTextRangeResolver());
+ }
+
+ protected TypeMappingTextRangeResolver buildTextRangeResolver() {
+ return new OrmTypeMappingTextRangeResolver(this);
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.getPersistenceUnit().validatesAgainstDatabase();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.xmlTypeMapping.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java
new file mode 100644
index 0000000000..891bebbdb8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java
@@ -0,0 +1,325 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> version mapping
+ */
+public abstract class AbstractOrmVersionMapping<X extends XmlVersion>
+ extends AbstractOrmAttributeMapping<X>
+ implements OrmVersionMapping
+{
+ protected final OrmColumn column;
+
+ protected OrmConverter converter; // never null
+
+
+ // the spec does not list Temporal explicitly,
+ // but it is included in the orm.xml schema...
+ protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
+ OrmTemporalConverter.Adapter.instance(),
+ };
+ protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractOrmVersionMapping(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.column = this.buildColumn();
+ this.converter = this.buildConverter();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ this.syncConverter();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ this.converter.update();
+ }
+
+
+ // ********** column **********
+
+ public OrmColumn getColumn() {
+ return this.column;
+ }
+
+ protected OrmColumn buildColumn() {
+ return this.getContextNodeFactory().buildOrmColumn(this, this);
+ }
+
+
+ // ********** converter **********
+
+ public OrmConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ // note: we may also clear the XML value we want;
+ // but if we leave it, the resulting sync will screw things up...
+ this.clearXmlConverterValues();
+ OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter.initialize();
+ }
+ }
+
+ protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(OrmConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ protected void clearXmlConverterValues() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ adapter.clearXmlValue(this.xmlAttributeMapping);
+ }
+ }
+
+ protected OrmConverter buildConverter() {
+ OrmXmlContextNodeFactory factory = this.getContextNodeFactory();
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ OrmConverter ormConverter = adapter.buildConverter(this, factory);
+ if (ormConverter != null) {
+ return ormConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
+ if (adapter == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ if (this.converter.getType() == adapter.getConverterType()) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first adapter whose converter value is set in the XML mapping.
+ * Return <code>null</code> if there are no converter values in the XML.
+ */
+ protected OrmConverter.Adapter getXmlConverterAdapter() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.isActive(this.xmlAttributeMapping)) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected OrmConverter buildNullConverter() {
+ return new NullOrmConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected OrmConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<OrmConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 30;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmVersionMapping(this);
+ }
+
+ @Override
+ protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
+ super.initializeFromOrmColumnMapping(oldMapping);
+ this.column.initializeFrom(oldMapping.getColumn());
+ }
+
+ public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
+ xmlAttributes.getVersions().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
+ xmlAttributes.getVersions().remove(this.xmlAttributeMapping);
+ }
+
+
+ // ********** OrmColumn.Owner implementation **********
+
+ public String getDefaultColumnName() {
+ return this.name;
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public XmlColumn getXmlColumn() {
+ return this.xmlAttributeMapping.getColumn();
+ }
+
+ public XmlColumn buildXmlColumn() {
+ XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
+ this.xmlAttributeMapping.setColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ public void removeXmlColumn() {
+ this.xmlAttributeMapping.setColumn(null);
+ }
+
+
+ // ********** refactoring **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createConverterRenameTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenameTypeEdits(IType originalType, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenameTypeEdits(originalType, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createConverterMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return (this.converter != null) ?
+ this.converter.createMoveTypeEdits(originalType, newPackage) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createConverterRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenamePackageEdits(originalPackage, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.column.validate(messages, reporter);
+ this.converter.validate(messages, reporter);
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java
new file mode 100644
index 0000000000..f41a3492f1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
+import org.eclipse.jpt.jpa.core.context.VirtualBaseColumn;
+
+public abstract class AbstractOrmVirtualBaseColumn<O extends ReadOnlyNamedColumn.Owner, C extends BaseColumn>
+ extends AbstractOrmVirtualNamedColumn<O, C>
+ implements VirtualBaseColumn
+{
+ protected String specifiedTable;
+ protected String defaultTable;
+
+ protected Boolean specifiedUnique;
+ protected boolean defaultUnique;
+
+ protected Boolean specifiedNullable;
+ protected boolean defaultNullable;
+
+ protected Boolean specifiedInsertable;
+ protected boolean defaultInsertable;
+
+ protected Boolean specifiedUpdatable;
+ protected boolean defaultUpdatable;
+
+
+ protected AbstractOrmVirtualBaseColumn(JpaContextNode parent, O owner) {
+ super(parent, owner);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedTable(this.buildSpecifiedTable());
+ this.setDefaultTable(this.buildDefaultTable());
+
+ this.setSpecifiedUnique(this.buildSpecifiedUnique());
+ this.setDefaultUnique(this.buildDefaultUnique());
+
+ this.setSpecifiedNullable(this.buildSpecifiedNullable());
+ this.setDefaultNullable(this.buildDefaultNullable());
+
+ this.setSpecifiedInsertable(this.buildSpecifiedInsertable());
+ this.setDefaultInsertable(this.buildDefaultInsertable());
+
+ this.setSpecifiedUpdatable(this.buildSpecifiedUpdatable());
+ this.setDefaultUpdatable(this.buildDefaultUpdatable());
+ }
+
+
+ // ********** table **********
+
+ public String getTable() {
+ return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ protected void setSpecifiedTable(String table) {
+ String old = this.specifiedTable;
+ this.specifiedTable = table;
+ this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildSpecifiedTable() {
+ return this.getOverriddenColumn().getSpecifiedTable();
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String table) {
+ String old = this.defaultTable;
+ this.defaultTable = table;
+ this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildDefaultTable() {
+ return this.owner.getDefaultTableName();
+ }
+
+
+ // ********** unique **********
+
+ public boolean isUnique() {
+ return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique();
+ }
+
+ public Boolean getSpecifiedUnique() {
+ return this.specifiedUnique;
+ }
+
+ protected void setSpecifiedUnique(Boolean unique) {
+ Boolean old = this.specifiedUnique;
+ this.specifiedUnique = unique;
+ this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique);
+ }
+
+ protected Boolean buildSpecifiedUnique() {
+ return this.getOverriddenColumn().getSpecifiedUnique();
+ }
+
+ public boolean isDefaultUnique() {
+ return this.defaultUnique;
+ }
+
+ protected void setDefaultUnique(boolean unique) {
+ boolean old = this.defaultUnique;
+ this.defaultUnique = unique;
+ this.firePropertyChanged(DEFAULT_UNIQUE_PROPERTY, old, unique);
+ }
+
+ protected boolean buildDefaultUnique() {
+ return DEFAULT_UNIQUE;
+ }
+
+
+ // ********** nullable **********
+
+ public boolean isNullable() {
+ return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable();
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ protected void setSpecifiedNullable(Boolean nullable) {
+ Boolean old = this.specifiedNullable;
+ this.specifiedNullable = nullable;
+ this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected Boolean buildSpecifiedNullable() {
+ return this.getOverriddenColumn().getSpecifiedNullable();
+ }
+
+ public boolean isDefaultNullable() {
+ return this.defaultNullable;
+ }
+
+ protected void setDefaultNullable(boolean nullable) {
+ boolean old = this.defaultNullable;
+ this.defaultNullable = nullable;
+ this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected boolean buildDefaultNullable() {
+ return DEFAULT_NULLABLE;
+ }
+
+
+ // ********** insertable **********
+
+ public boolean isInsertable() {
+ return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable();
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ protected void setSpecifiedInsertable(Boolean insertable) {
+ Boolean old = this.specifiedInsertable;
+ this.specifiedInsertable = insertable;
+ this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected Boolean buildSpecifiedInsertable() {
+ return this.getOverriddenColumn().getSpecifiedInsertable();
+ }
+
+ public boolean isDefaultInsertable() {
+ return this.defaultInsertable;
+ }
+
+ protected void setDefaultInsertable(boolean insertable) {
+ boolean old = this.defaultInsertable;
+ this.defaultInsertable = insertable;
+ this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected boolean buildDefaultInsertable() {
+ return DEFAULT_INSERTABLE;
+ }
+
+
+ // ********** updatable **********
+
+ public boolean isUpdatable() {
+ return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable();
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ protected void setSpecifiedUpdatable(Boolean updatable) {
+ Boolean old = this.specifiedUpdatable;
+ this.specifiedUpdatable = updatable;
+ this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected Boolean buildSpecifiedUpdatable() {
+ return this.getOverriddenColumn().getSpecifiedUpdatable();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return this.defaultUpdatable;
+ }
+
+ protected void setDefaultUpdatable(boolean updatable) {
+ boolean old = this.defaultUpdatable;
+ this.defaultUpdatable = updatable;
+ this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected boolean buildDefaultUpdatable() {
+ return DEFAULT_UPDATABLE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
new file mode 100644
index 0000000000..93213006fc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
+import org.eclipse.jpt.jpa.core.context.VirtualNamedColumn;
+
+/**
+ * <code>orm.xml</code> virtual<ul>
+ * <li>column
+ * <li>join column
+ * </ul>
+ * <strong>NB:</strong> all state is sync'ed/updated in {@link #update()}
+ * because <em>all</em> of its derived from the context model (i.e. none of it
+ * is derived from the resource model).
+ */
+public abstract class AbstractOrmVirtualNamedColumn<O extends ReadOnlyNamedColumn.Owner, C extends NamedColumn>
+ extends AbstractOrmXmlContextNode
+ implements VirtualNamedColumn
+{
+ protected final O owner;
+
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String columnDefinition;
+
+
+ protected AbstractOrmVirtualNamedColumn(JpaContextNode parent, O owner) {
+ super(parent);
+ this.owner = owner;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedName(this.buildSpecifiedName());
+ this.setDefaultName(this.buildDefaultName());
+
+ this.setColumnDefinition(this.buildColumnDefinition());
+ }
+
+
+ // ********** column **********
+
+ /**
+ * This should never return <code>null</code>.
+ */
+ public abstract C getOverriddenColumn();
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ protected void setSpecifiedName(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ return this.getOverriddenColumn().getSpecifiedName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultName() {
+ return this.owner.getDefaultColumnName();
+ }
+
+
+ // ********** column definition **********
+
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ protected void setColumnDefinition(String columnDefinition) {
+ String old = this.columnDefinition;
+ this.columnDefinition = columnDefinition;
+ this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
+ }
+
+ protected String buildColumnDefinition() {
+ return this.getOverriddenColumn().getColumnDefinition();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null; // not sure this column is validated...
+ }
+
+
+ // ********** misc **********
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ String table = this.getTable();
+ if (table != null) {
+ sb.append(table);
+ sb.append('.');
+ }
+ sb.append(this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
new file mode 100644
index 0000000000..ff8ec49424
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReferenceTable;
+import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+
+public abstract class AbstractOrmVirtualReferenceTable<T extends ReferenceTable>
+ extends AbstractOrmVirtualTable<T>
+ implements VirtualReferenceTable
+{
+ protected final Vector<OrmVirtualJoinColumn> specifiedJoinColumns = new Vector<OrmVirtualJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final ReadOnlyJoinColumn.Owner joinColumnOwner;
+
+ protected OrmVirtualJoinColumn defaultJoinColumn;
+
+
+ protected AbstractOrmVirtualReferenceTable(JpaContextNode parent) {
+ super(parent);
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSpecifiedJoinColumns();
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<OrmVirtualJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<OrmVirtualJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ protected void updateSpecifiedJoinColumns() {
+ ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumn> getOverriddenJoinColumns() {
+ return CollectionTools.iterable(this.getOverriddenTable().specifiedJoinColumns());
+ }
+
+ protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) {
+ OrmVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
+ this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return virtualJoinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) {
+ this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmVirtualJoinColumn, JoinColumn>
+ {
+ public Iterable<OrmVirtualJoinColumn> getContextElements() {
+ return AbstractOrmVirtualReferenceTable.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<JoinColumn> getResourceElements() {
+ return AbstractOrmVirtualReferenceTable.this.getOverriddenJoinColumns();
+ }
+ public JoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, OrmVirtualJoinColumn element) {
+ AbstractOrmVirtualReferenceTable.this.moveSpecifiedJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JoinColumn element) {
+ AbstractOrmVirtualReferenceTable.this.addSpecifiedJoinColumn(index, element);
+ }
+ public void removeContextElement(OrmVirtualJoinColumn element) {
+ AbstractOrmVirtualReferenceTable.this.removeSpecifiedJoinColumn(element);
+ }
+ }
+
+
+ // ********** default join column **********
+
+ public OrmVirtualJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(OrmVirtualJoinColumn joinColumn) {
+ OrmVirtualJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<OrmVirtualJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<OrmVirtualJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ if (this.buildsDefaultJoinColumn()) {
+ if (this.defaultJoinColumn == null) {
+ this.setDefaultJoinColumn(this.buildJoinColumn(this.getOverriddenTable().getDefaultJoinColumn()));
+ } else {
+ this.defaultJoinColumn.update();
+ }
+ } else {
+ this.setDefaultJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultJoinColumn() {
+ return ! this.hasSpecifiedJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ protected OrmVirtualJoinColumn buildJoinColumn(JoinColumn joinColumn) {
+ return this.buildJoinColumn(this.joinColumnOwner, joinColumn);
+ }
+
+ protected OrmVirtualJoinColumn buildJoinColumn(ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) {
+ return this.getContextNodeFactory().buildOrmVirtualJoinColumn(this, owner, joinColumn);
+ }
+
+ protected abstract ReadOnlyJoinColumn.Owner buildJoinColumnOwner();
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java
new file mode 100644
index 0000000000..becc15dd8a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java
@@ -0,0 +1,314 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.NameTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.VirtualTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+public abstract class AbstractOrmVirtualTable<T extends Table>
+ extends AbstractOrmXmlContextNode
+ implements VirtualTable
+{
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected final Vector<OrmVirtualUniqueConstraint> uniqueConstraints = new Vector<OrmVirtualUniqueConstraint>();
+ protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+
+
+ protected AbstractOrmVirtualTable(JpaContextNode parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedName(this.buildSpecifiedName());
+ this.setDefaultName(this.buildDefaultName());
+
+ this.setSpecifiedSchema(this.buildSpecifiedSchema());
+ this.setDefaultSchema(this.buildDefaultSchema());
+
+ this.setSpecifiedCatalog(this.buildSpecifiedCatalog());
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+
+ this.updateUniqueConstraints();
+ }
+
+
+ // ********** table **********
+
+ /**
+ * This should never return <code>null</code>.
+ */
+ public abstract T getOverriddenTable();
+
+
+ // ********** name **********
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ protected void setSpecifiedName(String name) {
+ String old = this.specifiedName;
+ this.specifiedName = name;
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedName() {
+ return this.getOverriddenTable().getSpecifiedName();
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String name) {
+ String old = this.defaultName;
+ this.defaultName = name;
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ }
+
+ protected abstract String buildDefaultName();
+
+
+ // ********** schema **********
+
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ protected void setSpecifiedSchema(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildSpecifiedSchema() {
+ return this.getOverriddenTable().getSchema();
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected abstract String buildDefaultSchema();
+
+
+ // ********** catalog **********
+
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ protected void setSpecifiedCatalog(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildSpecifiedCatalog() {
+ return this.getOverriddenTable().getCatalog();
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected abstract String buildDefaultCatalog();
+
+
+ // ********** unique constraints **********
+
+ public ListIterator<OrmVirtualUniqueConstraint> uniqueConstraints() {
+ return this.getUniqueConstraints().iterator();
+ }
+
+ protected ListIterable<OrmVirtualUniqueConstraint> getUniqueConstraints() {
+ return new LiveCloneListIterable<OrmVirtualUniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public OrmVirtualUniqueConstraint getUniqueConstraint(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ protected void updateUniqueConstraints() {
+ ContextContainerTools.update(this.uniqueConstraintContainerAdapter);
+ }
+
+ protected Iterable<UniqueConstraint> getOverriddenUniqueConstraints() {
+ return CollectionTools.iterable(this.getOverriddenTable().uniqueConstraints());
+ }
+
+ protected void moveUniqueConstraint(int index, OrmVirtualUniqueConstraint constraint) {
+ this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected OrmVirtualUniqueConstraint addUniqueConstraint(int index, UniqueConstraint uniqueConstraint) {
+ OrmVirtualUniqueConstraint virtualConstraint = this.buildUniqueConstraint(uniqueConstraint);
+ this.addItemToList(index, virtualConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ return virtualConstraint;
+ }
+
+ protected OrmVirtualUniqueConstraint buildUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ return this.getContextNodeFactory().buildOrmVirtualUniqueConstraint(this, uniqueConstraint);
+ }
+
+ protected void removeUniqueConstraint(OrmVirtualUniqueConstraint constraint) {
+ this.removeItemFromList(constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ /**
+ * unique constraint container adapter
+ */
+ protected class UniqueConstraintContainerAdapter
+ implements ContextContainerTools.Adapter<OrmVirtualUniqueConstraint, UniqueConstraint>
+ {
+ public Iterable<OrmVirtualUniqueConstraint> getContextElements() {
+ return AbstractOrmVirtualTable.this.getUniqueConstraints();
+ }
+ public Iterable<UniqueConstraint> getResourceElements() {
+ return AbstractOrmVirtualTable.this.getOverriddenUniqueConstraints();
+ }
+ public UniqueConstraint getResourceElement(OrmVirtualUniqueConstraint contextElement) {
+ return contextElement.getOverriddenUniqueConstraint();
+ }
+ public void moveContextElement(int index, OrmVirtualUniqueConstraint element) {
+ AbstractOrmVirtualTable.this.moveUniqueConstraint(index, element);
+ }
+ public void addContextElement(int index, UniqueConstraint resourceElement) {
+ AbstractOrmVirtualTable.this.addUniqueConstraint(index, resourceElement);
+ }
+ public void removeContextElement(OrmVirtualUniqueConstraint element) {
+ AbstractOrmVirtualTable.this.removeUniqueConstraint(element);
+ }
+ }
+
+
+ // ********** database stuff **********
+
+ public org.eclipse.jpt.jpa.db.Table getDbTable() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
+ }
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+ protected boolean isResolved() {
+ return this.getDbTable() != null;
+ }
+
+ protected boolean hasResolvedSchema() {
+ return this.getDbSchema() != null;
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ protected boolean hasResolvedCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) || (this.resolveDbCatalog(catalog) != null);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.buildQualifiedName());
+ }
+
+ protected String buildQualifiedName() {
+ return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java
new file mode 100644
index 0000000000..6e8509a234
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
+
+/**
+ * Use this abstract class for context nodes that are part of an
+ * <code>orm.xml</code> file.
+ * This will not work for a pure {@link org.eclipse.jpt.jpa.core.context.MappingFile}
+ * implementation.
+ */
+public abstract class AbstractOrmXmlContextNode
+ extends AbstractXmlContextNode
+{
+ protected AbstractOrmXmlContextNode(JpaContextNode parent) {
+ super(parent);
+ }
+
+
+ // ********** convenience methods **********
+
+ protected OrmXmlDefinition getMappingFileDefinition() {
+ return (OrmXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.getResourceType());
+ }
+
+ protected EFactory getResourceNodeFactory() {
+ return this.getMappingFileDefinition().getResourceNodeFactory();
+ }
+
+ /**
+ * Call {@link #isJpa2_0Compatible()} before calling this method.
+ */
+ protected OrmXml2_0ContextNodeFactory getContextNodeFactory2_0() {
+ return (OrmXml2_0ContextNodeFactory) this.getContextNodeFactory();
+ }
+
+ protected OrmXmlContextNodeFactory getContextNodeFactory() {
+ return this.getMappingFileDefinition().getContextNodeFactory();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
new file mode 100644
index 0000000000..fd4ac81334
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
@@ -0,0 +1,386 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericEntityMappings;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAttributeOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmBasicMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEntity;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmGeneratedValue;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmIdMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmJoinTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmLobConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmManyToManyMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmManyToOneMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmMappedSuperclass;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNamedQuery;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNullAttributeMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOneToManyMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOneToOneMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOrderable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmQueryContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmQueryHint;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmSecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTableGenerator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTemporalConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTransientMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVersionMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.UnsupportedOrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
+
+public abstract class AbstractOrmXmlContextNodeFactory
+ implements OrmXmlContextNodeFactory
+{
+ public EntityMappings buildEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) {
+ return new GenericEntityMappings(parent, xmlEntityMappings);
+ }
+
+ public OrmPersistenceUnitMetadata buildOrmPersistenceUnitMetadata(EntityMappings parent) {
+ return new GenericOrmPersistenceUnitMetadata(parent);
+ }
+
+ public OrmPersistenceUnitDefaults buildOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) {
+ return new GenericOrmPersistenceUnitDefaults(parent);
+ }
+
+ public OrmPersistentType buildOrmPersistentType(EntityMappings parent, XmlTypeMapping resourceMapping) {
+ return new GenericOrmPersistentType(parent, resourceMapping);
+ }
+
+ public OrmEntity buildOrmEntity(OrmPersistentType parent, XmlEntity resourceMapping) {
+ return new GenericOrmEntity(parent, resourceMapping);
+ }
+
+ public OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) {
+ return new GenericOrmMappedSuperclass(parent, resourceMapping);
+ }
+
+ public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
+ return new GenericOrmEmbeddable(parent, resourceMapping);
+ }
+
+ public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
+ return new GenericOrmPersistentAttribute(parent, xmlMapping);
+ }
+
+ public OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourcePersistentAttribute) {
+ return new VirtualOrmPersistentAttribute(parent, javaResourcePersistentAttribute);
+ }
+
+ public OrmTable buildOrmTable(OrmEntity parent, Table.Owner owner) {
+ return new GenericOrmTable(parent, owner);
+ }
+
+ public OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent, Table.Owner owner, XmlSecondaryTable xmlSecondaryTable) {
+ return new GenericOrmSecondaryTable(parent, owner, xmlSecondaryTable);
+ }
+
+ public OrmVirtualSecondaryTable buildOrmVirtualSecondaryTable(OrmEntity parent, JavaSecondaryTable javaSecondaryTable) {
+ return new GenericOrmVirtualSecondaryTable(parent, javaSecondaryTable);
+ }
+
+ public OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn resourcePrimaryKeyJoinColumn) {
+ return new GenericOrmPrimaryKeyJoinColumn(parent, owner, resourcePrimaryKeyJoinColumn);
+ }
+
+ public OrmVirtualPrimaryKeyJoinColumn buildOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, Owner owner, JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) {
+ return new GenericOrmVirtualPrimaryKeyJoinColumn(parent, owner, javaPrimaryKeyJoinColumn);
+ }
+
+ public OrmJoinTable buildOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Table.Owner owner) {
+ return new GenericOrmJoinTable(parent, owner);
+ }
+
+ public OrmVirtualJoinTable buildOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) {
+ return new GenericOrmVirtualJoinTable(parent, overriddenTable);
+ }
+
+ public OrmJoinColumn buildOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn xmlJoinColumn) {
+ return new GenericOrmJoinColumn(parent, owner, xmlJoinColumn);
+ }
+
+ public OrmVirtualJoinColumn buildOrmVirtualJoinColumn(XmlContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) {
+ return new GenericOrmVirtualJoinColumn(parent, owner, joinColumn);
+ }
+
+ public OrmAttributeOverrideContainer buildOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner) {
+ return new GenericOrmAttributeOverrideContainer(parent, owner);
+ }
+
+ public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) {
+ return new GenericOrmAssociationOverrideContainer(parent, owner);
+ }
+
+ public OrmAttributeOverride buildOrmAttributeOverride(OrmAttributeOverrideContainer parent, XmlAttributeOverride xmlOverride) {
+ return new GenericOrmAttributeOverride(parent, xmlOverride);
+ }
+
+ public OrmVirtualAttributeOverride buildOrmVirtualAttributeOverride(OrmAttributeOverrideContainer parent, String name) {
+ return new GenericOrmVirtualAttributeOverride(parent, name);
+ }
+
+ public OrmAssociationOverride buildOrmAssociationOverride(OrmAssociationOverrideContainer parent, XmlAssociationOverride xmlOverride) {
+ return new GenericOrmAssociationOverride(parent, xmlOverride);
+ }
+
+ public OrmVirtualAssociationOverride buildOrmVirtualAssociationOverride(OrmAssociationOverrideContainer parent, String name) {
+ return new GenericOrmVirtualAssociationOverride(parent, name);
+ }
+
+ public OrmOverrideRelationship buildOrmOverrideRelationship(OrmAssociationOverride parent) {
+ return new GenericOrmOverrideRelationship(parent);
+ }
+
+ public OrmVirtualOverrideRelationship buildOrmVirtualOverrideRelationship(OrmVirtualAssociationOverride parent) {
+ return new GenericOrmVirtualOverrideRelationship(parent);
+ }
+
+ public OrmDiscriminatorColumn buildOrmDiscriminatorColumn(OrmEntity parent, OrmDiscriminatorColumn.Owner owner) {
+ return new GenericOrmDiscriminatorColumn(parent, owner);
+ }
+
+ public OrmColumn buildOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) {
+ return new GenericOrmColumn(parent, owner);
+ }
+
+ public OrmVirtualColumn buildOrmVirtualColumn(XmlContextNode parent, OrmVirtualColumn.Owner owner) {
+ return new GenericOrmVirtualColumn(parent, owner);
+ }
+
+ public OrmGeneratedValue buildOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue resourceGeneratedValue) {
+ return new GenericOrmGeneratedValue(parent, resourceGeneratedValue);
+ }
+
+ public OrmGeneratorContainer buildOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer resourceGeneratorContainer) {
+ return new GenericOrmGeneratorContainer(parent, resourceGeneratorContainer);
+ }
+
+ public OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) {
+ return new GenericOrmSequenceGenerator(parent, resourceSequenceGenerator);
+ }
+
+ public OrmTableGenerator buildOrmTableGenerator(XmlContextNode parent, XmlTableGenerator resourceTableGenerator) {
+ return new GenericOrmTableGenerator(parent, resourceTableGenerator);
+ }
+
+ public OrmQueryContainer buildOrmQueryContainer(XmlContextNode parent, XmlQueryContainer resourceQueryContainer) {
+ return new GenericOrmQueryContainer(parent, resourceQueryContainer);
+ }
+
+ public OrmNamedNativeQuery buildOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery resourceNamedNativeQuery) {
+ return new GenericOrmNamedNativeQuery(parent, resourceNamedNativeQuery);
+ }
+
+ public OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
+ return new GenericOrmNamedQuery(parent, resourceNamedQuery);
+ }
+
+ public OrmQueryHint buildOrmQueryHint(OrmQuery parent, XmlQueryHint resourceQueryHint) {
+ return new GenericOrmQueryHint(parent, resourceQueryHint);
+ }
+
+ public OrmBasicMapping buildOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic resourceMapping) {
+ return new GenericOrmBasicMapping(parent, resourceMapping);
+ }
+
+ public OrmEmbeddedMapping buildOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded resourceMapping) {
+ return new GenericOrmEmbeddedMapping(parent, resourceMapping);
+ }
+
+ public OrmEmbeddedIdMapping buildOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId resourceMapping) {
+ return new GenericOrmEmbeddedIdMapping(parent, resourceMapping);
+ }
+
+ public OrmIdMapping buildOrmIdMapping(OrmPersistentAttribute parent, XmlId resourceMapping) {
+ return new GenericOrmIdMapping(parent, resourceMapping);
+ }
+
+ public OrmManyToManyMapping buildOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany resourceMapping) {
+ return new GenericOrmManyToManyMapping(parent, resourceMapping);
+ }
+
+ public OrmManyToOneMapping buildOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne resourceMapping) {
+ return new GenericOrmManyToOneMapping(parent, resourceMapping);
+ }
+
+ public OrmOneToManyMapping buildOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany resourceMapping) {
+ return new GenericOrmOneToManyMapping(parent, resourceMapping);
+ }
+
+ public OrmOneToOneMapping buildOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne resourceMapping) {
+ return new GenericOrmOneToOneMapping(parent, resourceMapping);
+ }
+
+ public OrmTransientMapping buildOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient resourceMapping) {
+ return new GenericOrmTransientMapping(parent, resourceMapping);
+ }
+
+ public OrmVersionMapping buildOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion resourceMapping) {
+ return new GenericOrmVersionMapping(parent, resourceMapping);
+ }
+
+ public OrmAttributeMapping buildOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping) {
+ return new GenericOrmNullAttributeMapping(parent, resourceMapping);
+ }
+
+ public OrmAttributeMapping buildUnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping) {
+ return new UnsupportedOrmAttributeMapping(parent, resourceMapping);
+ }
+
+ public OrmUniqueConstraint buildOrmUniqueConstraint(XmlContextNode parent, UniqueConstraint.Owner owner, XmlUniqueConstraint resourceUniqueConstraint) {
+ return new GenericOrmUniqueConstraint(parent, owner, resourceUniqueConstraint);
+ }
+
+ public OrmVirtualUniqueConstraint buildOrmVirtualUniqueConstraint(XmlContextNode parent, UniqueConstraint overriddenUniqueConstraint) {
+ return new GenericOrmVirtualUniqueConstraint(parent, overriddenUniqueConstraint);
+ }
+
+ public OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent) {
+ return new GenericOrmEnumeratedConverter(parent);
+ }
+
+ public OrmConverter buildOrmLobConverter(OrmAttributeMapping parent) {
+ return new GenericOrmLobConverter(parent);
+ }
+
+ public OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent) {
+ return new GenericOrmTemporalConverter(parent);
+ }
+
+ public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) {
+ return new GenericOrmOrderable(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java
new file mode 100644
index 0000000000..97b9f47aac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ArrayList;
+
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.UnsupportedOrmAttributeMappingDefinition;
+
+/**
+ * All the state in the definition should be "static"
+ * (i.e. unchanging once it is initialized).
+ */
+public abstract class AbstractOrmXmlDefinition
+ implements OrmXmlDefinition
+{
+ protected final OrmXmlContextNodeFactory factory;
+
+ protected ArrayList<OrmTypeMappingDefinition> typeMappingDefinitions;
+
+ protected ArrayList<OrmAttributeMappingDefinition> attributeMappingDefinitions;
+
+
+ /**
+ * zero-argument constructor
+ */
+ protected AbstractOrmXmlDefinition() {
+ super();
+ this.factory = this.buildContextNodeFactory();
+ }
+
+
+ // ********** factory **********
+
+ protected abstract OrmXmlContextNodeFactory buildContextNodeFactory();
+
+ public OrmXmlContextNodeFactory getContextNodeFactory() {
+ return this.factory;
+ }
+
+
+ // ********** type mapping definitions **********
+
+ public OrmTypeMappingDefinition getTypeMappingDefinition(String mappingKey) {
+ for (OrmTypeMappingDefinition definition : this.getTypeMappingDefinitions()) {
+ if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
+ return definition;
+ }
+ }
+ throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$
+ }
+
+ /**
+ * Return a list of mapping definitions to use for types in
+ * <code>orm.xml</code> mapping files.
+ * The order is unimportant.
+ */
+ protected synchronized ArrayList<OrmTypeMappingDefinition> getTypeMappingDefinitions() {
+ if (this.typeMappingDefinitions == null) {
+ this.typeMappingDefinitions = this.buildTypeMappingDefinitions();
+ }
+ return this.typeMappingDefinitions;
+ }
+
+ protected ArrayList<OrmTypeMappingDefinition> buildTypeMappingDefinitions() {
+ ArrayList<OrmTypeMappingDefinition> definitions = new ArrayList<OrmTypeMappingDefinition>();
+ this.addTypeMappingDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions);
+
+
+ // ********** attribute mapping definitions **********
+
+ public OrmAttributeMappingDefinition getAttributeMappingDefinition(String mappingKey) {
+ for (OrmAttributeMappingDefinition definition : this.getAttributeMappingDefinitions()) {
+ if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
+ return definition;
+ }
+ }
+ return UnsupportedOrmAttributeMappingDefinition.instance();
+ }
+
+ /**
+ * Return a list of mapping definitions to use for attributes in
+ * <code>orm.xml</code> mapping files.
+ * The order is unimportant.
+ */
+ protected synchronized ArrayList<OrmAttributeMappingDefinition> getAttributeMappingDefinitions() {
+ if (this.attributeMappingDefinitions == null) {
+ this.attributeMappingDefinitions = this.buildAttributeMappingDefinitions();
+ }
+ return this.attributeMappingDefinitions;
+ }
+
+ protected ArrayList<OrmAttributeMappingDefinition> buildAttributeMappingDefinitions() {
+ ArrayList<OrmAttributeMappingDefinition> definitions = new ArrayList<OrmAttributeMappingDefinition>();
+ this.addAttributeMappingDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
new file mode 100644
index 0000000000..b3f7677a18
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
@@ -0,0 +1,323 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> ID class reference
+ */
+public class GenericOrmIdClassReference
+ extends AbstractXmlContextNode
+ implements OrmIdClassReference
+{
+ protected final Owner owner;
+
+ protected String specifiedIdClassName;
+ protected String defaultIdClassName;
+ protected JavaPersistentType idClass;
+
+
+ public GenericOrmIdClassReference(OrmTypeMapping parent, Owner owner) {
+ super(parent);
+ this.owner = owner;
+ this.specifiedIdClassName = this.buildSpecifiedIdClassName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedIdClassName_(this.buildSpecifiedIdClassName());
+ // sync the id class *after* we have the specified name
+ this.syncIdClass();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultIdClassName(this.buildDefaultIdClassName());
+ this.updateIdClass();
+ }
+
+
+ // ********** id class name **********
+
+ public String getIdClassName() {
+ return (this.specifiedIdClassName != null) ? this.specifiedIdClassName : this.defaultIdClassName;
+ }
+
+ public String getSpecifiedIdClassName() {
+ return this.specifiedIdClassName;
+ }
+
+ public void setSpecifiedIdClassName(String name) {
+ if (this.valuesAreDifferent(this.specifiedIdClassName, name)) {
+ XmlClassReference xmlClassRef = this.getXmlIdClassRefForUpdate();
+ this.setSpecifiedIdClassName_(name);
+ xmlClassRef.setClassName(name);
+ this.removeXmlIdClassRefIfUnset();
+ }
+ }
+
+ /**
+ * We clear out {@link #idClass} here because we cannot compare its name
+ * to the specified name, since it may have been prefixed by the entity
+ * mappings package.
+ */
+ protected void setSpecifiedIdClassName_(String name) {
+ String old = this.specifiedIdClassName;
+ this.specifiedIdClassName = name;
+ if (this.firePropertyChanged(SPECIFIED_ID_CLASS_NAME_PROPERTY, old, name)) {
+ // clear out the Java type here, it will be rebuilt during "update"
+ if (this.idClass != null) {
+ this.idClass.dispose();
+ this.setIdClass(null);
+ }
+ }
+ }
+
+ protected String buildSpecifiedIdClassName() {
+ XmlClassReference xmlIdClassRef = this.getXmlIdClassRef();
+ return (xmlIdClassRef == null) ? null : xmlIdClassRef.getClassName();
+ }
+
+ public String getDefaultIdClassName() {
+ return this.defaultIdClassName;
+ }
+
+ protected void setDefaultIdClassName(String name) {
+ String old = this.defaultIdClassName;
+ this.defaultIdClassName = name;
+ this.firePropertyChanged(DEFAULT_ID_CLASS_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultIdClassName() {
+ JavaIdClassReference javaRef = this.owner.getJavaIdClassReferenceForDefaults();
+ return (javaRef == null) ? null : javaRef.getFullyQualifiedIdClassName();
+ }
+
+ public boolean isSpecified() {
+ return this.getIdClassName() != null;
+ }
+
+
+ // ********** xml id class ref **********
+
+ /**
+ * Return null if the XML class ref does not exists.
+ */
+ protected XmlClassReference getXmlIdClassRef() {
+ return this.getXmlIdClassContainer().getIdClass();
+ }
+
+ /**
+ * Build the XML class ref if it does not exist.
+ */
+ protected XmlClassReference getXmlIdClassRefForUpdate() {
+ XmlClassReference xmlClassRef = this.getXmlIdClassRef();
+ return (xmlClassRef != null) ? xmlClassRef : this.buildXmlIdClassRef();
+ }
+
+ protected XmlClassReference buildXmlIdClassRef() {
+ XmlClassReference ref = OrmFactory.eINSTANCE.createXmlClassReference();
+ this.getXmlIdClassContainer().setIdClass(ref);
+ return ref;
+ }
+
+ protected void removeXmlIdClassRefIfUnset() {
+ if (this.getXmlIdClassRef().isUnset()) {
+ this.removeXmlIdClassRef();
+ }
+ }
+
+ protected void removeXmlIdClassRef() {
+ this.getXmlIdClassContainer().setIdClass(null);
+ }
+
+
+ // ********** id class **********
+
+ public JavaPersistentType getIdClass() {
+ return this.idClass;
+ }
+
+ protected void setIdClass(JavaPersistentType idClass) {
+ JavaPersistentType old = this.idClass;
+ this.idClass = idClass;
+ this.firePropertyChanged(ID_CLASS_PROPERTY, old, idClass);
+ }
+
+ /**
+ * If the specified ID class name changes during
+ * <em>sync</em>, the ID class will be cleared out in
+ * {@link #setSpecifiedIdClassName_(String)}. If we get here and
+ * the ID class is still present, we can
+ * <code>sync</code> it. Of course, it might be still obsolete if the
+ * entity mappings's package has changed....
+ *
+ * @see #updateIdClass()
+ */
+ protected void syncIdClass() {
+ if (this.idClass != null) {
+ this.idClass.synchronizeWithResourceModel();
+ }
+ }
+
+ /**
+ * @see #syncIdClass()
+ */
+ protected void updateIdClass() {
+ JavaResourcePersistentType resourceIdClass = this.resolveJavaResourceIdClass();
+ if (resourceIdClass == null) {
+ if (this.idClass != null) {
+ this.idClass.dispose();
+ this.setIdClass(null);
+ }
+ } else {
+ if (this.idClass == null) {
+ this.setIdClass(this.buildIdClass(resourceIdClass));
+ } else {
+ if (this.idClass.getResourcePersistentType() == resourceIdClass) {
+ this.idClass.update();
+ } else {
+ this.idClass.dispose();
+ this.setIdClass(this.buildIdClass(resourceIdClass));
+ }
+ }
+ }
+ }
+
+ // TODO I'm not sure we should be go to the entity mappings to resolve
+ // our name if it is taken from the Java ID class reference...
+ protected JavaResourcePersistentType resolveJavaResourceIdClass() {
+ String idClassName = this.getIdClassName();
+ return (idClassName == null) ? null : this.getEntityMappings().resolveJavaResourcePersistentType(idClassName);
+ }
+
+ protected JavaPersistentType buildIdClass(JavaResourcePersistentType resourceIdClass) {
+ return this.getJpaFactory().buildJavaPersistentType(this, resourceIdClass);
+ }
+
+ public char getIdClassEnclosingTypeSeparator() {
+ return '$';
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmTypeMapping getParent() {
+ return (OrmTypeMapping) super.getParent();
+ }
+
+ protected OrmTypeMapping getTypeMapping() {
+ return this.getParent();
+ }
+
+ protected OrmPersistentType getPersistentType() {
+ return this.getTypeMapping().getPersistentType();
+ }
+
+ protected XmlIdClassContainer getXmlIdClassContainer() {
+ return this.owner.getXmlIdClassContainer();
+ }
+
+ protected EntityMappings getEntityMappings() {
+ return (EntityMappings) this.getMappingFileRoot();
+ }
+
+
+ // ********** PersistentType.Owner implementation **********
+
+ public AccessType getOverridePersistentTypeAccess() {
+ return this.getPersistentType().getAccess();
+ }
+
+ public AccessType getDefaultPersistentTypeAccess() {
+ // this shouldn't be needed, since we've specified an override access, but just to be safe ...
+ return this.getPersistentType().getAccess();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return this.isFor(originalType.getFullyQualifiedName('.')) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenameEdit(originalType, newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenameEdit(IType originalType, String newName) {
+ return this.getXmlIdClassRef().createRenameEdit(originalType, newName);
+ }
+
+ protected boolean isFor(String typeName) {
+ return (this.idClass != null) && this.idClass.isFor(typeName);
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return this.isFor(originalType.getFullyQualifiedName('.')) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return this.isIn(originalPackage) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenamePackageEdit(String newName) {
+ return this.getXmlIdClassRef().createRenamePackageEdit(newName);
+ }
+
+ protected boolean isIn(IPackageFragment originalPackage) {
+ return (this.idClass != null) && this.idClass.isIn(originalPackage);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ // most validation is done "holistically" from the type mapping level
+ }
+
+ public TextRange getValidationTextRange() {
+ XmlClassReference xmlIdClassRef = this.getXmlIdClassRef();
+ return (xmlIdClassRef == null) ?
+ this.getTypeMapping().getValidationTextRange() :
+ xmlIdClassRef.getClassNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java
new file mode 100644
index 0000000000..e4a2fc81e0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmManyToManyRelationship
+ extends AbstractOrmMappingRelationship<OrmManyToManyMapping>
+ implements OrmManyToManyRelationship
+{
+ protected final OrmMappedByRelationshipStrategy mappedByStrategy;
+
+ protected final OrmJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericOrmManyToManyRelationship(OrmManyToManyMapping parent) {
+ super(parent);
+ this.mappedByStrategy = this.buildMappedByStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mappedByStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.mappedByStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected OrmRelationshipStrategy buildStrategy() {
+ if (this.mappedByStrategy.getMappedByAttribute() != null) {
+ return this.mappedByStrategy;
+ }
+ return this.joinTableStrategy;
+ }
+
+
+ // ********** mapped by strategy **********
+
+ public OrmMappedByRelationshipStrategy getMappedByStrategy() {
+ return this.mappedByStrategy;
+ }
+
+ public boolean strategyIsMappedBy() {
+ return this.strategy == this.mappedByStrategy;
+ }
+
+ public void setStrategyToMappedBy() {
+ this.mappedByStrategy.addStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayBeMappedBy(AttributeMapping mapping) {
+ return mapping.getKey() == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ protected OrmMappedByRelationshipStrategy buildMappedByStrategy() {
+ return new GenericOrmMappedByRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public OrmJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public void setStrategyToJoinTable() {
+ // join table is the default strategy, so no need to add to resource
+ this.mappedByStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return this.mappedByStrategy.getMappedByAttribute() == null;
+ }
+
+ protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return new GenericOrmMappingJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromMappedByRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ }
+
+ @Override
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ super.initializeFromMappedByRelationship(oldRelationship);
+ this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected XmlManyToMany getXmlMapping() {
+ return (XmlManyToMany) super.getXmlMapping();
+ }
+
+ public XmlManyToMany getXmlContainer() {
+ return this.getXmlMapping();
+ }
+
+ public boolean isOwner() {
+ return this.mappedByStrategy.getMappedByAttribute() == null;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.mappedByStrategy.validate(messages, reporter);
+ this.joinTableStrategy.validate(messages, reporter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java
new file mode 100644
index 0000000000..39a61109b0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneRelationship2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmManyToOneRelationship
+ extends AbstractOrmMappingRelationship<OrmManyToOneMapping>
+ implements OrmManyToOneRelationship2_0
+{
+ protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy;
+
+ // JPA 2.0
+ protected final OrmJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericOrmManyToOneRelationship(OrmManyToOneMapping parent) {
+ super(parent);
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected OrmRelationshipStrategy buildStrategy() {
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinTableStrategy.getJoinTable() != null){
+ return this.joinTableStrategy;
+ }
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** join table strategy **********
+
+ public OrmJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public void setStrategyToJoinTable() {
+ this.joinTableStrategy.addStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return false;
+ }
+
+ protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return this.isJpa2_0Compatible() ?
+ new GenericOrmMappingJoinTableRelationshipStrategy(this) :
+ new NullOrmJoinTableRelationshipStrategy(this);
+ }
+
+
+
+ // ********** join column strategy **********
+
+ public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ // join column strategy is the default; so no need to add stuff,
+ // just remove all the others
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return this.joinTableStrategy.getJoinTable() == null;
+ }
+
+ protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericOrmMappingJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ super.initializeFromJoinColumnRelationship(oldRelationship);
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected XmlManyToOne getXmlMapping() {
+ return (XmlManyToOne) super.getXmlMapping();
+ }
+
+ public XmlManyToOne getXmlContainer() {
+ return this.getXmlMapping();
+ }
+
+ public boolean isOwner() {
+ return true;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.joinColumnStrategy.validate(messages, reporter);
+ this.joinTableStrategy.validate(messages, reporter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java
new file mode 100644
index 0000000000..903f984532
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmMappedByRelationshipStrategy
+ extends AbstractOrmXmlContextNode
+ implements OrmMappedByRelationshipStrategy
+{
+ protected String mappedByAttribute;
+
+
+ public GenericOrmMappedByRelationshipStrategy(OrmMappedByRelationship parent) {
+ super(parent);
+ this.mappedByAttribute = this.getXmlMappedByMapping().getMappedBy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setMappedByAttribute_(this.getXmlMappedByMapping().getMappedBy());
+ }
+
+
+ // ********** mapped by attribute **********
+
+ public String getMappedByAttribute() {
+ return this.mappedByAttribute;
+ }
+
+ public void setMappedByAttribute(String mappedByAttribute) {
+ this.setMappedByAttribute_(mappedByAttribute);
+ this.getXmlMappedByMapping().setMappedBy(mappedByAttribute);
+ }
+
+ protected void setMappedByAttribute_(String mappedByAttribute) {
+ String old = this.mappedByAttribute;
+ this.mappedByAttribute = mappedByAttribute;
+ this.firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, old, mappedByAttribute);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmMappedByRelationship getParent() {
+ return (OrmMappedByRelationship) super.getParent();
+ }
+
+ public OrmMappedByRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected XmlMappedByMapping getXmlMappedByMapping() {
+ return this.getRelationship().getXmlContainer();
+ }
+
+ public void initializeFrom(MappedByRelationshipStrategy oldStrategy) {
+ this.setMappedByAttribute(oldStrategy.getMappedByAttribute());
+ }
+
+ public String getTableName() {
+ RelationshipMapping owner = this.getRelationshipOwner();
+ return (owner == null) ? null : owner.getRelationship().getStrategy().getTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ RelationshipMapping owner = this.getRelationshipOwner();
+ return (owner == null) ? null : owner.getRelationship().getStrategy().resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ RelationshipMapping owner = this.getRelationshipOwner();
+ return (owner != null) && owner.getRelationship().getStrategy().tableNameIsInvalid(tableName);
+ }
+
+ public String getColumnTableNotValidDescription() {
+ // this will not be called if getRelationshipOwner() returns null
+ return this.getRelationshipOwner().getRelationship().getStrategy().getColumnTableNotValidDescription();
+ }
+
+ protected RelationshipMapping getRelationshipOwner() {
+ return this.getRelationshipMapping().getRelationshipOwner();
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ public boolean relationshipIsOwnedBy(RelationshipMapping otherMapping) {
+ String thisEntityName = this.getEntityName();
+ Entity otherEntity = otherMapping.getResolvedTargetEntity();
+ String otherEntityName = (otherEntity == null) ? null : otherEntity.getName();
+ return Tools.valuesAreEqual(thisEntityName, otherEntityName) &&
+ Tools.valuesAreEqual(this.mappedByAttribute, otherMapping.getName());
+ }
+
+ protected String getEntityName() {
+ Entity entity = this.getRelationship().getEntity();
+ return (entity == null) ? null : entity.getName();
+ }
+
+ public void addStrategy() {
+ if (this.mappedByAttribute == null) {
+ this.setMappedByAttribute(""); //$NON-NLS-1$
+ }
+ }
+
+ public void removeStrategy() {
+ if (this.mappedByAttribute != null) {
+ this.setMappedByAttribute(null);
+ }
+ }
+
+ public Iterator<String> candidateMappedByAttributeNames() {
+ return this.getRelationshipMapping().allTargetEntityAttributeNames();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ TextRange mappedByTextRange = this.getXmlMappedByMapping().getMappedByTextRange();
+ return (mappedByTextRange != null) ? mappedByTextRange : this.getRelationship().getValidationTextRange();
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ if (this.mappedByAttribute == null) {
+ return;
+ }
+
+ Entity targetEntity = this.getRelationshipMapping().getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return; // null target entity is validated elsewhere
+ }
+
+ AttributeMapping mappedByMapping = targetEntity.resolveAttributeMapping(this.mappedByAttribute);
+
+ if (mappedByMapping == null) {
+ messages.add(
+ this.buildMessage(
+ JpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
+ new String[] {this.mappedByAttribute}
+ )
+ );
+ return;
+ }
+
+ if ( ! this.getRelationship().mayBeMappedBy(mappedByMapping)) {
+ messages.add(
+ this.buildMessage(
+ JpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
+ new String[] {this.mappedByAttribute}
+ )
+ );
+ return;
+ }
+
+ // if mappedByMapping is not a relationship owner, then it should have
+ // been flagged in above rule (mappedByIsValid)
+ if ( ! ((RelationshipMapping) mappedByMapping).isRelationshipOwner()) {
+ messages.add(
+ this.buildMessage(
+ JpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
+ new String[] {this.mappedByAttribute}
+ )
+ );
+ }
+ }
+
+ protected IMessage buildMessage(String msgID, String[] parms) {
+ PersistentAttribute attribute = this.getRelationshipMapping().getPersistentAttribute();
+ String attributeDescription = attribute.isVirtual() ?
+ JpaValidationDescriptionMessages.VIRTUAL_ATTRIBUTE_DESC :
+ JpaValidationDescriptionMessages.ATTRIBUTE_DESC;
+ attributeDescription = NLS.bind(attributeDescription, attribute.getName());
+ parms = ArrayTools.add(parms, 0, attributeDescription);
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ parms,
+ this,
+ this.getValidationTextRange()
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..3af2618b64
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.db.Table;
+
+public class GenericOrmMappingJoinColumnRelationshipStrategy
+ extends AbstractOrmJoinColumnRelationshipStrategy
+{
+ protected final boolean targetForeignKey;
+
+
+ /**
+ * The default strategy is for a "source" foreign key.
+ */
+ public GenericOrmMappingJoinColumnRelationshipStrategy(OrmMappingJoinColumnRelationship parent) {
+ this(parent, false);
+ }
+
+ public GenericOrmMappingJoinColumnRelationshipStrategy(OrmMappingJoinColumnRelationship parent, boolean targetForeignKey) {
+ super(parent);
+ this.targetForeignKey = targetForeignKey;
+ }
+
+
+ @Override
+ protected Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ public boolean isOverridable() {
+ return true;
+ }
+
+ public TypeMapping getRelationshipSource() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return this.targetForeignKey ?
+ mapping.getResolvedTargetEntity() :
+ mapping.getTypeMapping();
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return this.targetForeignKey ?
+ mapping.getTypeMapping() :
+ mapping.getResolvedTargetEntity();
+ }
+
+ protected Entity getRelationshipTargetEntity() {
+ TypeMapping target = this.getRelationshipTarget();
+ return (target instanceof Entity) ? (Entity) target : null;
+ }
+
+ public boolean isTargetForeignKey() {
+ return this.targetForeignKey;
+ }
+
+
+ // ********** validation **********
+
+ public String getColumnTableNotValidDescription() {
+ return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY;
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getRelationship().getValidationTextRange();
+ }
+
+
+ // ********** join column owner **********
+
+ protected class JoinColumnOwner
+ implements OrmJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String getDefaultTableName() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ public String getAttributeName() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getName();
+ }
+
+ protected PersistentAttribute getPersistentAttribute() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipSource();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.candidateTableNames();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.resolveDbTable(tableName);
+ }
+
+ public Table getReferencedColumnDbTable() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.defaultJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getValidationTextRange();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator(getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..fcaeb86560
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.InverseJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator;
+
+public class GenericOrmMappingJoinTableRelationshipStrategy
+ extends AbstractOrmJoinTableRelationshipStrategy
+{
+ public GenericOrmMappingJoinTableRelationshipStrategy(OrmMappingJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ public boolean isOverridable() {
+ return this.getJpaPlatformVariation().isJoinTableOverridable();
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.getRelationshipMapping().validatesAgainstDatabase();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getRelationship().getValidationTextRange();
+ }
+
+ protected PersistentAttribute getPersistentAttribute() {
+ return getRelationshipMapping().getPersistentAttribute();
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new InverseJoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return new JoinTableValidator(getPersistentAttribute(), (JoinTable) table, textRangeResolver);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java
new file mode 100644
index 0000000000..674c6bb988
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmOneToManyRelationship
+ extends AbstractOrmMappingRelationship<OrmOneToManyMapping>
+ implements OrmOneToManyRelationship2_0
+{
+ protected final OrmMappedByRelationshipStrategy mappedByStrategy;
+
+ protected final OrmJoinTableRelationshipStrategy joinTableStrategy;
+
+ // JPA 2.0 or EclipseLink
+ protected final boolean supportsJoinColumnStrategy;
+ protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy;
+
+
+ public GenericOrmOneToManyRelationship(OrmOneToManyMapping parent, boolean supportsJoinColumnStrategy) {
+ super(parent);
+ this.mappedByStrategy = this.buildMappedByStrategy();
+ this.supportsJoinColumnStrategy = supportsJoinColumnStrategy;
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+
+ // build join table strategy last since it's dependent on the other strategies
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mappedByStrategy.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.mappedByStrategy.update();
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected OrmRelationshipStrategy buildStrategy() {
+ if (this.mappedByStrategy.getMappedByAttribute() != null) {
+ return this.mappedByStrategy;
+ }
+ if (this.supportsJoinColumnStrategy) {
+ if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
+ return this.joinColumnStrategy;
+ }
+ }
+ return this.joinTableStrategy;
+ }
+
+
+ // ********** mapped by strategy **********
+
+ public OrmMappedByRelationshipStrategy getMappedByStrategy() {
+ return this.mappedByStrategy;
+ }
+
+ public boolean strategyIsMappedBy() {
+ return this.strategy == this.mappedByStrategy;
+ }
+
+ public final void setStrategyToMappedBy() {
+ this.mappedByStrategy.addStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayBeMappedBy(AttributeMapping mapping) {
+ String key = mapping.getKey();
+ if (key == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ return true;
+ }
+ if (this.supportsJoinColumnStrategy) {
+ return key == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+ return false;
+ }
+
+ protected OrmMappedByRelationshipStrategy buildMappedByStrategy() {
+ return new GenericOrmMappedByRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public OrmJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public final void setStrategyToJoinTable() {
+ // join table is default, so no need to add to resource
+ this.mappedByStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return (this.mappedByStrategy.getMappedByAttribute() == null) &&
+ ! this.joinColumnStrategy.hasSpecifiedJoinColumns();
+ }
+
+ protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return new GenericOrmMappingJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** join column strategy **********
+
+ public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ this.joinColumnStrategy.addStrategy();
+ this.mappedByStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return false;
+ }
+
+ protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return this.supportsJoinColumnStrategy ?
+ new GenericOrmMappingJoinColumnRelationshipStrategy(this, true) : // true = target foreign key
+ new NullOrmJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromMappedByRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ }
+
+ @Override
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ super.initializeFromMappedByRelationship(oldRelationship);
+ this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ super.initializeFromJoinColumnRelationship(oldRelationship);
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected XmlOneToMany getXmlMapping() {
+ return (XmlOneToMany) super.getXmlMapping();
+ }
+
+ public XmlOneToMany getXmlContainer() {
+ return this.getXmlMapping();
+ }
+
+ public boolean isOwner() {
+ return this.mappedByStrategy.getMappedByAttribute() == null;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
+ }
+
+ @Override
+ public boolean isTargetForeignKey() {
+ return this.joinColumnStrategy.isTargetForeignKey();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.mappedByStrategy.validate(messages, reporter);
+ this.joinTableStrategy.validate(messages, reporter);
+ this.joinColumnStrategy.validate(messages, reporter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
new file mode 100644
index 0000000000..1f7fbbd2cb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
@@ -0,0 +1,263 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneRelationship2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmOneToOneRelationship
+ extends AbstractOrmMappingRelationship<OrmOneToOneMapping>
+ implements OrmOneToOneRelationship2_0
+{
+ protected final OrmMappedByRelationshipStrategy mappedByStrategy;
+
+ protected final OrmPrimaryKeyJoinColumnRelationshipStrategy primaryKeyJoinColumnStrategy;
+
+ // JPA 2.0
+ protected final OrmJoinTableRelationshipStrategy joinTableStrategy;
+
+ protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy;
+
+
+ public GenericOrmOneToOneRelationship(OrmOneToOneMapping parent) {
+ super(parent);
+ this.mappedByStrategy = this.buildMappedByStrategy();
+ this.primaryKeyJoinColumnStrategy = this.buildPrimaryKeyJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+
+ this.strategy = this.buildStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mappedByStrategy.synchronizeWithResourceModel();
+ this.primaryKeyJoinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.mappedByStrategy.update();
+ this.primaryKeyJoinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ this.joinColumnStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ @Override
+ protected OrmRelationshipStrategy buildStrategy() {
+ if (this.mappedByStrategy.getMappedByAttribute() != null) {
+ return this.mappedByStrategy;
+ }
+ if (this.primaryKeyJoinColumnStrategy.hasPrimaryKeyJoinColumns()) {
+ return this.primaryKeyJoinColumnStrategy;
+ }
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinTableStrategy.getJoinTable() != null){
+ return this.joinTableStrategy;
+ }
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** mapped by strategy **********
+
+ public OrmMappedByRelationshipStrategy getMappedByStrategy() {
+ return this.mappedByStrategy;
+ }
+
+ public boolean strategyIsMappedBy() {
+ return this.strategy == this.mappedByStrategy;
+ }
+
+ public void setStrategyToMappedBy() {
+ this.mappedByStrategy.addStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.primaryKeyJoinColumnStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayBeMappedBy(AttributeMapping mapping) {
+ return mapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ protected OrmMappedByRelationshipStrategy buildMappedByStrategy() {
+ return new GenericOrmMappedByRelationshipStrategy(this);
+ }
+
+
+ // ********** primary key join column strategy **********
+
+ public OrmPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy() {
+ return this.primaryKeyJoinColumnStrategy;
+ }
+
+ public boolean strategyIsPrimaryKeyJoinColumn() {
+ return this.strategy == this.primaryKeyJoinColumnStrategy;
+ }
+
+ public void setStrategyToPrimaryKeyJoinColumn() {
+ this.primaryKeyJoinColumnStrategy.addStrategy();
+ this.mappedByStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ protected OrmPrimaryKeyJoinColumnRelationshipStrategy buildPrimaryKeyJoinColumnStrategy() {
+ return new GenericOrmPrimaryKeyJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public OrmJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public void setStrategyToJoinTable() {
+ this.joinTableStrategy.addStrategy();
+ this.mappedByStrategy.removeStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ this.primaryKeyJoinColumnStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return false;
+ }
+
+ protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return this.isJpa2_0Compatible() ?
+ new GenericOrmMappingJoinTableRelationshipStrategy(this) :
+ new NullOrmJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** join column strategy **********
+
+ public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ // join column strategy is the default; so no need to add stuff,
+ // just remove all the others
+ this.mappedByStrategy.removeStrategy();
+ this.primaryKeyJoinColumnStrategy.removeStrategy();
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return (this.mappedByStrategy.getMappedByAttribute() == null) &&
+ (this.primaryKeyJoinColumnStrategy.primaryKeyJoinColumnsSize() == 0) &&
+ (this.joinTableStrategy.getJoinTable() == null);
+ }
+
+ protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericOrmMappingJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromMappedByRelationship(this);
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ // no other pk join column relationships yet
+ }
+
+ @Override
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ super.initializeFromMappedByRelationship(oldRelationship);
+ this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ super.initializeFromJoinTableRelationship(oldRelationship);
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ @Override
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ super.initializeFromJoinColumnRelationship(oldRelationship);
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected XmlOneToOne getXmlMapping() {
+ return (XmlOneToOne) super.getXmlMapping();
+ }
+
+ public XmlOneToOne getXmlContainer() {
+ return this.getXmlMapping();
+ }
+
+ public boolean isOwner() {
+ return this.mappedByStrategy.getMappedByAttribute() == null;
+ }
+
+ public boolean isOwnedBy(RelationshipMapping mapping) {
+ return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.mappedByStrategy.validate(messages, reporter);
+ this.primaryKeyJoinColumnStrategy.validate(messages, reporter);
+ this.joinTableStrategy.validate(messages, reporter);
+ this.joinColumnStrategy.validate(messages, reporter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..f6f28b8520
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.db.Table;
+
+public class GenericOrmOverrideJoinColumnRelationshipStrategy
+ extends AbstractOrmJoinColumnRelationshipStrategy
+{
+ public GenericOrmOverrideJoinColumnRelationshipStrategy(OrmOverrideRelationship parent) {
+ super(parent);
+ }
+
+ @Override
+ protected Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ public boolean isTargetForeignKey() {
+ RelationshipMapping relationshipMapping = this.getRelationshipMapping();
+ return (relationshipMapping != null) &&
+ relationshipMapping.getRelationship().isTargetForeignKey();
+ }
+
+ public TypeMapping getRelationshipSource() {
+ return this.isTargetForeignKey() ?
+ this.getRelationshipMapping().getResolvedTargetEntity() :
+ this.getAssociationOverrideContainer().getTypeMapping();
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ return this.isTargetForeignKey() ?
+ this.getAssociationOverrideContainer().getTypeMapping() :
+ this.getRelationshipMappingTargetEntity();
+ }
+
+ protected TypeMapping getRelationshipMappingTargetEntity() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return (mapping == null) ? null : mapping.getResolvedTargetEntity();
+ }
+
+ protected Entity getRelationshipTargetEntity() {
+ TypeMapping target = this.getRelationshipTarget();
+ return (target instanceof Entity) ? (Entity) target : null;
+ }
+
+ @Override
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+ protected String getAttributeName() {
+ return this.getAssociationOverride().getName();
+ }
+
+ @Override
+ public String getTableName() {
+ return this.isTargetForeignKey() ?
+ super.getTableName() :
+ this.getAssociationOverrideContainer().getDefaultTableName();
+ }
+
+ @Override
+ public Table resolveDbTable(String tableName) {
+ return this.isTargetForeignKey() ?
+ super.resolveDbTable(tableName) :
+ this.getAssociationOverrideContainer().resolveDbTable(tableName);
+ }
+
+ @Override
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.isTargetForeignKey() ?
+ super.tableNameIsInvalid(tableName) :
+ this.getAssociationOverrideContainer().tableNameIsInvalid(tableName);
+ }
+
+ @Override
+ public Iterator<String> candidateTableNames() {
+ return this.isTargetForeignKey() ?
+ super.candidateTableNames() :
+ this.getAssociationOverrideContainer().candidateTableNames();
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return null;
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ protected OrmAssociationOverride getAssociationOverride() {
+ return this.getRelationship().getAssociationOverride();
+ }
+
+ protected AssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.getAssociationOverride().getContainer();
+ }
+
+ @Override
+ public OrmOverrideRelationship getRelationship() {
+ return (OrmOverrideRelationship) super.getRelationship();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getRelationship().getValidationTextRange();
+ }
+
+
+ // ********** join column owner **********
+
+ protected class JoinColumnOwner
+ implements OrmJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public String getDefaultTableName() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ public String getAttributeName() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getAttributeName();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ RelationshipMapping relationshipMapping = GenericOrmOverrideJoinColumnRelationshipStrategy.this.getRelationshipMapping();
+ return relationshipMapping == null ? null : relationshipMapping.getPersistentAttribute();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.candidateTableNames();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.resolveDbTable(tableName);
+ }
+
+ public Table getReferencedColumnDbTable() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return false;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return this.getAssociationOverrideContainer().buildColumnValidator(this.getAssociationOverride(), (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
+ }
+
+ protected OrmAssociationOverride getAssociationOverride() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getAssociationOverride();
+ }
+
+ protected AssociationOverrideContainer getAssociationOverrideContainer() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getAssociationOverrideContainer();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..8affd5d037
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy
+ extends AbstractOrmXmlContextNode
+ implements OrmPrimaryKeyJoinColumnRelationshipStrategy
+{
+ protected final Vector<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
+ protected final PrimaryKeyJoinColumnContainerAdapter primaryKeyJoinColumnContainerAdapter;
+ protected final OrmJoinColumn.Owner primaryKeyJoinColumnOwner;
+
+
+ public GenericOrmPrimaryKeyJoinColumnRelationshipStrategy(OrmPrimaryKeyJoinColumnRelationship parent) {
+ super(parent);
+ this.primaryKeyJoinColumnContainerAdapter = this.buildPrimaryKeyJoinColumnContainerAdapter();
+ this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ this.initializePrimaryKeyJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncPrimaryKeyJoinColumns();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getPrimaryKeyJoinColumns());
+ }
+
+
+ // ********** primary key join columns **********
+
+ public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.getPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<OrmPrimaryKeyJoinColumn>(this.primaryKeyJoinColumns);
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return this.primaryKeyJoinColumns.size();
+ }
+
+ public boolean hasPrimaryKeyJoinColumns() {
+ return this.primaryKeyJoinColumns.size() != 0;
+ }
+
+ public OrmPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
+ return this.primaryKeyJoinColumns.get(index);
+ }
+
+ public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() {
+ return this.addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size());
+ }
+
+ public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
+ XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
+ OrmPrimaryKeyJoinColumn joinColumn = this.addPrimaryKeyJoinColumn_(index, xmlJoinColumn);
+ this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().add(index, xmlJoinColumn);
+ return joinColumn;
+ }
+
+ protected XmlPrimaryKeyJoinColumn buildXmlPrimaryKeyJoinColumn() {
+ return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn();
+ }
+
+ public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
+ this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removePrimaryKeyJoinColumn(int index) {
+ this.removePrimaryKeyJoinColumn_(index);
+ this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().remove(index);
+ }
+
+ protected void removePrimaryKeyJoinColumn_(int index) {
+ this.removeItemFromList(index, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializePrimaryKeyJoinColumns() {
+ for (XmlPrimaryKeyJoinColumn xmlJoinColumn : this.getXmlPrimaryKeyJoinColumns()) {
+ this.primaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlJoinColumn));
+ }
+ }
+
+ protected void syncPrimaryKeyJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.primaryKeyJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlPrimaryKeyJoinColumn>(this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns());
+ }
+
+ protected void movePrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlJoinColumn) {
+ OrmPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(xmlJoinColumn);
+ this.addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removePrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) {
+ this.removePrimaryKeyJoinColumn_(this.primaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ protected PrimaryKeyJoinColumnContainerAdapter buildPrimaryKeyJoinColumnContainerAdapter() {
+ return new PrimaryKeyJoinColumnContainerAdapter();
+ }
+
+ /**
+ * primary key join column container adapter
+ */
+ protected class PrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
+ {
+ public Iterable<OrmPrimaryKeyJoinColumn> getContextElements() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumns();
+ }
+ public Iterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getXmlPrimaryKeyJoinColumns();
+ }
+ public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getXmlColumn();
+ }
+ public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) {
+ GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.movePrimaryKeyJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) {
+ GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.addPrimaryKeyJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(OrmPrimaryKeyJoinColumn element) {
+ GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.removePrimaryKeyJoinColumn_(element);
+ }
+ }
+
+ protected OrmJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlJoinColumn) {
+ return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlJoinColumn);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmPrimaryKeyJoinColumnRelationship getParent() {
+ return (OrmPrimaryKeyJoinColumnRelationship) super.getParent();
+ }
+
+ public OrmPrimaryKeyJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ protected XmlPrimaryKeyJoinColumnContainer getXmlPrimaryKeyJoinColumnContainer() {
+ return this.getRelationship().getXmlContainer();
+ }
+
+ public String getTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY;
+ }
+
+ protected TypeMapping getTypeMapping() {
+ return this.getRelationshipMapping().getTypeMapping();
+ }
+
+ public void addStrategy() {
+ if (this.primaryKeyJoinColumns.size() == 0) {
+ this.addPrimaryKeyJoinColumn();
+ }
+ }
+
+ public void removeStrategy() {
+ for (int i = this.primaryKeyJoinColumns.size(); i-- > 0; ) {
+ this.removePrimaryKeyJoinColumn(i);
+ }
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getRelationship().getValidationTextRange();
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ for (OrmPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
+ pkJoinColumn.validate(messages, reporter);
+ }
+ }
+
+
+ // ********** join column owner **********
+
+ protected class PrimaryKeyJoinColumnOwner
+ implements OrmJoinColumn.Owner
+ {
+ protected PrimaryKeyJoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String getDefaultTableName() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public Entity getRelationshipTarget() {
+ return this.getRelationshipMapping().getResolvedTargetEntity();
+ }
+
+ public String getAttributeName() {
+ return this.getRelationshipMapping().getName();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getTypeMapping();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public Table getReferencedColumnDbTable() {
+ Entity relationshipTarget = this.getRelationshipTarget();
+ return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return false;
+ }
+
+ public String getDefaultColumnName() {
+ return null;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.primaryKeyJoinColumnsSize();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getValidationTextRange();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new OneToOnePrimaryKeyJoinColumnValidator(this.getPersistentAttribute(), (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getRelationshipMapping();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java
new file mode 100644
index 0000000000..c93dd749e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+
+/**
+ * <code>orm.xml</code> virtual join table
+ */
+public class GenericOrmVirtualJoinTable
+ extends AbstractOrmVirtualReferenceTable<JoinTable>
+ implements OrmVirtualJoinTable
+{
+ protected final JoinTable overriddenTable;
+
+ protected final Vector<OrmVirtualJoinColumn> specifiedInverseJoinColumns = new Vector<OrmVirtualJoinColumn>();
+ protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final ReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
+
+ protected OrmVirtualJoinColumn defaultInverseJoinColumn;
+
+
+ public GenericOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) {
+ super(parent);
+ this.overriddenTable = overriddenTable;
+ this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSpecifiedInverseJoinColumns();
+ this.updateDefaultInverseJoinColumn();
+ }
+
+
+ // ********** table **********
+
+ @Override
+ public JoinTable getOverriddenTable() {
+ return this.overriddenTable;
+ }
+
+
+ // ********** inverse join columns **********
+
+ public ListIterator<OrmVirtualJoinColumn> inverseJoinColumns() {
+ return this.getInverseJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getInverseJoinColumns() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
+ }
+
+ public int inverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
+ }
+
+
+ // ********** specified inverse join columns **********
+
+ public ListIterator<OrmVirtualJoinColumn> specifiedInverseJoinColumns() {
+ return this.getSpecifiedInverseJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
+ return new LiveCloneListIterable<OrmVirtualJoinColumn>(this.specifiedInverseJoinColumns);
+ }
+
+ public int specifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedInverseJoinColumns() {
+ return this.specifiedInverseJoinColumns.size() != 0;
+ }
+
+ public OrmVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) {
+ return this.specifiedInverseJoinColumns.get(index);
+ }
+
+ protected void updateSpecifiedInverseJoinColumns() {
+ ContextContainerTools.update(this.specifiedInverseJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumn> getOverriddenInverseJoinColumns() {
+ return CollectionTools.iterable(this.getOverriddenTable().specifiedInverseJoinColumns());
+ }
+
+ protected void moveSpecifiedInverseJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, JoinColumn joinColumn) {
+ OrmVirtualJoinColumn virtualJoinColumn = this.buildInverseJoinColumn(joinColumn);
+ this.addItemToList(index, virtualJoinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ return virtualJoinColumn;
+ }
+
+ protected void removeSpecifiedInverseJoinColumn(OrmVirtualJoinColumn joinColumn) {
+ this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ /**
+ * specified inverse join column container adapter
+ */
+ protected class SpecifiedInverseJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmVirtualJoinColumn, JoinColumn>
+ {
+ public Iterable<OrmVirtualJoinColumn> getContextElements() {
+ return GenericOrmVirtualJoinTable.this.getSpecifiedInverseJoinColumns();
+ }
+ public Iterable<JoinColumn> getResourceElements() {
+ return GenericOrmVirtualJoinTable.this.getOverriddenInverseJoinColumns();
+ }
+ public JoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, OrmVirtualJoinColumn element) {
+ GenericOrmVirtualJoinTable.this.moveSpecifiedInverseJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JoinColumn element) {
+ GenericOrmVirtualJoinTable.this.addSpecifiedInverseJoinColumn(index, element);
+ }
+ public void removeContextElement(OrmVirtualJoinColumn element) {
+ GenericOrmVirtualJoinTable.this.removeSpecifiedInverseJoinColumn(element);
+ }
+ }
+
+
+ // ********** default inverse join column **********
+
+ public OrmVirtualJoinColumn getDefaultInverseJoinColumn() {
+ return this.defaultInverseJoinColumn;
+ }
+
+ protected void setDefaultInverseJoinColumn(OrmVirtualJoinColumn joinColumn) {
+ OrmVirtualJoinColumn old = this.defaultInverseJoinColumn;
+ this.defaultInverseJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn);
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getDefaultInverseJoinColumns() {
+ return (this.defaultInverseJoinColumn != null) ?
+ new SingleElementListIterable<OrmVirtualJoinColumn>(this.defaultInverseJoinColumn) :
+ EmptyListIterable.<OrmVirtualJoinColumn>instance();
+ }
+
+ protected int getDefaultInverseJoinColumnsSize() {
+ return (this.defaultInverseJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultInverseJoinColumn() {
+ if (this.buildsDefaultInverseJoinColumn()) {
+ if (this.defaultInverseJoinColumn == null) {
+ this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(this.getOverriddenTable().getDefaultInverseJoinColumn()));
+ } else {
+ this.defaultInverseJoinColumn.update();
+ }
+ } else {
+ this.setDefaultInverseJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultInverseJoinColumn() {
+ return ! this.hasSpecifiedInverseJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmVirtualJoinTableRelationshipStrategy getParent() {
+ return (OrmVirtualJoinTableRelationshipStrategy) super.getParent();
+ }
+
+ protected OrmVirtualJoinTableRelationshipStrategy getJoinStrategy() {
+ return this.getParent();
+ }
+
+ @Override
+ protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ protected ReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() {
+ return new InverseJoinColumnOwner();
+ }
+
+ protected OrmVirtualJoinColumn buildInverseJoinColumn(JoinColumn joinColumn) {
+ return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumn);
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return this.getJoinStrategy().getJoinTableDefaultName();
+ }
+
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getJoinStrategy().getRelationship().getMapping();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+
+ // ********** join column owners **********
+
+ /**
+ * just a little common behavior
+ */
+ protected abstract class AbstractJoinColumnOwner
+ implements ReadOnlyJoinColumn.Owner
+ {
+ protected AbstractJoinColumnOwner() {
+ super();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getRelationship().getTypeMapping();
+ }
+
+ /**
+ * by default, the join column is, obviously, in the join table;
+ * not sure whether it can be anywhere else...
+ */
+ public String getDefaultTableName() {
+ return GenericOrmVirtualJoinTable.this.getName();
+ }
+
+ /**
+ * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
+ */
+ public String getDefaultColumnName() {
+ throw new UnsupportedOperationException();
+ }
+
+ protected OrmVirtualRelationship getRelationship() {
+ return GenericOrmVirtualJoinTable.this.getJoinStrategy().getRelationship();
+ }
+ }
+
+
+ /**
+ * owner for "back-pointer" join columns;
+ * these point at the source/owning entity
+ */
+ protected class JoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ return this.getRelationship().getEntity();
+ }
+
+ public String getAttributeName() {
+ return MappingTools.getTargetAttributeName(GenericOrmVirtualJoinTable.this.getRelationshipMapping());
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmVirtualJoinTable.this.defaultJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmVirtualJoinTable.this.joinColumnsSize();
+ }
+ }
+
+
+ /**
+ * owner for "forward-pointer" join columns;
+ * these point at the target/inverse entity
+ */
+ protected class InverseJoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected InverseJoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ RelationshipMapping relationshipMapping = GenericOrmVirtualJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
+ }
+
+ public String getAttributeName() {
+ RelationshipMapping relationshipMapping = GenericOrmVirtualJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getName();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmVirtualJoinTable.this.inverseJoinColumnsSize();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..6e10fe98a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+
+public class GenericOrmVirtualOverrideJoinColumnRelationshipStrategy
+ extends AbstractOrmXmlContextNode
+ implements OrmVirtualJoinColumnRelationshipStrategy
+{
+ protected final Vector<OrmVirtualJoinColumn> specifiedJoinColumns = new Vector<OrmVirtualJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final ReadOnlyJoinColumn.Owner joinColumnOwner;
+
+ protected OrmVirtualJoinColumn defaultJoinColumn;
+
+
+ public GenericOrmVirtualOverrideJoinColumnRelationshipStrategy(OrmVirtualJoinColumnRelationship parent) {
+ super(parent);
+ this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSpecifiedJoinColumns();
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<OrmVirtualJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<OrmVirtualJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ protected void updateSpecifiedJoinColumns() {
+ ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumn> getOverriddenSpecifiedJoinColumns() {
+ JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
+ return (overriddenStrategy == null) ?
+ EmptyIterable.<JoinColumn>instance() :
+ CollectionTools.iterable(overriddenStrategy.specifiedJoinColumns());
+ }
+
+ protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) {
+ OrmVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
+ this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return virtualJoinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) {
+ this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
+ return new SpecifiedJoinColumnContainerAdapter();
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmVirtualJoinColumn, JoinColumn>
+ {
+ public Iterable<OrmVirtualJoinColumn> getContextElements() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<JoinColumn> getResourceElements() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns();
+ }
+ public JoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, OrmVirtualJoinColumn element) {
+ GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JoinColumn resourceElement) {
+ GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn(index, resourceElement);
+ }
+ public void removeContextElement(OrmVirtualJoinColumn element) {
+ GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn(element);
+ }
+ }
+
+ protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+
+ // ********** default join column **********
+
+ public OrmVirtualJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(OrmVirtualJoinColumn joinColumn) {
+ OrmVirtualJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<OrmVirtualJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<OrmVirtualJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<OrmVirtualJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ JoinColumn overriddenDefaultJoinColumn = this.getOverriddenDefaultJoinColumn();
+ if (overriddenDefaultJoinColumn == null) {
+ if (this.defaultJoinColumn != null) {
+ this.setDefaultJoinColumn(null);
+ }
+ } else {
+ if ((this.defaultJoinColumn != null) && (this.defaultJoinColumn.getOverriddenColumn() == overriddenDefaultJoinColumn)) {
+ this.defaultJoinColumn.update();
+ } else {
+ this.setDefaultJoinColumn(this.buildJoinColumn(overriddenDefaultJoinColumn));
+ }
+ }
+ }
+
+ protected JoinColumn getOverriddenDefaultJoinColumn() {
+ JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
+ return (overriddenStrategy == null) ? null : overriddenStrategy.getDefaultJoinColumn();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmVirtualJoinColumnRelationship getParent() {
+ return (OrmVirtualJoinColumnRelationship) super.getParent();
+ }
+
+ public OrmVirtualJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected JoinColumnRelationshipStrategy getOverriddenStrategy() {
+ JoinColumnRelationship relationship = this.getOverriddenJoinColumnRelationship();
+ return (relationship == null) ? null : relationship.getJoinColumnStrategy();
+ }
+
+ protected JoinColumnRelationship getOverriddenJoinColumnRelationship() {
+ Relationship relationship = this.resolveOverriddenRelationship();
+ return (relationship instanceof JoinColumnRelationship) ? (JoinColumnRelationship) relationship : null;
+ }
+
+ protected Relationship resolveOverriddenRelationship() {
+ return this.getRelationship().resolveOverriddenRelationship();
+ }
+
+ public boolean isTargetForeignKey() {
+ RelationshipMapping relationshipMapping = this.getRelationshipMapping();
+ return (relationshipMapping != null) &&
+ relationshipMapping.getRelationship().isTargetForeignKey();
+ }
+
+ public TypeMapping getRelationshipSource() {
+ return this.isTargetForeignKey() ?
+ this.getRelationshipMapping().getResolvedTargetEntity() :
+ this.getAssociationOverrideContainer().getTypeMapping();
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ return this.isTargetForeignKey() ?
+ this.getAssociationOverrideContainer().getTypeMapping() :
+ this.getRelationshipMappingTargetEntity();
+ }
+
+ protected TypeMapping getRelationshipMappingTargetEntity() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return (mapping == null) ? null : mapping.getResolvedTargetEntity();
+ }
+
+ protected Entity getRelationshipTargetEntity() {
+ TypeMapping target = this.getRelationshipTarget();
+ return (target instanceof Entity) ? (Entity) target : null;
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+ protected OrmReadOnlyAssociationOverride getAssociationOverride() {
+ return ((OrmVirtualOverrideRelationship) this.getRelationship()).getAssociationOverride();
+ }
+
+ protected OrmAssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.getAssociationOverride().getContainer();
+ }
+
+ public String getTableName() {
+ return this.isTargetForeignKey() ?
+ this.getSourceTableName() :
+ this.getAssociationOverrideContainer().getDefaultTableName();
+ }
+
+ protected String getSourceTableName() {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping == null) ? null : typeMapping.getPrimaryTableName();
+ }
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+ protected String getAttributeName() {
+ return this.getAssociationOverride().getName();
+ }
+
+ protected OrmVirtualJoinColumn buildJoinColumn(JoinColumn overriddenJoinColumn) {
+ return this.getContextNodeFactory().buildOrmVirtualJoinColumn(this, this.joinColumnOwner, overriddenJoinColumn);
+ }
+
+
+ // ********** join column owner **********
+
+ protected class JoinColumnOwner
+ implements ReadOnlyJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public String getDefaultTableName() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ public String getAttributeName() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getAttributeName();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return false;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
new file mode 100644
index 0000000000..8cb015eeb6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+
+/**
+ * <code>orm.xml</code> virtual secondary table
+ */
+public class GenericOrmVirtualSecondaryTable
+ extends AbstractOrmVirtualTable<JavaSecondaryTable>
+ implements OrmVirtualSecondaryTable
+{
+ protected final JavaSecondaryTable overriddenTable;
+
+ protected final Vector<OrmVirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmVirtualPrimaryKeyJoinColumn>();
+ protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final ReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
+
+ protected OrmVirtualPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
+
+
+ public GenericOrmVirtualSecondaryTable(OrmEntity parent, JavaSecondaryTable overriddenTable) {
+ super(parent);
+ this.overriddenTable = overriddenTable;
+ this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSpecifiedPrimaryKeyJoinColumns();
+ this.updateDefaultPrimaryKeyJoinColumn();
+ }
+
+
+ // ********** table **********
+
+ @Override
+ public JavaSecondaryTable getOverriddenTable() {
+ return this.overriddenTable;
+ }
+
+
+ // ********** primary key join columns **********
+
+ public ListIterator<OrmVirtualPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.getPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
+ }
+
+
+ // ********** specified primary key join columns **********
+
+ public ListIterator<OrmVirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmVirtualPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<OrmVirtualPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ }
+
+ public OrmVirtualPrimaryKeyJoinColumn getSpecifiedPrimaryKeyJoinColumn(int index) {
+ return this.specifiedPrimaryKeyJoinColumns.get(index);
+ }
+
+ protected void updateSpecifiedPrimaryKeyJoinColumns() {
+ ContextContainerTools.update(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JavaPrimaryKeyJoinColumn> getOverriddenPrimaryKeyJoinColumns() {
+ return CollectionTools.iterable(this.getOverriddenTable().specifiedPrimaryKeyJoinColumns());
+ }
+
+ protected void moveSpecifiedPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
+ this.moveItemInList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmVirtualPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn javaColumn) {
+ OrmVirtualPrimaryKeyJoinColumn virtualColumn = this.buildPrimaryKeyJoinColumn(javaColumn);
+ this.addItemToList(index, virtualColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ return virtualColumn;
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
+ this.removeItemFromList(pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ /**
+ * specified primary key join column container adapter
+ */
+ protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn>
+ {
+ public Iterable<OrmVirtualPrimaryKeyJoinColumn> getContextElements() {
+ return GenericOrmVirtualSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns();
+ }
+ public Iterable<JavaPrimaryKeyJoinColumn> getResourceElements() {
+ return GenericOrmVirtualSecondaryTable.this.getOverriddenPrimaryKeyJoinColumns();
+ }
+ public JavaPrimaryKeyJoinColumn getResourceElement(OrmVirtualPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, OrmVirtualPrimaryKeyJoinColumn element) {
+ GenericOrmVirtualSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JavaPrimaryKeyJoinColumn element) {
+ GenericOrmVirtualSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn(index, element);
+ }
+ public void removeContextElement(OrmVirtualPrimaryKeyJoinColumn element) {
+ GenericOrmVirtualSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn(element);
+ }
+ }
+
+
+ // ********** default primary key join column **********
+
+ public OrmVirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
+ return this.defaultPrimaryKeyJoinColumn;
+ }
+
+ protected void setDefaultPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
+ OrmVirtualPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn;
+ this.defaultPrimaryKeyJoinColumn = pkJoinColumn;
+ this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, old, pkJoinColumn);
+ }
+
+ protected ListIterable<OrmVirtualPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
+ return (this.defaultPrimaryKeyJoinColumn != null) ?
+ new SingleElementListIterable<OrmVirtualPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
+ EmptyListIterable.<OrmVirtualPrimaryKeyJoinColumn>instance();
+ }
+
+ protected int getDefaultPrimaryKeyJoinColumnsSize() {
+ return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultPrimaryKeyJoinColumn() {
+ JavaPrimaryKeyJoinColumn overriddenColumn = this.getOverriddenTable().getDefaultPrimaryKeyJoinColumn();
+ if (overriddenColumn == null) {
+ this.setDefaultPrimaryKeyJoinColumn(null);
+ } else {
+ if ((this.defaultPrimaryKeyJoinColumn != null) && (this.defaultPrimaryKeyJoinColumn.getOverriddenColumn() == overriddenColumn)) {
+ this.defaultPrimaryKeyJoinColumn.update();
+ } else {
+ this.setDefaultPrimaryKeyJoinColumn(this.buildPrimaryKeyJoinColumn(overriddenColumn));
+ }
+ }
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmEntity getParent() {
+ return (OrmEntity) super.getParent();
+ }
+
+ protected OrmEntity getEntity() {
+ return this.getParent();
+ }
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ protected ReadOnlyBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected OrmVirtualPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaColumn) {
+ return this.getContextNodeFactory().buildOrmVirtualPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, javaColumn);
+ }
+
+
+ // ********** defaults **********
+
+ /**
+ * a secondary table doesn't have a default name
+ */
+ @Override
+ protected String buildDefaultName() {
+ return null;
+ }
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** primary key join column owner **********
+
+ protected class PrimaryKeyJoinColumnOwner
+ implements ReadOnlyBaseJoinColumn.Owner
+ {
+ protected OrmEntity getEntity() {
+ return GenericOrmVirtualSecondaryTable.this.getEntity();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getEntity();
+ }
+
+ public String getDefaultTableName() {
+ return GenericOrmVirtualSecondaryTable.this.getName();
+ }
+
+ public String getDefaultColumnName() {
+ if (this.joinColumnsSize() != 1) {
+ return null;
+ }
+ Entity parentEntity = this.getEntity().getParentEntity();
+ return (parentEntity != null) ?
+ parentEntity.getPrimaryKeyColumnName() :
+ this.getEntity().getPrimaryKeyColumnName();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmVirtualSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmVirtualSecondaryTable.this.primaryKeyJoinColumnsSize();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java
new file mode 100644
index 0000000000..4711bbc93a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+
+public class GenericOrmXmlContextNodeFactory
+ extends AbstractOrmXmlContextNodeFactory
+{
+ // nothing
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..abee8a9261
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
+import org.eclipse.jpt.jpa.db.Table;
+
+public class NullOrmJoinTableRelationshipStrategy
+ extends AbstractOrmXmlContextNode
+ implements OrmJoinTableRelationshipStrategy
+{
+ public NullOrmJoinTableRelationshipStrategy(OrmJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** join table **********
+
+ public OrmJoinTable getJoinTable() {
+ return null;
+ }
+
+
+ // ********** XML join table **********
+
+ public XmlJoinTable getXmlJoinTable() {
+ return null;
+ }
+
+ public XmlJoinTable buildXmlJoinTable() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeXmlJoinTable() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmJoinTableRelationship getParent() {
+ return (OrmJoinTableRelationship) super.getParent();
+ }
+
+ public OrmJoinTableRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) {
+ // NOP
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) {
+ // NOP
+ }
+
+ public String getTableName() {
+ return null;
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return null;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return true;
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return null;
+ }
+
+ public String getJoinTableDefaultName() {
+ return null;
+ }
+
+ public void addStrategy() {
+ // NOP
+ }
+
+ public void removeStrategy() {
+ // NOP
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
new file mode 100644
index 0000000000..a26ed24f13
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseColumn;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+
+public class OrmBaseColumnTextRangeResolver
+ extends OrmNamedColumnTextRangeResolver
+ implements BaseColumnTextRangeResolver
+{
+
+ public OrmBaseColumnTextRangeResolver(OrmBaseColumn column) {
+ super(column);
+ }
+
+ @Override
+ protected OrmBaseColumn getColumn() {
+ return (OrmBaseColumn) super.getColumn();
+ }
+
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java
new file mode 100644
index 0000000000..503127b997
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmBasicMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmBasicMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmBasicMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlBasic(),
+ XmlBasic.class);
+ }
+
+ public OrmBasicMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmBasicMapping(parent, (XmlBasic) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java
new file mode 100644
index 0000000000..44b9ef4904
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+/**
+ * default ORM Embeddable provider
+ */
+public class OrmEmbeddableDefinition
+ implements OrmTypeMappingDefinition
+{
+ // singleton
+ private static final OrmEmbeddableDefinition INSTANCE =
+ new OrmEmbeddableDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmTypeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmEmbeddableDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+ public XmlTypeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlEmbeddable(),
+ XmlEmbeddable.class);
+ }
+
+ public OrmEmbeddable buildContextMapping(
+ OrmPersistentType parent,
+ XmlTypeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmEmbeddable(parent, (XmlEmbeddable) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java
new file mode 100644
index 0000000000..5f73e84734
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmEmbeddedIdMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmEmbeddedIdMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmEmbeddedIdMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlEmbeddedId(),
+ XmlEmbeddedId.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmEmbeddedIdMapping(parent, (XmlEmbeddedId) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java
new file mode 100644
index 0000000000..1f05a77656
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmEmbeddedMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmEmbeddedMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmEmbeddedMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlEmbedded(),
+ XmlEmbedded.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmEmbeddedMapping(parent, (XmlEmbedded) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java
new file mode 100644
index 0000000000..ef4931f35b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+/**
+ * default ORM Entity provider
+ */
+public class OrmEntityDefinition
+ implements OrmTypeMappingDefinition
+{
+ // singleton
+ private static final OrmEntityDefinition INSTANCE =
+ new OrmEntityDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmTypeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmEntityDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ public XmlTypeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlEntity(),
+ XmlEntity.class);
+ }
+
+ public OrmEntity buildContextMapping(
+ OrmPersistentType parent,
+ XmlTypeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmEntity(parent, (XmlEntity) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java
new file mode 100644
index 0000000000..af7d7c03c4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
+
+public class OrmEntityTextRangeResolver
+ implements EntityTextRangeResolver
+{
+ private OrmEntity entity;
+
+
+ public OrmEntityTextRangeResolver(OrmEntity entity) {
+ this.entity = entity;
+ }
+
+
+ public TextRange getTypeMappingTextRange() {
+ return this.entity.getValidationTextRange();
+ }
+
+ public TextRange getIdClassTextRange() {
+ return this.entity.getIdClassReference().getValidationTextRange();
+ }
+
+ public TextRange getAttributeMappingTextRange(String attributeName) {
+ return this.getAttributeNamed(attributeName).getValidationTextRange();
+ }
+
+ protected OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) {
+ return this.entity.getPersistentType().getAttributeNamed(attributeName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java
new file mode 100644
index 0000000000..e20a2a6f45
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmIdMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmIdMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmIdMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlId(),
+ XmlId.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmIdMapping(parent, (XmlId) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..94c60a0300
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+
+public class OrmJoinColumnTextRangeResolver
+ extends OrmNamedColumnTextRangeResolver
+ implements JoinColumnTextRangeResolver
+{
+
+ public OrmJoinColumnTextRangeResolver(OrmJoinColumn column) {
+ super(column);
+ }
+
+ @Override
+ protected OrmJoinColumn getColumn() {
+ return (OrmJoinColumn) super.getColumn();
+ }
+
+ public TextRange getTableTextRange() {
+ return this.getColumn().getTableTextRange();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java
new file mode 100644
index 0000000000..f3eac3d4cb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmManyToManyMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmManyToManyMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmManyToManyMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlManyToMany(),
+ XmlManyToMany.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmManyToManyMapping(parent, (XmlManyToMany) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java
new file mode 100644
index 0000000000..a8a8a41efc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmManyToOneMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmManyToOneMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmManyToOneMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlManyToOne(),
+ XmlManyToOne.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmManyToOneMapping(parent, (XmlManyToOne) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java
new file mode 100644
index 0000000000..e0328eb994
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+/**
+ * default ORM MappedSuperclass definition
+ */
+public class OrmMappedSuperclassDefinition
+ implements OrmTypeMappingDefinition
+{
+ // singleton
+ private static final OrmMappedSuperclassDefinition INSTANCE =
+ new OrmMappedSuperclassDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmTypeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmMappedSuperclassDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
+ }
+
+ public XmlTypeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlMappedSuperclass(),
+ XmlMappedSuperclass.class);
+ }
+
+ public OrmMappedSuperclass buildContextMapping(
+ OrmPersistentType parent,
+ XmlTypeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmMappedSuperclass(parent, (XmlMappedSuperclass) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java
new file mode 100644
index 0000000000..03c139a93e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+
+public class OrmMappedSuperclassTextRangeResolver
+ implements PrimaryKeyTextRangeResolver
+{
+ private OrmMappedSuperclass mappedSuperclass;
+
+
+ public OrmMappedSuperclassTextRangeResolver(OrmMappedSuperclass mappedSuperclass) {
+ this.mappedSuperclass = mappedSuperclass;
+ }
+
+
+ public TextRange getTypeMappingTextRange() {
+ return this.mappedSuperclass.getValidationTextRange();
+ }
+
+ public TextRange getIdClassTextRange() {
+ return this.mappedSuperclass.getIdClassReference().getValidationTextRange();
+ }
+
+ public TextRange getAttributeMappingTextRange(String attributeName) {
+ return this.getAttributeNamed(attributeName).getValidationTextRange();
+ }
+
+ protected OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) {
+ return this.mappedSuperclass.getPersistentType().getAttributeNamed(attributeName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
new file mode 100644
index 0000000000..37a19aec80
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+
+public class OrmNamedColumnTextRangeResolver
+ implements NamedColumnTextRangeResolver
+{
+ protected final OrmNamedColumn ormNamedColumn;
+
+ public OrmNamedColumnTextRangeResolver(OrmNamedColumn javaNamedColumn) {
+ this.ormNamedColumn = javaNamedColumn;
+ }
+
+ protected OrmNamedColumn getColumn() {
+ return this.ormNamedColumn;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.ormNamedColumn.getNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java
new file mode 100644
index 0000000000..ce0214dcd2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmOneToManyMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmOneToManyMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmOneToManyMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlOneToMany(),
+ XmlOneToMany.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmOneToManyMapping(parent, (XmlOneToMany) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java
new file mode 100644
index 0000000000..722738c39c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmOneToOneMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmOneToOneMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmOneToOneMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlOneToOne(),
+ XmlOneToOne.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmOneToOneMapping(parent, (XmlOneToOne) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java
new file mode 100644
index 0000000000..0c1d8ee5b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+
+public class OrmOverrideTextRangeResolver
+ implements OverrideTextRangeResolver
+{
+ protected final OrmOverride ormOverride;
+
+ public OrmOverrideTextRangeResolver(OrmOverride ormOverride) {
+ this.ormOverride = ormOverride;
+ }
+
+ protected OrmOverride getOverride() {
+ return this.ormOverride;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.ormOverride.getNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java
new file mode 100644
index 0000000000..fe9b812e24
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+
+public class OrmPersistentAttributeTextRangeResolver
+ implements PersistentAttributeTextRangeResolver
+{
+ private OrmPersistentAttribute persistentAttribute;
+
+ public OrmPersistentAttributeTextRangeResolver(OrmPersistentAttribute persistentAttribute) {
+ this.persistentAttribute = persistentAttribute;
+ }
+
+ public TextRange getAttributeTextRange() {
+ return this.persistentAttribute.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
new file mode 100644
index 0000000000..6fdeb4b124
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+
+public class OrmPrimaryKeyJoinColumnTextRangeResolver
+ extends OrmNamedColumnTextRangeResolver
+ implements
+ BaseJoinColumnTextRangeResolver
+{
+
+ public OrmPrimaryKeyJoinColumnTextRangeResolver(OrmPrimaryKeyJoinColumn column) {
+ super(column);
+ }
+
+ @Override
+ protected OrmPrimaryKeyJoinColumn getColumn() {
+ return (OrmPrimaryKeyJoinColumn) super.getColumn();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getColumn().getReferencedColumnNameTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java
new file mode 100644
index 0000000000..3a86a729c1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+
+public class OrmTableTextRangeResolver
+ implements TableTextRangeResolver
+{
+ protected final OrmTable ormTable;
+
+ public OrmTableTextRangeResolver(OrmTable ormTable) {
+ this.ormTable = ormTable;
+ }
+
+ protected OrmTable getTable() {
+ return this.ormTable;
+ }
+
+ public TextRange getNameTextRange() {
+ return this.ormTable.getNameTextRange();
+ }
+
+ public TextRange getCatalogTextRange() {
+ return this.ormTable.getCatalogTextRange();
+ }
+
+ public TextRange getSchemaTextRange() {
+ return this.ormTable.getSchemaTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java
new file mode 100644
index 0000000000..2f5e612f3a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmTransientMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmTransientMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmTransientMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlTransient(),
+ XmlTransient.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmTransientMapping(parent, (XmlTransient) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java
new file mode 100644
index 0000000000..3a769597e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
+
+public class OrmTypeMappingTextRangeResolver
+ implements TypeMappingTextRangeResolver
+{
+ private OrmTypeMapping typeMapping;
+
+ public OrmTypeMappingTextRangeResolver(OrmTypeMapping typeMapping) {
+ this.typeMapping = typeMapping;
+ }
+
+ public TextRange getTypeMappingTextRange() {
+ return this.typeMapping.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java
new file mode 100644
index 0000000000..cf82474d55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmVersionMappingDefinition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmVersionMappingDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmVersionMappingDefinition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlVersion(),
+ XmlVersion.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping resourceMapping,
+ OrmXmlContextNodeFactory factory) {
+ return factory.buildOrmVersionMapping(parent, (XmlVersion) resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
new file mode 100644
index 0000000000..70e23586d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
@@ -0,0 +1,430 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.CollectionMapping;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <em>specified</em> <code>orm.xml</code> persistent attribute
+ */
+public abstract class SpecifiedOrmPersistentAttribute
+ extends AbstractOrmXmlContextNode
+ implements OrmPersistentAttribute2_0
+{
+ protected OrmAttributeMapping mapping; // never null
+
+ /**
+ * This will point to one of the following:<ul>
+ * <li>an existing Java attribute (taken from the appropriate Java type)
+ * <li>{@link #cachedJavaPersistentAttribute} if there is no such Java attribute
+ * (i.e. the Java type's acces type is different)
+ * <li><code>null</code> if there is no matching Java resource attribute
+ * </ul>
+ * @see #buildJavaPersistentAttribute()
+ */
+ protected JavaPersistentAttribute javaPersistentAttribute;
+
+ protected JavaPersistentAttribute cachedJavaPersistentAttribute;
+
+ protected AccessType defaultAccess;
+
+
+ protected SpecifiedOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
+ super(parent);
+ this.mapping = this.buildMapping(xmlMapping);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mapping.synchronizeWithResourceModel();
+ if (this.cachedJavaPersistentAttribute != null) {
+ this.cachedJavaPersistentAttribute.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultAccess(this.buildDefaultAccess());
+ this.setJavaPersistentAttribute(this.buildJavaPersistentAttribute());
+ this.mapping.update();
+ if (this.cachedJavaPersistentAttribute != null) {
+ this.cachedJavaPersistentAttribute.update();
+ }
+ }
+
+
+ // ********** mapping **********
+
+ public OrmAttributeMapping getMapping() {
+ return this.mapping;
+ }
+
+ public String getMappingKey() {
+ return this.mapping.getKey();
+ }
+
+ public OrmAttributeMapping setMappingKey(String mappingKey) {
+ if (this.valuesAreDifferent(this.getMappingKey(), mappingKey)) {
+ this.setMappingKey_(mappingKey);
+ }
+ return this.mapping;
+ }
+
+ protected void setMappingKey_(String mappingKey) {
+ OrmAttributeMappingDefinition mappingDefinition = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey);
+ XmlAttributeMapping xmlAttributeMapping = mappingDefinition.buildResourceMapping(this.getResourceNodeFactory());
+ this.setMapping(this.buildMapping(xmlAttributeMapping));
+ }
+
+ protected final OrmAttributeMapping buildMapping(XmlAttributeMapping xmlAttributeMapping) {
+ OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(xmlAttributeMapping.getMappingKey());
+ return md.buildContextMapping(this, xmlAttributeMapping, this.getContextNodeFactory());
+ }
+
+ protected void setMapping(OrmAttributeMapping mapping) {
+ OrmAttributeMapping old = this.mapping;
+ this.mapping = mapping;
+ this.firePropertyChanged(MAPPING_PROPERTY, old, mapping);
+ this.getOwningPersistentType().changeMapping(this, old, mapping);
+ }
+
+ /**
+ * <code>orm.xml</code> attributes do not have a default mapping;
+ * they are always specified.
+ */
+ public String getDefaultMappingKey() {
+ return null;
+ }
+
+ protected XmlAttributeMapping getXmlAttributeMapping() {
+ return this.mapping.getXmlAttributeMapping();
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.mapping.getName();
+ }
+
+ public void nameChanged(String oldName, String newName) {
+ this.firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+
+ // ********** Java persistent attribute **********
+
+ public JavaPersistentAttribute getJavaPersistentAttribute() {
+ return this.javaPersistentAttribute;
+ }
+
+ public JavaPersistentAttribute resolveJavaPersistentAttribute() {
+ return this.getJavaPersistentAttribute();
+ }
+
+ protected void setJavaPersistentAttribute(JavaPersistentAttribute javaPersistentAttribute) {
+ JavaPersistentAttribute old = this.javaPersistentAttribute;
+ this.javaPersistentAttribute = javaPersistentAttribute;
+ this.firePropertyChanged(JAVA_PERSISTENT_ATTRIBUTE_PROPERTY, old, javaPersistentAttribute);
+ }
+
+ protected JavaPersistentAttribute buildJavaPersistentAttribute() {
+ String name = this.getName();
+ if (name == null) {
+ return null;
+ }
+ JavaPersistentType javaType = this.getOwningJavaPersistentType();
+ if (javaType == null) {
+ return null;
+ }
+
+ ReadOnlyPersistentAttribute pAttribute = javaType.resolveAttribute(name);
+ JavaPersistentAttribute javaAttribute = (pAttribute == null) ? null : pAttribute.getJavaPersistentAttribute();
+ if ((javaAttribute != null) && (javaAttribute.getAccess() == this.getAccess())) {
+ // we only want to cache the Java persistent attribute if we built it
+ this.cachedJavaPersistentAttribute = null;
+ return javaAttribute;
+ }
+
+ // If 'javaAttribute' is null, it might exist in a superclass that
+ // is not persistent. In that case we need to build it ourselves.
+ // If 'javaAttribute' access is different, 'javaType' will not hold
+ // a corresponding Java persistent attribute. So, again, we need
+ // to build it ourselves.
+ return this.getCachedJavaAttribute();
+ }
+
+ protected JavaPersistentAttribute getCachedJavaAttribute() {
+ JavaResourcePersistentType javaResourceType = this.getOwningJavaPersistentType().getResourcePersistentType();
+ JavaResourcePersistentAttribute javaResourceAttribute = this.getJavaResourceAttribute(javaResourceType);
+ if (javaResourceAttribute == null) {
+ // nothing in the resource inheritance hierarchy matches our name *and* access type
+ this.cachedJavaPersistentAttribute = null;
+ } else {
+ if ((this.cachedJavaPersistentAttribute == null) ||
+ (this.cachedJavaPersistentAttribute.getResourcePersistentAttribute() != javaResourceAttribute)) {
+ // cache is stale
+ this.cachedJavaPersistentAttribute = this.buildJavaPersistentAttribute(javaResourceAttribute);
+ }
+ }
+ return this.cachedJavaPersistentAttribute;
+ }
+
+ protected JavaResourcePersistentAttribute getJavaResourceAttribute(JavaResourcePersistentType javaResourceType) {
+ for (JavaResourcePersistentAttribute javaResourceAttribute : this.getJavaResourceAttributes(javaResourceType)) {
+ if (javaResourceAttribute.getName().equals(this.getName())) {
+ return javaResourceAttribute;
+ }
+ }
+ // climb up inheritance hierarchy
+ String superclassName = javaResourceType.getSuperclassQualifiedName();
+ if (superclassName == null) {
+ return null;
+ }
+ JavaResourcePersistentType superclass = this.getJpaProject().getJavaResourcePersistentType(superclassName);
+ if (superclass == null) {
+ return null;
+ }
+ // recurse
+ return this.getJavaResourceAttribute(superclass);
+ }
+
+ /**
+ * Return the resource attributes with compatible access types.
+ */
+ protected Iterable<JavaResourcePersistentAttribute> getJavaResourceAttributes(JavaResourcePersistentType javaResourceType) {
+ return CollectionTools.iterable(javaResourceType.persistableAttributes(this.getAccess().getJavaAccessType()));
+ }
+
+ protected JavaPersistentAttribute buildJavaPersistentAttribute(JavaResourcePersistentAttribute javaResourceAttribute) {
+ // pass in our parent orm persistent type as the parent to the cached Java attribute...
+ return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), javaResourceAttribute);
+ }
+
+ public JavaResourcePersistentAttribute getJavaResourcePersistentAttribute() {
+ return (this.javaPersistentAttribute == null) ? null : this.javaPersistentAttribute.getResourcePersistentAttribute();
+ }
+
+
+ // ********** access **********
+
+ /**
+ * Subclasses determine the specified access.
+ */
+ public AccessType getAccess() {
+ AccessType specifiedAccess = this.getSpecifiedAccess();
+ return (specifiedAccess != null) ? specifiedAccess : this.defaultAccess;
+ }
+
+ public abstract AccessType getSpecifiedAccess();
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType access) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = access;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildDefaultAccess() {
+ return this.getOwningPersistentType().getAccess();
+ }
+
+
+ // ********** specified/virtual **********
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ public OrmReadOnlyPersistentAttribute convertToVirtual() {
+ return this.getOwningPersistentType().convertAttributeToVirtual(this);
+ }
+
+ public OrmPersistentAttribute convertToSpecified() {
+ throw new UnsupportedOperationException();
+ }
+
+ public OrmPersistentAttribute convertToSpecified(String mappingKey) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int offset) {
+ return this;
+ }
+
+ public boolean contains(int textOffset) {
+ return this.mapping.contains(textOffset);
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.mapping.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ // nothing to dispose
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return this.mapping.createRenameTypeEdits(originalType, newName);
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return this.mapping.createMoveTypeEdits(originalType, newPackage);
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return this.mapping.createRenamePackageEdits(originalPackage, newName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateAttribute(messages, reporter);
+ this.mapping.validate(messages, reporter);
+ }
+
+ protected void validateAttribute(List<IMessage> messages, IReporter reporter) {
+ if (this.javaPersistentAttribute == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME,
+ new String[] {
+ this.getName(),
+ this.getOwningTypeMapping().getClass_()
+ },
+ this.mapping,
+ this.mapping.getNameTextRange()
+ )
+ );
+ } else {
+ this.buildAttibuteValidator().validate(messages, reporter);
+ }
+ }
+
+ protected PersistentAttributeTextRangeResolver buildTextRangeResolver() {
+ return new OrmPersistentAttributeTextRangeResolver(this);
+ }
+
+ protected abstract JptValidator buildAttibuteValidator();
+
+ public TextRange getValidationTextRange() {
+ return this.mapping.getValidationTextRange();
+ }
+
+
+ // ********** metamodel **********
+
+ public String getMetamodelContainerFieldTypeName() {
+ return this.getJpaContainerDefinition().getMetamodelContainerFieldTypeName();
+ }
+
+ public String getMetamodelContainerFieldMapKeyTypeName() {
+ return this.getJpaContainerDefinition().getMetamodelContainerFieldMapKeyTypeName((CollectionMapping) this.mapping);
+ }
+
+ public String getMetamodelTypeName() {
+ JavaPersistentAttribute2_0 javaAttribute = (JavaPersistentAttribute2_0) this.javaPersistentAttribute;
+ return (javaAttribute != null) ?
+ javaAttribute.getMetamodelTypeName() :
+ MetamodelField.DEFAULT_TYPE_NAME;
+ }
+
+ protected JavaPersistentAttribute.JpaContainerDefinition getJpaContainerDefinition() {
+ JavaPersistentAttribute2_0 javaAttribute = (JavaPersistentAttribute2_0) this.javaPersistentAttribute;
+ return (javaAttribute != null) ?
+ javaAttribute.getJpaContainerDefinition() :
+ JavaPersistentAttribute.JpaContainerDefinition.Null.instance();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmPersistentType getParent() {
+ return (OrmPersistentType) super.getParent();
+ }
+
+ public OrmPersistentType getOwningPersistentType() {
+ return this.getParent();
+ }
+
+ protected JavaPersistentType getOwningJavaPersistentType() {
+ return this.getOwningPersistentType().getJavaPersistentType();
+ }
+
+ public OrmTypeMapping getOwningTypeMapping() {
+ return this.getOwningPersistentType().getMapping();
+ }
+
+ public String getPrimaryKeyColumnName() {
+ return this.mapping.getPrimaryKeyColumnName();
+ }
+
+ public String getTypeName() {
+ return (this.javaPersistentAttribute == null) ? null : this.javaPersistentAttribute.getTypeName();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java
new file mode 100644
index 0000000000..a45183eca7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java
@@ -0,0 +1,585 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.orm;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.MethodSignature;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
+import org.eclipse.jpt.common.utility.model.listener.StateChangeListener;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmReadOnlyPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * <em>virtual</em> <code>orm.xml</code> persistent attribute
+ */
+public class VirtualOrmPersistentAttribute
+ extends AbstractOrmXmlContextNode
+ implements OrmReadOnlyPersistentAttribute2_0
+{
+ protected final JavaResourcePersistentAttribute javaResourceAttribute;
+
+ /**
+ * This is an "annotated" Java persistent attribute whose state is
+ * determined by its annotations (just like a "normal" Java attribute).
+ * Its parent is an <code>orm.xml</code> persistent type. This is necessary
+ * because the Java attribute's context is the <code>orm.xml</code> type
+ * (e.g. the Java attribute's default table is the table set in the
+ * <code>orm.xml</code> type, not the Java type).
+ */
+ protected final JavaPersistentAttribute annotatedJavaAttribute;
+
+ /**
+ * This is the "original" Java persistent attribute corresponding to
+ * {@link #javaResourceAttribute} from the Java context
+ * model. If it is found (it can be <code>null</code> if the
+ * <code>orm.xml</code> access type differs from the Java's), we need to
+ * listen to it for changes so we can
+ * refresh our "local" Java attributes (since the Java resource model does
+ * not fire change events, and trigger a <em>sync</em>, when it is modified
+ * by the Java context model - if there is no Java context attribute, the
+ * Java resource model can only be modified via source code editing).
+ */
+ protected JavaPersistentAttribute originalJavaAttribute;
+ protected StateChangeListener originalJavaAttributeListener;
+
+ /**
+ * This is a simulated "unannotated" Java persistent attribute. It is built
+ * only if necessary (i.e. when the <code>orm.xml</code> persistent type
+ * has been tagged <em>metadata complete</em>). Like
+ * {@link #annotatedJavaAttribute}, its parent is an
+ * <code>orm.xml</code> persistent type.
+ */
+ protected JavaPersistentAttribute unannotatedJavaAttribute;
+
+ protected JavaAttributeMapping mapping; // never null
+
+
+ public VirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourceAttribute) {
+ super(parent);
+ this.javaResourceAttribute = javaResourceAttribute;
+ this.annotatedJavaAttribute = this.buildAnnotatedJavaAttribute();
+ this.mapping = this.buildMapping();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncLocalJavaAttributes();
+ // 'mapping' belongs to one of the "local" Java persistent attributes
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateOriginalJavaAttribute();
+ this.updateLocalJavaAttributes();
+ this.setMapping(this.buildMapping());
+ }
+
+
+ // ********** mapping **********
+
+ public JavaAttributeMapping getMapping() {
+ return this.mapping;
+ }
+
+ protected void setMapping(JavaAttributeMapping mapping) {
+ JavaAttributeMapping old = this.mapping;
+ this.mapping = mapping;
+ this.firePropertyChanged(DEFAULT_MAPPING_KEY_PROPERTY, old, mapping);
+ }
+
+ protected JavaAttributeMapping buildMapping() {
+ return this.getJavaPersistentAttribute().getMapping();
+ }
+
+ public String getMappingKey() {
+ return this.mapping.getKey();
+ }
+
+ public String getDefaultMappingKey() {
+ return this.mapping.getKey();
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.mapping.getName();
+ }
+
+
+ // ********** Java persistent attribute **********
+
+ public JavaPersistentAttribute getJavaPersistentAttribute() {
+ return this.getOwningTypeMapping().isMetadataComplete() ?
+ this.getUnannotatedJavaAttribute() :
+ this.annotatedJavaAttribute;
+ }
+
+ public JavaPersistentAttribute resolveJavaPersistentAttribute() {
+ JavaPersistentType javaType = this.getOwningPersistentType().getJavaPersistentType();
+ return (javaType == null) ? null : javaType.getAttributeFor(this.javaResourceAttribute);
+ }
+
+ protected JavaPersistentAttribute2_0 getJavaPersistentAttribute2_0() {
+ return (JavaPersistentAttribute2_0) this.getJavaPersistentAttribute();
+ }
+
+ protected JavaPersistentAttribute buildAnnotatedJavaAttribute() {
+ return this.buildJavaAttribute(this.javaResourceAttribute);
+ }
+
+ protected JavaPersistentAttribute getUnannotatedJavaAttribute() {
+ if (this.unannotatedJavaAttribute == null) {
+ this.unannotatedJavaAttribute = this.buildUnannotatedJavaAttribute();
+ }
+ return this.unannotatedJavaAttribute;
+ }
+
+ protected JavaPersistentAttribute buildUnannotatedJavaAttribute() {
+ return this.buildJavaAttribute(this.buildUnannotatedJavaResourceAttribute());
+ }
+
+ /**
+ * Build a Java resource attribute that wraps the original Java resource
+ * attribute and behaves as though it has no annotations. This will cause
+ * all the settings in the Java <em>context</em> attribute to default.
+ */
+ protected JavaResourcePersistentAttribute buildUnannotatedJavaResourceAttribute() {
+ return new UnannotatedJavaResourcePersistentAttribute(this.javaResourceAttribute);
+ }
+
+ protected JavaPersistentAttribute buildJavaAttribute(JavaResourcePersistentAttribute jrpa) {
+ // pass in the orm persistent type as the parent...
+ return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), jrpa);
+ }
+
+ protected void syncLocalJavaAttributes() {
+ this.annotatedJavaAttribute.synchronizeWithResourceModel();
+ if (this.unannotatedJavaAttribute != null) {
+ this.unannotatedJavaAttribute.synchronizeWithResourceModel();
+ }
+ }
+
+ protected void updateLocalJavaAttributes() {
+ this.annotatedJavaAttribute.update();
+ if (this.unannotatedJavaAttribute != null) {
+ this.unannotatedJavaAttribute.update();
+ }
+ }
+
+ public JavaResourcePersistentAttribute getJavaResourcePersistentAttribute() {
+ return this.javaResourceAttribute;
+ }
+
+
+ // ********** original Java persistent attribute **********
+
+ protected void updateOriginalJavaAttribute() {
+ JavaPersistentAttribute newJavaAttribute = this.resolveJavaPersistentAttribute();
+ if (newJavaAttribute != this.originalJavaAttribute) {
+ if (newJavaAttribute == null) {
+ this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener());
+ this.originalJavaAttribute = null;
+ } else {
+ if (this.originalJavaAttribute != null) {
+ this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener());
+ }
+ this.originalJavaAttribute = newJavaAttribute;
+ this.originalJavaAttribute.addStateChangeListener(this.getOriginalJavaAttributeListener());
+ }
+ }
+ }
+
+ protected StateChangeListener getOriginalJavaAttributeListener() {
+ if (this.originalJavaAttributeListener == null) {
+ this.originalJavaAttributeListener = this.buildOriginalJavaAttributeListener();
+ }
+ return this.originalJavaAttributeListener;
+ }
+
+ protected StateChangeListener buildOriginalJavaAttributeListener() {
+ return new StateChangeListener() {
+ public void stateChanged(StateChangeEvent event) {
+ VirtualOrmPersistentAttribute.this.originalJavaAttributeChanged();
+ }
+ };
+ }
+
+ /**
+ * If the "original" Java persistent attribute (or any of its parts) changes
+ * we need to sync our "local" Java persistent attributes with any possible
+ * changes to the Java resource model. This is necessary for when the Java
+ * context model is modifying the Java resource model, but is redundant when
+ * the Java resource model is triggering a <em>sync</em>.
+ */
+ protected void originalJavaAttributeChanged() {
+ this.syncLocalJavaAttributes();
+ }
+
+
+ // ********** access **********
+
+ public AccessType getAccess() {
+ return this.getJavaPersistentAttribute().getAccess();
+ }
+
+
+ // ********** specified/virtual **********
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ public OrmReadOnlyPersistentAttribute convertToVirtual() {
+ throw new UnsupportedOperationException();
+ }
+
+ public OrmPersistentAttribute convertToSpecified() {
+ if (this.mapping.getKey() == null) {
+ throw new IllegalStateException("Use convertToSpecified(String) instead and specify a mapping type"); //$NON-NLS-1$
+ }
+ return this.getOwningPersistentType().convertAttributeToSpecified(this);
+ }
+
+ public OrmPersistentAttribute convertToSpecified(String mappingKey) {
+ return this.getOwningPersistentType().convertAttributeToSpecified(this, mappingKey);
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int offset) {
+ return this;
+ }
+
+ public boolean contains(int textOffset) {
+ return false;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return null;
+ }
+
+ public void dispose() {
+ if (this.originalJavaAttribute != null) {
+ this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener());
+ }
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getOwningTypeMapping().getAttributesTextRange();
+ }
+
+
+ // ********** metamodel **********
+
+ public String getMetamodelContainerFieldTypeName() {
+ return this.getJavaPersistentAttribute2_0().getMetamodelContainerFieldTypeName();
+ }
+
+ public String getMetamodelContainerFieldMapKeyTypeName() {
+ return this.getJavaPersistentAttribute2_0().getMetamodelContainerFieldMapKeyTypeName();
+ }
+
+ public String getMetamodelTypeName() {
+ return this.getJavaPersistentAttribute2_0().getMetamodelTypeName();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmPersistentType getParent() {
+ return (OrmPersistentType) super.getParent();
+ }
+
+ public OrmPersistentType getOwningPersistentType() {
+ return this.getParent();
+ }
+
+ public OrmTypeMapping getOwningTypeMapping() {
+ return this.getOwningPersistentType().getMapping();
+ }
+
+ public String getPrimaryKeyColumnName() {
+ return this.mapping.getPrimaryKeyColumnName();
+ }
+
+ public String getTypeName() {
+ return this.getJavaPersistentAttribute().getTypeName();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+
+
+ // ********** unannotated Java resource persistent member **********
+
+ /**
+ * Wrap another Java resource member and suppress all its annotations.
+ */
+ protected abstract class UnannotatedJavaResourcePersistentMember<M extends JavaResourcePersistentMember>
+ extends SourceNode
+ implements JavaResourcePersistentMember
+ {
+ protected final M member;
+
+ /**
+ * these are built as needed
+ */
+ protected final HashMap<String, Annotation> nullAnnotationsCache = new HashMap<String, Annotation>();
+
+
+ protected UnannotatedJavaResourcePersistentMember(M member) {
+ super(member.getParent());
+ this.member = member;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // NOP
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // NOP
+ }
+
+
+ // ********** annotations **********
+
+ public Iterator<Annotation> annotations() {
+ return EmptyIterator.instance();
+ }
+
+ public int annotationsSize() {
+ return 0;
+ }
+
+ public Annotation getAnnotation(String annotationName) {
+ return null;
+ }
+
+ public synchronized Annotation getNonNullAnnotation(String annotationName) {
+ Annotation annotation = this.nullAnnotationsCache.get(annotationName);
+ if (annotation == null) {
+ annotation = this.buildNullAnnotation(annotationName);
+ this.nullAnnotationsCache.put(annotationName, annotation);
+ }
+ return annotation;
+ }
+
+ protected abstract Annotation buildNullAnnotation(String annotationName);
+
+ public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
+ return EmptyIterator.instance();
+ }
+
+ public Annotation addAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** persistable **********
+
+ public boolean isPersistable() {
+ return this.member.isPersistable();
+ }
+
+
+ // ********** misc **********
+
+ public boolean isAnnotated() {
+ return false;
+ }
+
+ public boolean isFinal() {
+ return this.member.isFinal();
+ }
+
+ public boolean isFor(String memberName, int occurrence) {
+ return this.member.isFor(memberName, occurrence);
+ }
+
+ public TextRange getTextRange(CompilationUnit astRoot) {
+ return this.member.getTextRange(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.member.getNameTextRange(astRoot);
+ }
+
+ public void resolveTypes(CompilationUnit astRoot) {
+ // NOP
+ }
+ }
+
+
+ // ********** unannotated Java resource persistent member **********
+
+ protected class UnannotatedJavaResourcePersistentAttribute
+ extends UnannotatedJavaResourcePersistentMember<JavaResourcePersistentAttribute>
+ implements JavaResourcePersistentAttribute
+ {
+ protected UnannotatedJavaResourcePersistentAttribute(JavaResourcePersistentAttribute attribute){
+ super(attribute);
+ }
+
+
+ // ********** annotations **********
+
+ @Override
+ public Annotation buildNullAnnotation(String annotationName) {
+ return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
+ }
+
+ private Annotation buildNullAnnotation_(String annotationName) {
+ return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
+ }
+
+
+ // ********** delegated behavior **********
+
+ @Override
+ public JavaResourcePersistentType getParent() {
+ return this.member.getParent();
+ }
+
+ public JavaResourcePersistentType getResourcePersistentType() {
+ return this.member.getResourcePersistentType();
+ }
+
+ public String getName() {
+ return this.member.getName();
+ }
+
+ public boolean isFor(MethodSignature signature, int occurrence) {
+ return this.member.isFor(signature, occurrence);
+ }
+
+ public boolean isField() {
+ return this.member.isField();
+ }
+
+ public boolean isProperty() {
+ return this.member.isProperty();
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.java.AccessType getSpecifiedAccess() {
+ return null;
+ }
+
+ public boolean typeIsSubTypeOf(String tn) {
+ return this.member.typeIsSubTypeOf(tn);
+ }
+
+ public boolean typeIsVariablePrimitive() {
+ return this.member.typeIsVariablePrimitive();
+ }
+
+ public int getModifiers() {
+ return this.member.getModifiers();
+ }
+
+ public String getTypeName() {
+ return this.member.getTypeName();
+ }
+
+ public boolean typeIsInterface() {
+ return this.member.typeIsInterface();
+ }
+
+ public boolean typeIsEnum() {
+ return this.member.typeIsEnum();
+ }
+
+ public ListIterator<String> typeSuperclassNames() {
+ return this.member.typeSuperclassNames();
+ }
+
+ public Iterator<String> typeInterfaceNames() {
+ return this.member.typeInterfaceNames();
+ }
+
+ public ListIterator<String> typeTypeArgumentNames() {
+ return this.member.typeTypeArgumentNames();
+ }
+
+ public int typeTypeArgumentNamesSize() {
+ return this.member.typeTypeArgumentNamesSize();
+ }
+
+ public String getTypeTypeArgumentName(int index) {
+ return this.member.getTypeTypeArgumentName(index);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
new file mode 100644
index 0000000000..0413d8f066
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
@@ -0,0 +1,384 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JarFile;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>persistence.xml</code> file
+ * <br>
+ * <code>jar-file</code> element
+ */
+public abstract class AbstractJarFileRef
+ extends AbstractPersistenceXmlContextNode
+ implements JarFileRef
+{
+ protected final XmlJarFileRef xmlJarFileRef;
+
+ protected String fileName;
+
+ /**
+ * the jar file corresponding to the ref's file name;
+ * this can be null if the name is invalid
+ */
+ protected JarFile jarFile;
+
+
+ // ********** construction/initialization **********
+
+ public AbstractJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
+ super(parent);
+ this.xmlJarFileRef = xmlJarFileRef;
+ this.fileName = xmlJarFileRef.getFileName();
+ this.jarFile = this.buildJarFile();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setFileName_(this.xmlJarFileRef.getFileName());
+ this.syncJarFile();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJarFile();
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return PersistenceStructureNodes.JAR_FILE_REF_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ return this;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ if (this.jarFile != null) {
+ this.jarFile.dispose();
+ }
+ }
+
+
+ // ********** file name **********
+
+ public String getFileName() {
+ return this.fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.setFileName_(fileName);
+ this.xmlJarFileRef.setFileName(fileName);
+ }
+
+ /**
+ * We clear out {@link #jarFile} here because we cannot compare its file
+ * name to the ref's file name, since it may have been munged (see
+ * {@link #resolveJavaResourcePackageFragmentRoot_()}).
+ */
+ protected void setFileName_(String fileName) {
+ String old = this.fileName;
+ this.fileName = fileName;
+ if (this.firePropertyChanged(FILE_NAME_PROPERTY, old, fileName)) {
+ // clear out the jar file here, it will be rebuilt during "update"
+ if (this.jarFile != null) {
+ this.jarFile.dispose();
+ this.setJarFile(null);
+ }
+ }
+ }
+
+
+ // ********** jar file **********
+
+ public JarFile getJarFile() {
+ return this.jarFile;
+ }
+
+ protected void setJarFile(JarFile jarFile) {
+ JarFile old = this.jarFile;
+ this.jarFile = jarFile;
+ this.firePropertyChanged(JAR_FILE_PROPERTY, old, jarFile);
+ }
+
+ protected JarFile buildJarFile() {
+ JavaResourcePackageFragmentRoot jrpfr = this.resolveJavaResourcePackageFragmentRoot();
+ return (jrpfr == null) ? null : this.buildJarFile(jrpfr);
+ }
+
+ /**
+ * If the file name changes during <em>sync</em>, the jar file will be
+ * cleared out in {@link #setFileName_(String)}. If we get here and the jar
+ * file is still present, we can <code>sync</code> it. Of course, it might
+ * still be obsolete if other things have changed....
+ *
+ * @see #updateJarFile()
+ */
+ protected void syncJarFile() {
+ if (this.jarFile != null) {
+ this.jarFile.synchronizeWithResourceModel();
+ }
+ }
+
+ /**
+ * @see #syncJarFile()
+ */
+ protected void updateJarFile() {
+ JavaResourcePackageFragmentRoot jrpfr = this.resolveJavaResourcePackageFragmentRoot();
+ if (jrpfr == null) {
+ if (this.jarFile != null) {
+ this.jarFile.dispose();
+ this.setJarFile(null);
+ }
+ } else {
+ if (this.jarFile == null) {
+ this.setJarFile(this.buildJarFile(jrpfr));
+ } else {
+ if (this.jarFile.getJarResourcePackageFragmentRoot() == jrpfr) {
+ this.jarFile.update();
+ } else {
+ this.jarFile.dispose();
+ this.setJarFile(this.buildJarFile(jrpfr));
+ }
+ }
+ }
+ }
+
+ protected JavaResourcePackageFragmentRoot resolveJavaResourcePackageFragmentRoot() {
+ return StringTools.stringIsEmpty(this.fileName) ? null : this.resolveJavaResourcePackageFragmentRoot_();
+ }
+
+ /**
+ * pre-condition: 'fileName' is neither null nor empty
+ */
+ protected JavaResourcePackageFragmentRoot resolveJavaResourcePackageFragmentRoot_() {
+ // first, attempt to resolve location specifically...
+ JavaResourcePackageFragmentRoot jrpfr = this.resolveJrpfrOnDeploymentPath();
+ // ...then guess, basically
+ return (jrpfr != null) ? jrpfr : this.resolveJrpfrBestMatch();
+ }
+
+ /**
+ * pre-condition: 'fileName' is neither null nor empty
+ */
+ protected JavaResourcePackageFragmentRoot resolveJrpfrOnDeploymentPath() {
+ for (IPath runtimePath : this.buildRuntimeJarFilePath(new Path(this.fileName))) {
+ IVirtualFile virtualJar = ComponentCore.createFile(this.getProject(), runtimePath);
+ IFile realJar = virtualJar.getUnderlyingFile();
+ if (realJar.exists() && realJar.getProject().equals(this.getProject())) {
+ return this.getJpaProject().getJavaResourcePackageFragmentRoot(realJar.getProjectRelativePath().toString());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return an array of runtime paths that may correspond
+ * to the given persistence.xml jar file entry
+ */
+ protected IPath[] buildRuntimeJarFilePath(IPath jarFilePath) {
+ IPath root = this.getJarRuntimeRootPath();
+ return this.projectHasWebFacet() ?
+ this.buildRuntimeJarFilePathWeb(root, jarFilePath) :
+ this.buildRuntimeJarFilePathNonWeb(root, jarFilePath);
+ }
+
+ protected IPath getJarRuntimeRootPath() {
+ return JptJpaCorePlugin.getJarRuntimeRootPath(this.getProject());
+ }
+
+ protected boolean projectHasWebFacet() {
+ return JptJpaCorePlugin.projectHasWebFacet(this.getProject());
+ }
+
+ protected IPath[] buildRuntimeJarFilePathWeb(IPath root, IPath jarFilePath) {
+ return new IPath[] {
+ // first path entry assumes form "../lib/other.jar"
+ root.append(jarFilePath.removeFirstSegments(1)),
+ // second path entry assumes form of first, without ".." ("lib/other.jar")
+ root.append(jarFilePath)
+ };
+ }
+
+ protected IPath[] buildRuntimeJarFilePathNonWeb(IPath root, IPath jarFilePath) {
+ return new IPath[] {
+ // assumes form "../lib/other.jar"
+ root.append(jarFilePath)
+ };
+ }
+
+ protected IProject getProject() {
+ return this.getJpaProject().getProject();
+ }
+
+ /**
+ * pre-condition: 'fileName' is neither null nor empty
+ */
+ protected JavaResourcePackageFragmentRoot resolveJrpfrBestMatch() {
+ String jarFileName = new Path(this.fileName).lastSegment();
+ for (JpaFile jpaFile : this.getJpaProject().getJarJpaFiles()) {
+ if (jpaFile.getFile().getName().equals(jarFileName)) {
+ return (JavaResourcePackageFragmentRoot) jpaFile.getResourceModel();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * pre-condition: 'jrpfr' is not null
+ */
+ protected JarFile buildJarFile(JavaResourcePackageFragmentRoot jrpfr) {
+ return this.getContextNodeFactory().buildJarFile(this, jrpfr);
+ }
+
+
+ // ********** JarFileRef implementation **********
+
+ public XmlJarFileRef getXmlJarFileRef() {
+ return this.xmlJarFileRef;
+ }
+
+ public PersistentType getPersistentType(String typeName) {
+ return (this.jarFile == null) ? null : this.jarFile.getPersistentType(typeName);
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return (this.xmlJarFileRef != null) && this.xmlJarFileRef.containsOffset(textOffset);
+ }
+
+
+ // ********** PersistentTypeContainer implementation **********
+
+ public Iterable<? extends PersistentType> getPersistentTypes() {
+ return (this.jarFile != null) ? this.jarFile.getPersistentTypes() : EmptyIterable.<JavaPersistentType>instance();
+ }
+
+
+ // ********** XmlContextNode implementation **********
+
+ public TextRange getValidationTextRange() {
+ return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getValidationTextRange();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createReplaceFolderEdits(IFolder originalFolder, String newName) {
+ return this.isIn(originalFolder) ?
+ new SingleElementIterable<ReplaceEdit>(this.createReplaceFolderEdit(originalFolder, newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createReplaceFolderEdit(IFolder originalFolder, String newName) {
+ return this.xmlJarFileRef.createReplaceFolderEdit(originalFolder, newName);
+ }
+
+ protected boolean isIn(IFolder folder) {
+ return (this.jarFile != null) && this.jarFile.isIn(folder);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ if (StringTools.stringIsEmpty(this.xmlJarFileRef.getFileName())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ return;
+ }
+
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+
+ if (this.jarFile == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE,
+ new String[] {this.xmlJarFileRef.getFileName()},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ return;
+ }
+
+ this.jarFile.validate(messages, reporter);
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ public PersistenceUnit getParent() {
+ return (PersistenceUnit) super.getParent();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(this.fileName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
new file mode 100644
index 0000000000..6eb3db74f2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>persistence.xml</code> file
+ * <br>
+ * <code>mapping-file</code> element
+ */
+public abstract class AbstractMappingFileRef
+ extends AbstractPersistenceXmlContextNode
+ implements MappingFileRef
+{
+ protected String fileName;
+
+ /**
+ * The mapping file corresponding to the ref's file name.
+ * This can be <code>null</code> if the name is invalid.
+ */
+ protected MappingFile mappingFile;
+
+
+ // ********** construction/initialization **********
+
+ protected AbstractMappingFileRef(PersistenceUnit parent, String fileName) {
+ super(parent);
+ this.fileName = fileName;
+ this.mappingFile = this.buildMappingFile();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncMappingFile();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateMappingFile();
+ }
+
+
+ // ********** file name **********
+
+ public String getFileName() {
+ return this.fileName;
+ }
+
+ public boolean isFor(IFile file) {
+ return (this.mappingFile != null) && file.equals(this.mappingFile.getXmlResource().getFile());
+ }
+
+ protected boolean isIn(IFolder folder) {
+ return (this.mappingFile != null) && this.mappingFile.isIn(folder);
+ }
+
+
+ // ********** mapping file **********
+
+ public MappingFile getMappingFile() {
+ return this.mappingFile;
+ }
+
+ protected void setMappingFile(MappingFile mappingFile) {
+ MappingFile old = this.mappingFile;
+ this.mappingFile = mappingFile;
+ this.firePropertyChanged(MAPPING_FILE_PROPERTY, old, mappingFile);
+ }
+
+ protected MappingFile buildMappingFile() {
+ JpaXmlResource xmlResource = this.resolveMappingFileXmlResource();
+ return (xmlResource == null) ? null : this.buildMappingFile(xmlResource);
+ }
+
+ protected void syncMappingFile() {
+ if (this.mappingFile != null) {
+ this.mappingFile.synchronizeWithResourceModel();
+ }
+ }
+
+ protected void updateMappingFile() {
+ JpaXmlResource newXmlResource = this.resolveMappingFileXmlResource();
+ if (newXmlResource == null) {
+ if (this.mappingFile != null) {
+ this.mappingFile.dispose();
+ this.setMappingFile(null);
+ }
+ } else {
+ if (this.mappingFile == null) {
+ this.setMappingFile(this.buildMappingFile(newXmlResource));
+ } else {
+ if (this.mappingFile.getXmlResource() == newXmlResource) {
+ this.mappingFile.update();
+ } else {
+ // [seems like we should never get here; since if the file's
+ // content type changed, the JPA project would return null... ~bjv]
+ // if the resource's content type has changed, we completely rebuild the mapping file
+ this.mappingFile.dispose();
+ this.setMappingFile(this.buildMappingFile(newXmlResource));
+ }
+ }
+ }
+ }
+
+ /**
+ * The mapping file ref resource is in the persistence xml resource
+ * (<code>persistence.xml</code>). This returns the resource of
+ * the mapping file itself (<code>orm.xml</code>).
+ */
+ protected JpaXmlResource resolveMappingFileXmlResource() {
+ if (this.fileName == null) {
+ return null;
+ }
+ JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
+ if (xmlResource == null) {
+ return null;
+ }
+ if (xmlResource.isReverting()) {
+ // 308254 - this can happen when orm.xml is closed without saving;
+ // the model is completely whacked in another thread - so wipe our model(?)
+ return null;
+ }
+ JptResourceType resourceType = xmlResource.getResourceType();
+ if (resourceType == null) {
+ return null;
+ }
+ if ( ! this.getJpaPlatform().supportsResourceType(resourceType)) {
+ return null;
+ }
+ return xmlResource;
+ }
+
+ /**
+ * pre-condition: 'resource' is not null
+ */
+ protected MappingFile buildMappingFile(JpaXmlResource resource) {
+ return this.getJpaFactory().buildMappingFile(this, resource);
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return PersistenceStructureNodes.MAPPING_FILE_REF_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ return this;
+ }
+
+ public void dispose() {
+ if (this.mappingFile != null) {
+ this.mappingFile.dispose();
+ }
+ }
+
+
+ // ********** misc **********
+
+ public boolean persistenceUnitMetadataExists() {
+ MappingFilePersistenceUnitMetadata metadata = this.getPersistenceUnitMetadata();
+ return (metadata != null) && metadata.resourceExists();
+ }
+
+ public MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata() {
+ MappingFileRoot root = this.getChildMappingFileRoot();
+ return (root == null) ? null : root.getPersistenceUnitMetadata();
+ }
+
+ /**
+ * The method {@link #getMappingFileRoot()} is already defined by
+ * {@link org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode}
+ * for getting what would be the "mapping file root" that <em>contains</em>
+ * the context node. We want something slightly different here: i.e. the
+ * "mapping file root" contained by the mapping file ref (since, actually,
+ * the mapping file ref is not even contained by a "mapping file root").
+ */
+ protected MappingFileRoot getChildMappingFileRoot() {
+ return (this.mappingFile == null) ? null : this.mappingFile.getRoot();
+ }
+
+ public PersistentType getPersistentType(String typeName) {
+ return (this.mappingFile == null) ? null : this.mappingFile.getPersistentType(typeName);
+ }
+
+ @Override
+ public PersistenceUnit getParent() {
+ return (PersistenceUnit) super.getParent();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(this.fileName);
+ }
+
+ public Iterable<? extends PersistentType> getPersistentTypes() {
+ return (this.mappingFile != null) ? this.mappingFile.getPersistentTypes() : EmptyIterable.<JavaPersistentType>instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ if (StringTools.stringIsEmpty(this.fileName)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ return;
+ }
+
+ if (this.mappingFile == null) {
+ messages.add(this.buildMappingFileValidationMessage());
+ return;
+ }
+
+ this.mappingFile.validate(messages, reporter);
+ }
+
+ protected IMessage buildMappingFileValidationMessage() {
+ int severity = IMessage.HIGH_SEVERITY;
+ IFile file = this.getPlatformFile();
+ if ( ! file.exists()) {
+ return DefaultJpaValidationMessages.buildMessage(
+ severity,
+ JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE,
+ new String[] {this.fileName},
+ this,
+ this.getValidationTextRange()
+ );
+ }
+ String msgText = this.mappingFileContentIsUnsupported() ?
+ JpaValidationMessages.PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT :
+ JpaValidationMessages.PERSISTENCE_UNIT_INVALID_MAPPING_FILE;
+ return DefaultJpaValidationMessages.buildMessage(
+ severity,
+ msgText,
+ new String[] {file.getName()},
+ file
+ );
+ }
+
+ protected IFile getPlatformFile() {
+ return this.getJpaProject().getPlatformFile(new Path(this.fileName));
+ }
+
+ /**
+ * pre-condition: {@link #getPlatformFile()} exists
+ */
+ protected boolean mappingFileContentIsUnsupported() {
+ JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
+ return (xmlResource != null) && ! this.getJpaPlatform().supportsResourceType(xmlResource.getResourceType());
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<DeleteEdit> createDeleteTypeEdits(IType type) {
+ return (this.mappingFile != null) ?
+ this.mappingFile.createDeleteTypeEdits(type) :
+ EmptyIterable.<DeleteEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return (this.mappingFile != null) ?
+ this.mappingFile.createRenameTypeEdits(originalType, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return (this.mappingFile != null) ?
+ this.mappingFile.createMoveTypeEdits(originalType, newPackage) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return (this.mappingFile != null) ?
+ this.mappingFile.createRenamePackageEdits(originalPackage, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenameMappingFileEdits(IFile originalFile, String newName) {
+ return this.isFor(originalFile) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenameEdit(originalFile, newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected abstract ReplaceEdit createRenameEdit(IFile originalFile, String newName);
+
+ public Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination) {
+ return this.isFor(originalFile) ?
+ new SingleElementIterable<ReplaceEdit>(this.createMoveEdit(originalFile, runtineDestination)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected abstract ReplaceEdit createMoveEdit(IFile originalFile, IPath runtineDestination);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
new file mode 100644
index 0000000000..cfe13da52d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -0,0 +1,2404 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.utility.BodySourceWriter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.HashBag;
+import org.eclipse.jpt.common.utility.internal.NotNullFilter;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
+import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitTransactionType;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MappingFilePersistenceUnitDefaults2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
+import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperties;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>persistence.xml</code> file
+ * <br>
+ * <code>persistence-unit</code> element
+ */
+public abstract class AbstractPersistenceUnit
+ extends AbstractPersistenceXmlContextNode
+ implements PersistenceUnit2_0
+{
+ protected final XmlPersistenceUnit xmlPersistenceUnit;
+
+ protected String name;
+
+ protected Boolean specifiedExcludeUnlistedClasses;
+
+ protected PersistenceUnitTransactionType specifiedTransactionType;
+ protected PersistenceUnitTransactionType defaultTransactionType;
+
+ protected String description;
+
+ protected String provider;
+
+ protected String jtaDataSource;
+ protected String nonJtaDataSource;
+
+ protected final Vector<MappingFileRef> specifiedMappingFileRefs = new Vector<MappingFileRef>();
+ protected final SpecifiedMappingFileRefContainerAdapter specifiedMappingFileRefContainerAdapter = new SpecifiedMappingFileRefContainerAdapter();
+ protected MappingFileRef impliedMappingFileRef;
+
+ protected final Vector<JarFileRef> jarFileRefs = new Vector<JarFileRef>();
+ protected final JarFileRefContainerAdapter jarFileRefContainerAdapter = new JarFileRefContainerAdapter();
+
+ protected final Vector<ClassRef> specifiedClassRefs = new Vector<ClassRef>();
+ protected final SpecifiedClassRefContainerAdapter specifiedClassRefContainerAdapter = new SpecifiedClassRefContainerAdapter();
+
+ protected final Set<ClassRef> impliedClassRefs = Collections.synchronizedSet(new HashSet<ClassRef>());
+ protected final ImpliedClassRefContainerAdapter impliedClassRefContainerAdapter = new ImpliedClassRefContainerAdapter();
+
+ protected final Vector<Property> properties = new Vector<Property>();
+ protected final PropertyContainerAdapter propertyContainerAdapter = new PropertyContainerAdapter();
+
+ /* global generator definitions, defined elsewhere in model */
+ protected final Vector<Generator> generators = new Vector<Generator>();
+
+ /* global query definitions, defined elsewhere in model */
+ protected final Vector<Query> queries = new Vector<Query>();
+
+ protected boolean xmlMappingMetadataComplete;
+ protected AccessType defaultAccess;
+ protected String defaultCatalog;
+ protected String defaultSchema;
+ protected boolean defaultCascadePersist;
+ protected boolean defaultDelimitedIdentifiers;
+
+ //****** JPA 2.0 features
+ protected PersistenceUnitProperties connection;
+ protected PersistenceUnitProperties options;
+
+ protected SharedCacheMode specifiedSharedCacheMode;
+ protected SharedCacheMode defaultSharedCacheMode;
+
+ protected ValidationMode specifiedValidationMode;
+ protected ValidationMode defaultValidationMode;
+
+ protected final Set<IFile> metamodelFiles = Collections.synchronizedSet(new HashSet<IFile>());
+
+
+ // ********** construction/initialization **********
+
+ /**
+ * NB: Be careful changing the order of the statements in this method
+ * (bug 258701 is one reason).
+ */
+ protected AbstractPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
+ super(parent);
+ this.xmlPersistenceUnit = xmlPersistenceUnit;
+ this.name = xmlPersistenceUnit.getName();
+ this.specifiedExcludeUnlistedClasses = xmlPersistenceUnit.getExcludeUnlistedClasses();
+ this.specifiedTransactionType = this.buildSpecifiedTransactionType();
+ this.description = xmlPersistenceUnit.getDescription();
+ this.provider = xmlPersistenceUnit.getProvider();
+ this.jtaDataSource = xmlPersistenceUnit.getJtaDataSource();
+ this.nonJtaDataSource = xmlPersistenceUnit.getNonJtaDataSource();
+
+ // initialize the properties early because other things will need them...(?)
+ this.initializeProperties();
+
+ this.initializeSpecifiedMappingFileRefs();
+ this.initializeJarFileRefs();
+ this.initializeSpecifiedClassRefs();
+
+ this.specifiedSharedCacheMode = this.buildSpecifiedSharedCacheMode();
+ this.specifiedValidationMode = this.buildSpecifiedValidationMode();
+
+ this.initializeMetamodelFiles();
+ }
+
+ /**
+ * These lists are just copies of what is distributed across the context
+ * model; so, if they have (virtually) changed, the resulting update has
+ * already been triggered. We don't need to trigger another one here.
+ */
+ @Override
+ protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
+ super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ nonUpdateAspectNames.add(GENERATORS_COLLECTION);
+ nonUpdateAspectNames.add(QUERIES_COLLECTION);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+
+ this.setName_(this.xmlPersistenceUnit.getName());
+ this.setSpecifiedExcludeUnlistedClasses_(this.xmlPersistenceUnit.getExcludeUnlistedClasses());
+ this.setSpecifiedTransactionType_(this.buildSpecifiedTransactionType());
+ this.setDescription_(this.xmlPersistenceUnit.getDescription());
+ this.setProvider_(this.xmlPersistenceUnit.getProvider());
+ this.setJtaDataSource_(this.xmlPersistenceUnit.getJtaDataSource());
+ this.setNonJtaDataSource_(this.xmlPersistenceUnit.getNonJtaDataSource());
+
+ this.syncSpecifiedMappingFileRefs();
+ this.syncImpliedMappingFileRef();
+
+ this.syncJarFileRefs();
+
+ this.syncSpecifiedClassRefs();
+ this.synchronizeNodesWithResourceModel(this.getImpliedClassRefs());
+
+ this.syncProperties();
+
+ this.setSpecifiedSharedCacheMode_(this.buildSpecifiedSharedCacheMode());
+ this.setSpecifiedValidationMode_(this.buildSpecifiedValidationMode());
+ }
+
+ // TODO bjv calculate generators and queries directly...
+ /**
+ * The 'generators' and 'queries' collections are simply cleared out with
+ * each "update" and completely rebuilt as the "update" cascades through
+ * the persistence unit. When the persistence unit's "update" is
+ * complete, the collections have been populated and we fire change events.
+ * <p>
+ * Note: Clearing and rebuilding 'generators' and 'queries' should work OK
+ * since JPA project "synchronization" is single-threaded.
+ * (Either the it takes place synchronously on a single thread or
+ * asynchronously in jobs that are synchronized via scheduling rules.)
+ * <p>
+ * See calls to the following:<ul>
+ * <li>{@link #addGenerator(Generator)}
+ * <li>{@link #addQuery(Query)}
+ * </ul>
+ * [see bug 311093 before attempting to change how this works]
+ */
+ @Override
+ public void update() {
+ super.update();
+
+ // see method comment above
+ this.generators.clear();
+ this.queries.clear();
+
+ this.setDefaultTransactionType(this.buildDefaultTransactionType());
+
+ // update specified class refs before mapping file refs because of
+ // JpaFile root structure nodes - we want the mapping file to "win",
+ // as it would in a JPA runtime implementation
+ this.updateNodes(this.getSpecifiedClassRefs());
+
+ this.updateNodes(this.getSpecifiedMappingFileRefs());
+ this.updateImpliedMappingFileRef();
+
+ this.updateNodes(this.getJarFileRefs());
+
+ // update the implied class refs after all the other types, both
+ // specified here and specified in the mapping files, are in place
+ this.updateImpliedClassRefs();
+
+ this.updateNodes(this.getProperties());
+
+ this.updatePersistenceUnitMetadata();
+
+ this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode());
+ this.setDefaultValidationMode(this.buildDefaultValidationMode());
+
+ // see method comment above
+ this.fireCollectionChanged(GENERATORS_COLLECTION, this.generators);
+ this.fireCollectionChanged(QUERIES_COLLECTION, this.queries);
+ }
+
+
+ // ********** JpaContextNode implementation **********
+
+ @Override
+ public Persistence getParent() {
+ return (Persistence) super.getParent();
+ }
+
+ @Override
+ public PersistenceUnit getPersistenceUnit() {
+ return this;
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return PersistenceStructureNodes.PERSISTENCE_UNIT_ID;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.xmlPersistenceUnit.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ for (ClassRef classRef : this.getClassRefs()) {
+ classRef.dispose();
+ }
+ for (JarFileRef jarFileRef : this.getJarFileRefs()) {
+ jarFileRef.dispose();
+ }
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ mappingFileRef.dispose();
+ }
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.setName_(name);
+ this.xmlPersistenceUnit.setName(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** transaction type **********
+
+ public PersistenceUnitTransactionType getTransactionType() {
+ return (this.specifiedTransactionType != null) ? this.specifiedTransactionType : this.defaultTransactionType;
+ }
+
+ public PersistenceUnitTransactionType getSpecifiedTransactionType() {
+ return this.specifiedTransactionType;
+ }
+
+ public void setSpecifiedTransactionType(PersistenceUnitTransactionType transactionType) {
+ this.setSpecifiedTransactionType_(transactionType);
+ this.xmlPersistenceUnit.setTransactionType(PersistenceUnitTransactionType.toXmlResourceModel(transactionType));
+ }
+
+ protected void setSpecifiedTransactionType_(PersistenceUnitTransactionType transactionType) {
+ PersistenceUnitTransactionType old = this.specifiedTransactionType;
+ this.specifiedTransactionType = transactionType;
+ this.firePropertyChanged(SPECIFIED_TRANSACTION_TYPE_PROPERTY, old, transactionType);
+ }
+
+ public PersistenceUnitTransactionType getDefaultTransactionType() {
+ return this.defaultTransactionType;
+ }
+
+ protected void setDefaultTransactionType(PersistenceUnitTransactionType transactionType) {
+ PersistenceUnitTransactionType old = this.defaultTransactionType;
+ this.defaultTransactionType = transactionType;
+ this.firePropertyChanged(DEFAULT_TRANSACTION_TYPE_PROPERTY, old, transactionType);
+ }
+
+ protected PersistenceUnitTransactionType buildSpecifiedTransactionType() {
+ return PersistenceUnitTransactionType.fromXmlResourceModel(this.xmlPersistenceUnit.getTransactionType());
+ }
+
+ /**
+ * TODO - calculate default
+ * From the JPA spec: "In a Java EE environment, if this element is not
+ * specified, the default is JTA. In a Java SE environment, if this element
+ * is not specified, a default of RESOURCE_LOCAL may be assumed."
+ */
+ protected PersistenceUnitTransactionType buildDefaultTransactionType() {
+ return PersistenceUnitTransactionType.JTA; //return JTA for now, fixing regression in bug 277524
+ }
+
+
+ // ********** description **********
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.setDescription_(description);
+ this.xmlPersistenceUnit.setDescription(description);
+ }
+
+ protected void setDescription_(String description) {
+ String old = this.description;
+ this.description = description;
+ this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description);
+ }
+
+
+ // ********** provider **********
+
+ public String getProvider() {
+ return this.provider;
+ }
+
+ public void setProvider(String provider) {
+ this.setProvider_(provider);
+ this.xmlPersistenceUnit.setProvider(provider);
+ }
+
+ protected void setProvider_(String provider) {
+ String old = this.provider;
+ this.provider = provider;
+ this.firePropertyChanged(PROVIDER_PROPERTY, old, provider);
+ }
+
+
+ // ********** JTA data source **********
+
+ public String getJtaDataSource() {
+ return this.jtaDataSource;
+ }
+
+ public void setJtaDataSource(String jtaDataSource) {
+ this.setJtaDataSource_(jtaDataSource);
+ this.xmlPersistenceUnit.setJtaDataSource(jtaDataSource);
+ }
+
+ protected void setJtaDataSource_(String jtaDataSource) {
+ String old = this.jtaDataSource;
+ this.jtaDataSource = jtaDataSource;
+ this.firePropertyChanged(JTA_DATA_SOURCE_PROPERTY, old, jtaDataSource);
+ }
+
+
+ // ********** non-JTA data source **********
+
+ public String getNonJtaDataSource() {
+ return this.nonJtaDataSource;
+ }
+
+ public void setNonJtaDataSource(String nonJtaDataSource) {
+ this.setNonJtaDataSource_(nonJtaDataSource);
+ this.xmlPersistenceUnit.setNonJtaDataSource(nonJtaDataSource);
+ }
+
+ protected void setNonJtaDataSource_(String nonJtaDataSource) {
+ String old = this.nonJtaDataSource;
+ this.nonJtaDataSource = nonJtaDataSource;
+ this.firePropertyChanged(NON_JTA_DATA_SOURCE_PROPERTY, old, nonJtaDataSource);
+ }
+
+
+ // ********** mapping file refs **********
+
+ public ListIterator<MappingFileRef> mappingFileRefs() {
+ return this.getMappingFileRefs().iterator();
+ }
+
+ protected Iterator<String> mappingFileRefNames() {
+ return new TransformationIterator<MappingFileRef, String>(this.mappingFileRefs()) {
+ @Override
+ protected String transform(MappingFileRef mappingFileRef) {
+ return mappingFileRef.getFileName();
+ }
+ };
+ }
+
+ protected ListIterable<MappingFileRef> getMappingFileRefs() {
+ return (this.impliedMappingFileRef == null) ?
+ this.getSpecifiedMappingFileRefs() :
+ this.getCombinedMappingFileRefs();
+ }
+
+ protected ListIterator<MappingFileRef> combinedMappingFileRefs() {
+ return this.getCombinedMappingFileRefs().iterator();
+ }
+
+ protected ListIterable<MappingFileRef> getCombinedMappingFileRefs() {
+ return new CompositeListIterable<MappingFileRef>(
+ this.getSpecifiedMappingFileRefs(),
+ this.impliedMappingFileRef
+ );
+ }
+
+ public int mappingFileRefsSize() {
+ return (this.impliedMappingFileRef == null) ?
+ this.specifiedMappingFileRefsSize() :
+ this.combinedMappingFileRefsSize();
+ }
+
+ protected int combinedMappingFileRefsSize() {
+ return this.specifiedMappingFileRefsSize() + 1;
+ }
+
+ public Iterator<MappingFileRef> mappingFileRefsContaining(final String typeName) {
+ return new FilteringIterator<MappingFileRef> (this.mappingFileRefs()) {
+ @Override
+ protected boolean accept(MappingFileRef mappingFileRef) {
+ return mappingFileRef.getPersistentType(typeName) != null;
+ }
+ };
+ }
+
+
+ // ********** specified mapping file refs **********
+
+ public ListIterator<MappingFileRef> specifiedMappingFileRefs() {
+ return this.getSpecifiedMappingFileRefs().iterator();
+ }
+
+ protected ListIterable<MappingFileRef> getSpecifiedMappingFileRefs() {
+ return new LiveCloneListIterable<MappingFileRef>(this.specifiedMappingFileRefs);
+ }
+
+ public int specifiedMappingFileRefsSize() {
+ return this.specifiedMappingFileRefs.size();
+ }
+
+ public MappingFileRef addSpecifiedMappingFileRef(String fileName) {
+ return this.addSpecifiedMappingFileRef(this.specifiedMappingFileRefs.size(), fileName);
+ }
+
+ public MappingFileRef addSpecifiedMappingFileRef(int index, String fileName) {
+ XmlMappingFileRef xmlMappingFileRef = this.buildXmlMappingFileRef(fileName);
+ MappingFileRef mappingFileRef = this.addSpecifiedMappingFileRef_(index, xmlMappingFileRef);
+ this.xmlPersistenceUnit.getMappingFiles().add(index, xmlMappingFileRef);
+ return mappingFileRef;
+ }
+
+ protected XmlMappingFileRef buildXmlMappingFileRef(String fileName) {
+ XmlMappingFileRef ref = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ ref.setFileName(fileName);
+ return ref;
+ }
+
+ protected MappingFileRef buildSpecifiedMappingFileRef(XmlMappingFileRef xmlMappingFileRef) {
+ return this.getContextNodeFactory().buildMappingFileRef(this, xmlMappingFileRef);
+ }
+
+ public void removeSpecifiedMappingFileRef(MappingFileRef mappingFileRef) {
+ this.removeSpecifiedMappingFileRef(this.specifiedMappingFileRefs.indexOf(mappingFileRef));
+ }
+
+ public void removeSpecifiedMappingFileRef(int index) {
+ this.removeSpecifiedMappingFileRef_(index);
+ this.xmlPersistenceUnit.getMappingFiles().remove(index);
+ }
+
+ /**
+ * dispose the mapping file ref
+ */
+ protected void removeSpecifiedMappingFileRef_(int index) {
+ this.removeItemFromList(index, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST).dispose();
+ }
+
+ protected void initializeSpecifiedMappingFileRefs() {
+ for (XmlMappingFileRef xmlMappingFileRef : this.getXmlMappingFileRefs()) {
+ this.specifiedMappingFileRefs.add(this.buildSpecifiedMappingFileRef(xmlMappingFileRef));
+ }
+ }
+
+ protected void syncSpecifiedMappingFileRefs() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedMappingFileRefContainerAdapter);
+ }
+
+ protected Iterable<XmlMappingFileRef> getXmlMappingFileRefs() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlMappingFileRef>(this.xmlPersistenceUnit.getMappingFiles());
+ }
+
+ protected void moveSpecifiedMappingFileRef_(int index, MappingFileRef mappingFileRef) {
+ this.moveItemInList(index, mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST);
+ }
+
+ protected MappingFileRef addSpecifiedMappingFileRef_(int index, XmlMappingFileRef xmlMappingFileRef) {
+ MappingFileRef mappingFileRef = this.buildSpecifiedMappingFileRef(xmlMappingFileRef);
+ this.addItemToList(index, mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST);
+ return mappingFileRef;
+ }
+
+ protected void removeSpecifiedMappingFileRef_(MappingFileRef mappingFileRef) {
+ this.removeSpecifiedMappingFileRef_(this.specifiedMappingFileRefs.indexOf(mappingFileRef));
+ }
+
+ /**
+ * specified mapping file ref container adapter
+ */
+ protected class SpecifiedMappingFileRefContainerAdapter
+ implements ContextContainerTools.Adapter<MappingFileRef, XmlMappingFileRef>
+ {
+ public Iterable<MappingFileRef> getContextElements() {
+ return AbstractPersistenceUnit.this.getSpecifiedMappingFileRefs();
+ }
+ public Iterable<XmlMappingFileRef> getResourceElements() {
+ return AbstractPersistenceUnit.this.getXmlMappingFileRefs();
+ }
+ public XmlMappingFileRef getResourceElement(MappingFileRef contextElement) {
+ return contextElement.getXmlMappingFileRef();
+ }
+ public void moveContextElement(int index, MappingFileRef element) {
+ AbstractPersistenceUnit.this.moveSpecifiedMappingFileRef_(index, element);
+ }
+ public void addContextElement(int index, XmlMappingFileRef resourceElement) {
+ AbstractPersistenceUnit.this.addSpecifiedMappingFileRef_(index, resourceElement);
+ }
+ public void removeContextElement(MappingFileRef element) {
+ AbstractPersistenceUnit.this.removeSpecifiedMappingFileRef_(element);
+ }
+ }
+
+
+ // ********** implied mapping file ref **********
+
+ public MappingFileRef getImpliedMappingFileRef() {
+ return this.impliedMappingFileRef;
+ }
+
+ protected MappingFileRef addImpliedMappingFileRef() {
+ if (this.impliedMappingFileRef != null) {
+ throw new IllegalStateException("The implied mapping file ref is already set: " + this.impliedMappingFileRef); //$NON-NLS-1$
+ }
+ this.impliedMappingFileRef = this.buildImpliedMappingFileRef();
+ this.firePropertyChanged(IMPLIED_MAPPING_FILE_REF_PROPERTY, null, this.impliedMappingFileRef);
+ return this.impliedMappingFileRef;
+ }
+
+ protected MappingFileRef buildImpliedMappingFileRef() {
+ return this.getContextNodeFactory().buildImpliedMappingFileRef(this);
+ }
+
+ protected void removeImpliedMappingFileRef() {
+ if (this.impliedMappingFileRef == null) {
+ throw new IllegalStateException("The implied mapping file ref is already unset."); //$NON-NLS-1$
+ }
+ MappingFileRef old = this.impliedMappingFileRef;
+ this.impliedMappingFileRef = null;
+ old.dispose();
+ this.firePropertyChanged(IMPLIED_MAPPING_FILE_REF_PROPERTY, old, null);
+ }
+
+ protected void syncImpliedMappingFileRef() {
+ if (this.impliedMappingFileRef != null) {
+ this.impliedMappingFileRef.synchronizeWithResourceModel();
+ }
+ }
+
+ protected void updateImpliedMappingFileRef() {
+ if (this.buildsImpliedMappingFile()) {
+ if (this.impliedMappingFileRef == null) {
+ this.addImpliedMappingFileRef();
+ } else {
+ this.impliedMappingFileRef.update();
+ }
+ } else {
+ if (this.impliedMappingFileRef != null) {
+ this.removeImpliedMappingFileRef();
+ }
+ }
+ }
+
+ protected boolean buildsImpliedMappingFile() {
+ return this.impliedMappingFileIsNotSpecified() && this.impliedMappingFileExists();
+ }
+
+ protected boolean impliedMappingFileIsNotSpecified() {
+ return ! this.impliedMappingFileIsSpecified();
+ }
+
+ protected boolean impliedMappingFileIsSpecified() {
+ return this.mappingFileIsSpecified(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ }
+
+ protected boolean mappingFileIsSpecified(String impliedMappingFileName) {
+ for (MappingFileRef specifiedMappingFileRef : this.getSpecifiedMappingFileRefs()) {
+ if (Tools.valuesAreEqual(specifiedMappingFileRef.getFileName(), impliedMappingFileName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean impliedMappingFileExists() {
+ return this.getJpaProject().getDefaultOrmXmlResource() != null;
+ }
+
+
+ // ********** JAR file refs **********
+
+ public ListIterator<JarFileRef> jarFileRefs() {
+ return this.getJarFileRefs().iterator();
+ }
+
+ protected ListIterable<JarFileRef> getJarFileRefs() {
+ return new LiveCloneListIterable<JarFileRef>(this.jarFileRefs);
+ }
+
+ public int jarFileRefsSize() {
+ return this.jarFileRefs.size();
+ }
+
+ protected Iterator<String> jarFileNames() {
+ return new TransformationIterator<JarFileRef, String>(this.jarFileRefs()) {
+ @Override
+ protected String transform(JarFileRef jarFileRef) {
+ return jarFileRef.getFileName();
+ }
+ };
+ }
+
+ public JarFileRef addJarFileRef(String fileName) {
+ return this.addJarFileRef(this.jarFileRefs.size(), fileName);
+ }
+
+ public JarFileRef addJarFileRef(int index, String fileName) {
+ XmlJarFileRef xmlJarFileRef = this.buildXmlJarFileRef(fileName);
+ JarFileRef jarFileRef = this.addJarFileRef_(index, xmlJarFileRef);
+ this.xmlPersistenceUnit.getJarFiles().add(index, xmlJarFileRef);
+ return jarFileRef;
+ }
+
+ protected XmlJarFileRef buildXmlJarFileRef(String fileName) {
+ XmlJarFileRef ref = PersistenceFactory.eINSTANCE.createXmlJarFileRef();
+ ref.setFileName(fileName);
+ return ref;
+ }
+
+ protected JarFileRef buildJarFileRef(XmlJarFileRef xmlJarFileRef) {
+ return this.getContextNodeFactory().buildJarFileRef(this, xmlJarFileRef);
+ }
+
+ public void removeJarFileRef(JarFileRef jarFileRef) {
+ this.removeJarFileRef(this.jarFileRefs.indexOf(jarFileRef));
+ }
+
+ public void removeJarFileRef(int index) {
+ this.removeJarFileRef_(index);
+ this.xmlPersistenceUnit.getJarFiles().remove(index);
+ }
+
+ /**
+ * dispose the JAR file ref
+ */
+ protected void removeJarFileRef_(int index) {
+ this.removeItemFromList(index, this.jarFileRefs, JAR_FILE_REFS_LIST).dispose();
+ }
+
+ protected void initializeJarFileRefs() {
+ for (XmlJarFileRef xmlJarFileRef : this.getXmlJarFileRefs()) {
+ this.jarFileRefs.add(this.buildJarFileRef(xmlJarFileRef));
+ }
+ }
+
+ protected void syncJarFileRefs() {
+ ContextContainerTools.synchronizeWithResourceModel(this.jarFileRefContainerAdapter);
+ }
+
+ protected Iterable<XmlJarFileRef> getXmlJarFileRefs() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlJarFileRef>(this.xmlPersistenceUnit.getJarFiles());
+ }
+
+ protected void moveJarFileRef_(int index, JarFileRef jarFileRef) {
+ this.moveItemInList(index, jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST);
+ }
+
+ protected JarFileRef addJarFileRef_(int index, XmlJarFileRef xmlJarFileRef) {
+ JarFileRef jarFileRef = this.buildJarFileRef(xmlJarFileRef);
+ this.addItemToList(index, jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST);
+ return jarFileRef;
+ }
+
+ protected void removeJarFileRef_(JarFileRef jarFileRef) {
+ this.removeJarFileRef_(this.jarFileRefs.indexOf(jarFileRef));
+ }
+
+ /**
+ * JAR file ref container adapter
+ */
+ protected class JarFileRefContainerAdapter
+ implements ContextContainerTools.Adapter<JarFileRef, XmlJarFileRef>
+ {
+ public Iterable<JarFileRef> getContextElements() {
+ return AbstractPersistenceUnit.this.getJarFileRefs();
+ }
+ public Iterable<XmlJarFileRef> getResourceElements() {
+ return AbstractPersistenceUnit.this.getXmlJarFileRefs();
+ }
+ public XmlJarFileRef getResourceElement(JarFileRef contextElement) {
+ return contextElement.getXmlJarFileRef();
+ }
+ public void moveContextElement(int index, JarFileRef element) {
+ AbstractPersistenceUnit.this.moveJarFileRef_(index, element);
+ }
+ public void addContextElement(int index, XmlJarFileRef resourceElement) {
+ AbstractPersistenceUnit.this.addJarFileRef_(index, resourceElement);
+ }
+ public void removeContextElement(JarFileRef element) {
+ AbstractPersistenceUnit.this.removeJarFileRef_(element);
+ }
+ }
+
+
+ // ********** class refs **********
+
+ public Iterator<ClassRef> classRefs() {
+ return this.getClassRefs().iterator();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<ClassRef> getClassRefs() {
+ return new CompositeIterable<ClassRef>(
+ this.getSpecifiedClassRefs(),
+ this.getImpliedClassRefs()
+ );
+ }
+
+ public int classRefsSize() {
+ return this.specifiedClassRefs.size() + this.impliedClassRefs.size();
+ }
+
+ protected Iterator<String> classRefNames() {
+ return new TransformationIterator<ClassRef, String>(this.classRefs()) {
+ @Override
+ protected String transform(ClassRef classRef) {
+ return classRef.getClassName();
+ }
+ };
+ }
+
+
+ // ********** specified class refs **********
+
+ public ListIterator<ClassRef> specifiedClassRefs() {
+ return this.getSpecifiedClassRefs().iterator();
+ }
+
+ protected ListIterable<ClassRef> getSpecifiedClassRefs() {
+ return new LiveCloneListIterable<ClassRef>(this.specifiedClassRefs);
+ }
+
+ public int specifiedClassRefsSize() {
+ return this.specifiedClassRefs.size();
+ }
+
+ public ClassRef addSpecifiedClassRef(String className) {
+ return this.addSpecifiedClassRef(this.specifiedClassRefs.size(), className);
+ }
+
+ public ClassRef addSpecifiedClassRef(int index, String className) {
+ XmlJavaClassRef xmlClassRef = this.buildXmlJavaClassRef(className);
+ ClassRef classRef = this.addSpecifiedClassRef_(index, xmlClassRef);
+ this.xmlPersistenceUnit.getClasses().add(index, xmlClassRef);
+ return classRef;
+ }
+
+ protected XmlJavaClassRef buildXmlJavaClassRef(String className) {
+ XmlJavaClassRef ref = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ ref.setJavaClass(className);
+ return ref;
+ }
+
+ protected ClassRef buildClassRef(XmlJavaClassRef xmlClassRef) {
+ return this.getContextNodeFactory().buildClassRef(this, xmlClassRef);
+ }
+
+ public void removeSpecifiedClassRef(ClassRef classRef) {
+ this.removeSpecifiedClassRef(this.specifiedClassRefs.indexOf(classRef));
+ }
+
+ public void removeSpecifiedClassRef(int index) {
+ this.removeSpecifiedClassRef_(index);
+ this.xmlPersistenceUnit.getClasses().remove(index);
+ }
+
+ /**
+ * dispose the class ref
+ */
+ protected void removeSpecifiedClassRef_(int index) {
+ this.removeItemFromList(index, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST).dispose();
+ }
+
+ protected void initializeSpecifiedClassRefs() {
+ for (XmlJavaClassRef xmlJavaClassRef : this.getXmlClassRefs()) {
+ this.specifiedClassRefs.add(this.buildClassRef(xmlJavaClassRef));
+ }
+ }
+
+ protected void syncSpecifiedClassRefs() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedClassRefContainerAdapter);
+ }
+
+ protected Iterable<XmlJavaClassRef> getXmlClassRefs() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlJavaClassRef>(this.xmlPersistenceUnit.getClasses());
+ }
+
+ protected void moveSpecifiedClassRef_(int index, ClassRef classRef) {
+ this.moveItemInList(index, classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST);
+ }
+
+ protected ClassRef addSpecifiedClassRef_(int index, XmlJavaClassRef xmlClassRef) {
+ ClassRef classRef = this.buildClassRef(xmlClassRef);
+ this.addItemToList(index, classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST);
+ return classRef;
+ }
+
+ protected void removeSpecifiedClassRef_(ClassRef classRef) {
+ this.removeSpecifiedClassRef_(this.specifiedClassRefs.indexOf(classRef));
+ }
+
+ /**
+ * specified class ref container adapter
+ */
+ protected class SpecifiedClassRefContainerAdapter
+ implements ContextContainerTools.Adapter<ClassRef, XmlJavaClassRef>
+ {
+ public Iterable<ClassRef> getContextElements() {
+ return AbstractPersistenceUnit.this.getSpecifiedClassRefs();
+ }
+ public Iterable<XmlJavaClassRef> getResourceElements() {
+ return AbstractPersistenceUnit.this.getXmlClassRefs();
+ }
+ public XmlJavaClassRef getResourceElement(ClassRef contextElement) {
+ return contextElement.getXmlClassRef();
+ }
+ public void moveContextElement(int index, ClassRef element) {
+ AbstractPersistenceUnit.this.moveSpecifiedClassRef_(index, element);
+ }
+ public void addContextElement(int index, XmlJavaClassRef resourceElement) {
+ AbstractPersistenceUnit.this.addSpecifiedClassRef_(index, resourceElement);
+ }
+ public void removeContextElement(ClassRef element) {
+ AbstractPersistenceUnit.this.removeSpecifiedClassRef_(element);
+ }
+ }
+
+
+ // ********** virtual class refs **********
+
+ public Iterator<ClassRef> impliedClassRefs() {
+ return this.getImpliedClassRefs().iterator();
+ }
+
+ protected Iterable<ClassRef> getImpliedClassRefs() {
+ return new LiveCloneIterable<ClassRef>(this.impliedClassRefs);
+ }
+
+ public int impliedClassRefsSize() {
+ return this.impliedClassRefs.size();
+ }
+
+ protected ClassRef addImpliedClassRef(String className) {
+ ClassRef classRef = this.buildClassRef(className);
+ this.addItemToCollection(classRef, this.impliedClassRefs, IMPLIED_CLASS_REFS_COLLECTION);
+ return classRef;
+ }
+
+ protected ClassRef buildClassRef(String className) {
+ return this.getContextNodeFactory().buildClassRef(this, className);
+ }
+
+ protected void removeImpliedClassRef(ClassRef classRef) {
+ this.impliedClassRefs.remove(classRef);
+ classRef.dispose();
+ this.fireItemRemoved(IMPLIED_CLASS_REFS_COLLECTION, classRef);
+ }
+
+ protected void updateImpliedClassRefs() {
+ ContextContainerTools.update(this.impliedClassRefContainerAdapter);
+ }
+
+ protected Iterable<String> getImpliedClassNames() {
+ return this.excludesUnlistedClasses() ?
+ EmptyIterable.<String>instance() :
+ this.getImpliedClassNames_();
+ }
+
+ /**
+ * Return the names of all the Java classes in the JPA project that are
+ * mapped (i.e. have the appropriate annotation etc.) but not specified
+ * in the persistence unit.
+ */
+ protected Iterable<String> getImpliedClassNames_() {
+ return new FilteringIterable<String>(this.getJpaProject().getMappedJavaSourceClassNames()) {
+ @Override
+ protected boolean accept(String mappedClassName) {
+ return ! AbstractPersistenceUnit.this.specifiesPersistentType(mappedClassName);
+ }
+ };
+ }
+
+ /**
+ * Virtual class ref container adapter.
+ * <p>
+ * <strong>NB:</strong> The context class ref is matched with a resource
+ * class by name.
+ * <p>
+ * This is used during <strong>both</strong> <em>sync</em> and
+ * <em>update</em> because the list of implied class refs can be modified
+ * in either situation. In particular, we cannot simply rely on
+ * <em>update</em> because there are situations where a <em>sync</em> is
+ * triggered but a follow-up <em>update</em> is not. (Of course, any
+ * change discovered here will trigger an <em>update</em>.)
+ * <p>
+ * The most obvious example is when the JPA project is configured to
+ * discover annotated classes and a Java class is annotated for the first
+ * time (via code editing, not via the context model). This will trigger
+ * a <em>sync</em>; but, since the unannotated class is not yet in the
+ * context model and, as a result, the context model's state is untouched,
+ * an <em>update</em> will not be triggered.
+ * <p>
+ * Obviously, other context model changes can change this collection (e.g.
+ * setting whether the persistence unit excludes unlisted classes); o the
+ * collection must also be synchronized during <em>update</em>.
+ */
+ protected class ImpliedClassRefContainerAdapter
+ implements ContextContainerTools.Adapter<ClassRef, String>
+ {
+ public Iterable<ClassRef> getContextElements() {
+ return AbstractPersistenceUnit.this.getImpliedClassRefs();
+ }
+ public Iterable<String> getResourceElements() {
+ return AbstractPersistenceUnit.this.getImpliedClassNames();
+ }
+ public String getResourceElement(ClassRef contextElement) {
+ return contextElement.getClassName();
+ }
+ public void moveContextElement(int index, ClassRef element) {
+ // ignore moves - we don't care about the order of the implied class refs
+ }
+ public void addContextElement(int index, String resourceElement) {
+ // ignore the index - we don't care about the order of the implied class refs
+ AbstractPersistenceUnit.this.addImpliedClassRef(resourceElement);
+ }
+ public void removeContextElement(ClassRef element) {
+ AbstractPersistenceUnit.this.removeImpliedClassRef(element);
+ }
+ }
+
+
+ // ********** exclude unlisted classes **********
+
+ public boolean excludesUnlistedClasses() {
+ return (this.specifiedExcludeUnlistedClasses != null) ? this.specifiedExcludeUnlistedClasses.booleanValue() : this.getDefaultExcludeUnlistedClasses();
+ }
+
+ public Boolean getSpecifiedExcludeUnlistedClasses() {
+ return this.specifiedExcludeUnlistedClasses;
+ }
+
+ public void setSpecifiedExcludeUnlistedClasses(Boolean specifiedExcludeUnlistedClasses) {
+ this.setSpecifiedExcludeUnlistedClasses_(specifiedExcludeUnlistedClasses);
+ this.xmlPersistenceUnit.setExcludeUnlistedClasses(this.specifiedExcludeUnlistedClasses);
+ }
+
+ protected void setSpecifiedExcludeUnlistedClasses_(Boolean excludeUnlistedClasses) {
+ Boolean old = this.specifiedExcludeUnlistedClasses;
+ this.specifiedExcludeUnlistedClasses = excludeUnlistedClasses;
+ this.firePropertyChanged(SPECIFIED_EXCLUDE_UNLISTED_CLASSES_PROPERTY, old, excludeUnlistedClasses);
+ }
+
+ public boolean getDefaultExcludeUnlistedClasses() {
+ return false; // ???
+ }
+
+
+ // ********** properties **********
+
+ public ListIterator<Property> properties() {
+ return this.getProperties().iterator();
+ }
+
+ protected ListIterable<Property> getProperties() {
+ return new LiveCloneListIterable<Property>(this.properties);
+ }
+
+ public int propertiesSize() {
+ return this.properties.size();
+ }
+
+ public Property getProperty(String propertyName) {
+ if (propertyName == null) {
+ throw new NullPointerException();
+ }
+ for (Property property : this.getProperties()) {
+ if (propertyName.equals(property.getName())) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ public Iterable<Property> getPropertiesNamed(final String propertyName) {
+ if (propertyName == null) {
+ throw new NullPointerException();
+ }
+ return new FilteringIterable<Property>(this.getProperties()) {
+ @Override
+ protected boolean accept(Property property) {
+ return Tools.valuesAreEqual(property.getName(), propertyName);
+ }
+ };
+ }
+
+ public Iterator<Property> propertiesWithNamePrefix(final String propertyNamePrefix) {
+ if (propertyNamePrefix == null) {
+ throw new NullPointerException();
+ }
+ return new FilteringIterator<Property>(this.properties()) {
+ @Override
+ protected boolean accept(Property property) {
+ String pName = property.getName();
+ return (pName != null) && pName.startsWith(propertyNamePrefix);
+ }
+ };
+ }
+
+ public Property addProperty() {
+ return this.addProperty(this.properties.size());
+ }
+
+ public Property addProperty(int index) {
+ XmlProperty xmlProperty = this.buildXmlProperty();
+ Property property = this.addProperty_(index, xmlProperty);
+
+ XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
+ if (xmlProperties == null) {
+ xmlProperties = this.buildXmlProperties();
+ this.xmlPersistenceUnit.setProperties(xmlProperties);
+ }
+
+ xmlProperties.getProperties().add(index, xmlProperty);
+ if (property.getName() != null) {
+ this.propertyAdded(property.getName(), property.getValue());
+ }
+ return property;
+ }
+
+ protected XmlProperty buildXmlProperty() {
+ return PersistenceFactory.eINSTANCE.createXmlProperty();
+ }
+
+ protected Property buildProperty(XmlProperty xmlProperty) {
+ return this.getContextNodeFactory().buildProperty(this, xmlProperty);
+ }
+
+ protected XmlProperties buildXmlProperties() {
+ return PersistenceFactory.eINSTANCE.createXmlProperties();
+ }
+
+ public void setProperty(String propertyName, String value) {
+ this.setProperty(propertyName, value, false);
+ }
+
+ public void setProperty(String propertyName, String value, boolean duplicatePropertyNamesAllowed) {
+ Property prev = this.getProperty(propertyName);
+ if (prev == null) {
+ if (value != null) {
+ this.addProperty(propertyName, value); // add [first] property
+ }
+ } else {
+ if (duplicatePropertyNamesAllowed) {
+ if (value == null) {
+ // do nothing?
+ } else {
+ this.addProperty(propertyName, value); // add [duplicate] property
+ }
+ } else {
+ if (value == null) {
+ this.removeProperty(prev); // remove existing property
+ } else {
+ prev.setValue(value); // change existing property
+ }
+ }
+ }
+ }
+
+ protected void addProperty(String propertyName, String value) {
+ Property property = this.addProperty();
+ property.setName(propertyName);
+ property.setValue(value);
+ }
+
+ public void removeProperty(Property property) {
+ this.removeProperty(this.properties.indexOf(property));
+ }
+
+ public void removeProperty(String propertyName) {
+ if (propertyName == null) {
+ throw new NullPointerException();
+ }
+ for (ListIterator<Property> stream = this.properties.listIterator(); stream.hasNext(); ) {
+ Property property = stream.next();
+ if (propertyName.equals(property.getName())) {
+ this.removeProperty(stream.previousIndex());
+ return;
+ }
+ }
+ throw new IllegalArgumentException("invalid property name: " + propertyName); //$NON-NLS-1$
+ }
+
+ public void removeProperty(String propertyName, String value) {
+ if ((propertyName == null) || (value == null)) {
+ throw new NullPointerException();
+ }
+ for (ListIterator<Property> stream = this.properties.listIterator(); stream.hasNext(); ) {
+ Property property = stream.next();
+ if (propertyName.equals(property.getName()) && value.equals(property.getValue())) {
+ this.removeProperty(stream.previousIndex());
+ return;
+ }
+ }
+ throw new IllegalArgumentException("invalid property name/value pair: " + propertyName + " = " + value); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ protected void removeProperty(int index) {
+ Property removedProperty = this.properties.remove(index);
+ this.xmlPersistenceUnit.getProperties().getProperties().remove(index);
+
+ if (this.xmlPersistenceUnit.getProperties().getProperties().isEmpty()) {
+ this.xmlPersistenceUnit.setProperties(null);
+ }
+
+ this.fireItemRemoved(PROPERTIES_LIST, index, removedProperty);
+ if (removedProperty.getName() != null) {
+ this.propertyRemoved(removedProperty.getName());
+ }
+ }
+
+ public void propertyNameChanged(String oldPropertyName, String newPropertyName, String value) {
+ if ((oldPropertyName == null) && (value == null)) {
+ //this is a property that is currently being added, we don't need to deal with it until the value is set
+ return;
+ }
+ if (oldPropertyName != null) {
+ this.propertyRemoved(oldPropertyName);
+ }
+ if (newPropertyName != null) {
+ this.propertyAdded(newPropertyName, value);
+ }
+ }
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ this.connection.propertyValueChanged(propertyName, newValue);
+ this.options.propertyValueChanged(propertyName, newValue);
+ }
+
+ protected void propertyAdded(String propertyName, String value) {
+ this.propertyValueChanged(propertyName, value);
+ }
+
+ protected void propertyRemoved(String propertyName) {
+ this.connection.propertyRemoved(propertyName);
+ this.options.propertyRemoved(propertyName);
+ }
+
+ protected void initializeProperties() {
+ for (XmlProperty xmlProperty : this.getXmlProperties()) {
+ this.properties.add(this.buildProperty(xmlProperty));
+ }
+ this.connection = this.getContextNodeFactory().buildConnection(this);
+ this.options = this.getContextNodeFactory().buildOptions(this);
+ }
+
+ protected void syncProperties() {
+ ContextContainerTools.synchronizeWithResourceModel(this.propertyContainerAdapter);
+ }
+
+ protected Iterable<XmlProperty> getXmlProperties() {
+ XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
+ // clone to reduce chance of concurrency problems
+ return (xmlProperties == null) ?
+ EmptyIterable.<XmlProperty>instance() :
+ new LiveCloneIterable<XmlProperty>(xmlProperties.getProperties());
+ }
+
+ protected void moveProperty_(int index, Property property) {
+ this.moveItemInList(index, this.properties.indexOf(property), this.properties, PROPERTIES_LIST);
+ }
+
+ protected Property addProperty_(int index, XmlProperty xmlProperty) {
+ Property property = this.buildProperty(xmlProperty);
+ this.addItemToList(index, property, this.properties, PROPERTIES_LIST);
+ if (property.getName() != null) {
+ this.propertyAdded(property.getName(), property.getValue());
+ }
+ return property;
+ }
+
+ protected void removeProperty_(Property property) {
+ this.removeItemFromList(property, this.properties, PROPERTIES_LIST);
+ if (property.getName() != null) {
+ this.propertyRemoved(property.getName());
+ }
+ }
+
+ /**
+ * property container adapter
+ */
+ protected class PropertyContainerAdapter
+ implements ContextContainerTools.Adapter<Property, XmlProperty>
+ {
+ public Iterable<Property> getContextElements() {
+ return AbstractPersistenceUnit.this.getProperties();
+ }
+ public Iterable<XmlProperty> getResourceElements() {
+ return AbstractPersistenceUnit.this.getXmlProperties();
+ }
+ public XmlProperty getResourceElement(Property contextElement) {
+ return contextElement.getXmlProperty();
+ }
+ public void moveContextElement(int index, Property element) {
+ AbstractPersistenceUnit.this.moveProperty_(index, element);
+ }
+ public void addContextElement(int index, XmlProperty resourceElement) {
+ AbstractPersistenceUnit.this.addProperty_(index, resourceElement);
+ }
+ public void removeContextElement(Property element) {
+ AbstractPersistenceUnit.this.removeProperty_(element);
+ }
+ }
+
+
+ // ********** mapping file (orm.xml) persistence unit metadata & defaults **********
+
+ public boolean isXmlMappingMetadataComplete() {
+ return this.xmlMappingMetadataComplete;
+ }
+
+ protected void setXmlMappingMetadataComplete(boolean xmlMappingMetadataComplete) {
+ boolean old = this.xmlMappingMetadataComplete;
+ this.xmlMappingMetadataComplete = xmlMappingMetadataComplete;
+ this.firePropertyChanged(XML_MAPPING_METADATA_COMPLETE_PROPERTY, old, xmlMappingMetadataComplete);
+ }
+
+ protected boolean buildXmlMappingMetadataComplete(MappingFilePersistenceUnitMetadata metadata) {
+ return (metadata == null) ? false : metadata.isXmlMappingMetadataComplete();
+ }
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType access) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = access;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildDefaultCatalog(MappingFilePersistenceUnitDefaults defaults) {
+ String catalog = (defaults == null) ? null : defaults.getCatalog();
+ return (catalog != null) ? catalog : this.getJpaProject().getDefaultCatalog();
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildDefaultSchema(MappingFilePersistenceUnitDefaults defaults) {
+ String schema = (defaults == null) ? null : defaults.getSchema();
+ return (schema != null) ? schema : this.getJpaProject().getDefaultSchema();
+ }
+
+ public boolean getDefaultCascadePersist() {
+ return this.defaultCascadePersist;
+ }
+
+ protected void setDefaultCascadePersist(boolean cascadePersist) {
+ boolean old = this.defaultCascadePersist;
+ this.defaultCascadePersist = cascadePersist;
+ this.firePropertyChanged(DEFAULT_CASCADE_PERSIST_PROPERTY, old, cascadePersist);
+ }
+
+ protected boolean buildDefaultCascadePersist(MappingFilePersistenceUnitDefaults defaults) {
+ return (defaults == null) ? false : defaults.isCascadePersist();
+ }
+
+ public boolean getDefaultDelimitedIdentifiers() {
+ return this.defaultDelimitedIdentifiers;
+ }
+
+ protected void setDefaultDelimitedIdentifiers(boolean delimitedIdentifiers) {
+ boolean old = this.defaultDelimitedIdentifiers;
+ this.defaultDelimitedIdentifiers = delimitedIdentifiers;
+ this.firePropertyChanged(DEFAULT_DELIMITED_IDENTIFIERS_PROPERTY, old, delimitedIdentifiers);
+ }
+
+ protected boolean buildDefaultDelimitedIdentifiers(MappingFilePersistenceUnitDefaults defaults) {
+ return ( ! this.isJpa2_0Compatible()) ? false :
+ (defaults == null) ? false : ((MappingFilePersistenceUnitDefaults2_0) defaults).isDelimitedIdentifiers();
+ }
+
+ protected void updatePersistenceUnitMetadata() {
+ MappingFilePersistenceUnitMetadata metadata = this.getMetadata();
+ this.setXmlMappingMetadataComplete(this.buildXmlMappingMetadataComplete(metadata));
+
+ MappingFilePersistenceUnitDefaults defaults = (metadata == null) ? null : metadata.getPersistenceUnitDefaults();
+ this.setDefaultAccess((defaults == null) ? null : defaults.getAccess());
+ this.setDefaultCatalog(this.buildDefaultCatalog(defaults));
+ this.setDefaultSchema(this.buildDefaultSchema(defaults));
+ this.setDefaultDelimitedIdentifiers(this.buildDefaultDelimitedIdentifiers(defaults));
+ }
+
+ /**
+ * return the first persistence unit metadata we encounter
+ * in a mapping file
+ */
+ protected MappingFilePersistenceUnitMetadata getMetadata() {
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ if (mappingFileRef.persistenceUnitMetadataExists()) {
+ return mappingFileRef.getPersistenceUnitMetadata();
+ }
+ }
+ return null;
+ }
+
+
+ // ********** PersistenceUnit2_0 implementation **********
+
+ public PersistenceUnitProperties getConnection() {
+ return this.connection;
+ }
+
+ public PersistenceUnitProperties getOptions() {
+ return this.options;
+ }
+
+
+ // ********** shared cache mode **********
+
+ public SharedCacheMode getSharedCacheMode() {
+ return (this.specifiedSharedCacheMode != null) ? this.specifiedSharedCacheMode : this.defaultSharedCacheMode;
+ }
+
+ public SharedCacheMode getSpecifiedSharedCacheMode() {
+ return this.specifiedSharedCacheMode;
+ }
+
+ public void setSpecifiedSharedCacheMode(SharedCacheMode specifiedSharedCacheMode) {
+ this.setSpecifiedSharedCacheMode_(specifiedSharedCacheMode);
+ this.xmlPersistenceUnit.setSharedCacheMode(SharedCacheMode.toXmlResourceModel(specifiedSharedCacheMode));
+ }
+
+ protected void setSpecifiedSharedCacheMode_(SharedCacheMode sharedCacheMode) {
+ SharedCacheMode old = this.specifiedSharedCacheMode;
+ this.specifiedSharedCacheMode = sharedCacheMode;
+ this.firePropertyChanged(SPECIFIED_SHARED_CACHE_MODE_PROPERTY, old, sharedCacheMode);
+ }
+
+ public SharedCacheMode getDefaultSharedCacheMode() {
+ return this.defaultSharedCacheMode;
+ }
+
+ protected void setDefaultSharedCacheMode(SharedCacheMode defaultSharedCacheMode) {
+ SharedCacheMode old = this.defaultSharedCacheMode;
+ this.defaultSharedCacheMode = defaultSharedCacheMode;
+ this.firePropertyChanged(DEFAULT_SHARED_CACHE_MODE_PROPERTY, old, defaultSharedCacheMode);
+ }
+
+ public boolean calculateDefaultCacheable() {
+ SharedCacheMode sharedCacheMode = this.getSharedCacheMode();
+ if (sharedCacheMode == null) {
+ return false; // this can happen during initial update...
+ }
+ switch (sharedCacheMode) {
+ case NONE:
+ case ENABLE_SELECTIVE:
+ case UNSPECIFIED:
+ return false;
+ case ALL:
+ case DISABLE_SELECTIVE:
+ return true;
+ default:
+ throw new IllegalStateException("unknown mode: " + sharedCacheMode); //$NON-NLS-1$
+ }
+ }
+
+ protected SharedCacheMode buildSpecifiedSharedCacheMode() {
+ return SharedCacheMode.fromXmlResourceModel(this.xmlPersistenceUnit.getSharedCacheMode());
+ }
+
+ protected SharedCacheMode buildDefaultSharedCacheMode() {
+ return SharedCacheMode.UNSPECIFIED;
+ }
+
+ // ********** validation mode **********
+
+ public ValidationMode getValidationMode() {
+ return (this.specifiedValidationMode != null) ? this.specifiedValidationMode : this.defaultValidationMode;
+ }
+
+ public ValidationMode getSpecifiedValidationMode() {
+ return this.specifiedValidationMode;
+ }
+
+ public void setSpecifiedValidationMode(ValidationMode specifiedValidationMode) {
+ this.setSpecifiedValidationMode_(specifiedValidationMode);
+ this.xmlPersistenceUnit.setValidationMode(ValidationMode.toXmlResourceModel(specifiedValidationMode));
+ }
+
+ protected void setSpecifiedValidationMode_(ValidationMode validationMode) {
+ ValidationMode old = this.specifiedValidationMode;
+ this.specifiedValidationMode = validationMode;
+ this.firePropertyChanged(SPECIFIED_VALIDATION_MODE_PROPERTY, old, validationMode);
+ }
+
+ public ValidationMode getDefaultValidationMode() {
+ return this.defaultValidationMode;
+ }
+
+ protected void setDefaultValidationMode(ValidationMode defaultValidationMode) {
+ ValidationMode old = this.defaultValidationMode;
+ this.defaultValidationMode = defaultValidationMode;
+ this.firePropertyChanged(DEFAULT_VALIDATION_MODE_PROPERTY, old, defaultValidationMode);
+ }
+
+ protected ValidationMode buildSpecifiedValidationMode() {
+ return ValidationMode.fromXmlResourceModel(this.xmlPersistenceUnit.getValidationMode());
+ }
+
+ protected ValidationMode buildDefaultValidationMode() {
+ return DEFAULT_VALIDATION_MODE;
+ }
+
+
+ // ********** generators **********
+
+ public Iterator<Generator> generators() {
+ return this.getGenerators().iterator();
+ }
+
+ protected Iterable<Generator> getGenerators() {
+ return new LiveCloneIterable<Generator>(this.generators);
+ }
+
+ public int generatorsSize() {
+ return this.generators.size();
+ }
+
+ public void addGenerator(Generator generator) {
+ this.generators.add(generator);
+ }
+
+ public Iterable<String> getUniqueGeneratorNames() {
+ HashSet<String> names = new HashSet<String>(this.generators.size());
+ this.addNonNullGeneratorNamesTo(names);
+ return names;
+ }
+
+ protected void addNonNullGeneratorNamesTo(Set<String> names) {
+ for (Generator generator : this.getGenerators()) {
+ String generatorName = generator.getName();
+ if (generatorName != null) {
+ names.add(generatorName);
+ }
+ }
+ }
+
+
+ // ********** queries **********
+
+ public Iterator<Query> queries() {
+ return new CloneIterator<Query>(this.queries);
+ }
+
+ public int queriesSize() {
+ return this.queries.size();
+ }
+
+ public void addQuery(Query query) {
+ this.queries.add(query);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateMappingFiles(messages, reporter);
+ this.validateClassRefs(messages, reporter);
+ this.validateJarFileRefs(messages, reporter);
+ this.validateProperties(messages, reporter);
+ }
+
+ protected void validateMappingFiles(List<IMessage> messages, IReporter reporter) {
+ this.checkForMultiplePersistenceUnitMetadata(messages);
+ this.checkForDuplicateMappingFiles(messages);
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ mappingFileRef.validate(messages, reporter);
+ }
+ }
+
+ protected void checkForMultiplePersistenceUnitMetadata(List<IMessage> messages) {
+ boolean first = true;
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ if (mappingFileRef.persistenceUnitMetadataExists()) {
+ if (first) {
+ first = false;
+ } else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA,
+ new String[] {mappingFileRef.getFileName()},
+ mappingFileRef
+ )
+ );
+ }
+ }
+ }
+ }
+
+ protected void checkForDuplicateMappingFiles(List<IMessage> messages) {
+ HashBag<String> fileNames = new HashBag<String>();
+ CollectionTools.addAll(fileNames, this.mappingFileRefNames());
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ String fileName = mappingFileRef.getFileName();
+ if (fileNames.count(fileName) > 1) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE,
+ new String[] {fileName},
+ mappingFileRef,
+ mappingFileRef.getValidationTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ protected void validateClassRefs(List<IMessage> messages, IReporter reporter) {
+ this.checkForDuplicateClasses(messages);
+ for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
+ stream.next().validate(messages, reporter);
+ }
+ }
+
+ protected void checkForDuplicateClasses(List<IMessage> messages) {
+ HashBag<String> ormMappedClassNames = new HashBag<String>();
+ CollectionTools.addAll(ormMappedClassNames, this.ormMappedClassNames());
+ for (Iterator<PersistentType> ormMappedClasses = this.getMappingFilePersistentTypes().iterator(); ormMappedClasses.hasNext();){
+ PersistentType ormMappedClass = ormMappedClasses.next();
+ String ormMappedClassName = ormMappedClass.getName();
+ if ((ormMappedClassName != null) && (ormMappedClassNames.count(ormMappedClassName) > 1)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS,
+ new String[] {ormMappedClassName},
+ ormMappedClass,
+ ormMappedClass.getSelectionTextRange()
+ )
+ );
+ }
+ }
+ HashBag<String> javaClassNames = new HashBag<String>();
+ CollectionTools.addAll(javaClassNames, this.classRefNames());
+ for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
+ ClassRef classRef = stream.next();
+ String javaClassName = classRef.getClassName();
+ if ((javaClassName != null) && (!ormMappedClassNames.contains(javaClassName))
+ && (javaClassNames.count(javaClassName) > 1)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS,
+ new String[] {javaClassName},
+ classRef,
+ classRef.getValidationTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ protected void validateJarFileRefs(List<IMessage> messages, IReporter reporter) {
+ this.checkForDuplicateJarFileRefs(messages);
+ for (JarFileRef each : CollectionTools.iterable(this.jarFileRefs())) {
+ each.validate(messages, reporter);
+ }
+ }
+
+ protected void checkForDuplicateJarFileRefs(List<IMessage> messages) {
+ HashBag<String> jarFileNames = new HashBag<String>();
+ CollectionTools.addAll(jarFileNames, this.jarFileNames());
+ for (JarFileRef jarFileRef : CollectionTools.iterable(this.jarFileRefs())) {
+ String jarFileName = jarFileRef.getFileName();
+ if ((jarFileName != null) && (jarFileNames.count(jarFileName) > 1)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_JAR_FILE,
+ new String[] {jarFileName},
+ jarFileRef,
+ jarFileRef.getValidationTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ protected void validateProperties(List<IMessage> messages, IReporter reporter) {
+ // do nothing by default
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.connectionProfileIsActive();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.xmlPersistenceUnit.getValidationTextRange();
+ }
+
+ // ********** refactoring **********
+
+ public Iterable<DeleteEdit> createDeleteTypeEdits(final IType type) {
+ return new CompositeIterable<DeleteEdit>(
+ new TransformationIterable<ClassRef, Iterable<DeleteEdit>>(this.getSpecifiedClassRefs()) {
+ @Override
+ protected Iterable<DeleteEdit> transform(ClassRef classRef) {
+ return classRef.createDeleteTypeEdits(type);
+ }
+ }
+ );
+ }
+
+ public Iterable<DeleteEdit> createDeleteMappingFileEdits(final IFile file) {
+ return new CompositeIterable<DeleteEdit>(
+ new TransformationIterable<MappingFileRef, Iterable<DeleteEdit>>(this.getSpecifiedMappingFileRefs()) {
+ @Override
+ protected Iterable<DeleteEdit> transform(MappingFileRef mappingFileRef) {
+ return mappingFileRef.createDeleteMappingFileEdits(file);
+ }
+ }
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.createSpecifiedClassRefRenameTypeEdits(originalType, newName),
+ this.createPersistenceUnitPropertiesRenameTypeEdits(originalType, newName));
+ }
+
+ protected Iterable<ReplaceEdit> createSpecifiedClassRefRenameTypeEdits(final IType originalType, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(ClassRef classRef) {
+ return classRef.createRenameTypeEdits(originalType, newName);
+ }
+ }
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenameTypeEdits(IType originalType, String newName) {
+ return this.options.createRenameTypeEdits(originalType, newName);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.createSpecifiedClassRefMoveTypeEdits(originalType, newPackage),
+ this.createPersistenceUnitPropertiesMoveTypeEdits(originalType, newPackage));
+ }
+
+ protected Iterable<ReplaceEdit> createSpecifiedClassRefMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(ClassRef classRef) {
+ return classRef.createMoveTypeEdits(originalType, newPackage);
+ }
+ }
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return this.options.createMoveTypeEdits(originalType, newPackage);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.createSpecifiedClassRefRenamePackageEdits(originalPackage, newName),
+ this.createPersistenceUnitPropertiesRenamePackageEdits(originalPackage, newName));
+ }
+
+ protected Iterable<ReplaceEdit> createSpecifiedClassRefRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<ClassRef, Iterable<ReplaceEdit>>(this.getSpecifiedClassRefs()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(ClassRef classRef) {
+ return classRef.createRenamePackageEdits(originalPackage, newName);
+ }
+ }
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return this.options.createRenamePackageEdits(originalPackage, newName);
+ }
+
+ public Iterable<ReplaceEdit> createRenameFolderEdits(final IFolder originalFolder, final String newName) {
+ return this.createMappingFileRefRenameFolderEdits(originalFolder, newName);
+ }
+
+ protected Iterable<ReplaceEdit> createMappingFileRefRenameFolderEdits(final IFolder originalFolder, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getSpecifiedMappingFileRefs()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) {
+ return mappingFileRef.createRenameFolderEdits(originalFolder, newName);
+ }
+ }
+ );
+ }
+
+ public Iterable<ReplaceEdit> createRenameMappingFileEdits(final IFile originalFile, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getMappingFileRefs()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) {
+ return mappingFileRef.createRenameMappingFileEdits(originalFile, newName);
+ }
+ }
+ );
+ }
+
+ public int findInsertLocationForMappingFileRef() {
+ return this.xmlPersistenceUnit.getLocationToInsertMappingFileRef();
+ }
+
+ public Iterable<ReplaceEdit> createMoveMappingFileEdits(final IFile originalFile, final IPath runtineDestination) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getMappingFileRefs()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) {
+ return mappingFileRef.createMoveMappingFileEdits(originalFile, runtineDestination);
+ }
+ }
+ );
+ }
+
+ public Iterable<ReplaceEdit> createMoveFolderEdits(final IFolder originalFolder, final IPath runtimeDestination) {
+ return this.createMappingFileRefMoveFolderReplaceEdits(originalFolder, runtimeDestination);
+ }
+
+ protected Iterable<ReplaceEdit> createMappingFileRefMoveFolderReplaceEdits(final IFolder originalFolder, final IPath runtimeDestination) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<MappingFileRef, Iterable<ReplaceEdit>>(this.getSpecifiedMappingFileRefs()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(MappingFileRef mappingFileRef) {
+ return mappingFileRef.createMoveFolderEdits(originalFolder, runtimeDestination);
+ }
+ }
+ );
+ }
+
+ // ********** misc **********
+
+ public XmlPersistenceUnit getXmlPersistenceUnit() {
+ return this.xmlPersistenceUnit;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ for (Iterator<JarFileRef> stream = this.jarFileRefs(); stream.hasNext(); ) {
+ JarFileRef jarFileRef = stream.next();
+ if (jarFileRef.containsOffset(textOffset)) {
+ return jarFileRef;
+ }
+ }
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ if (mappingFileRef.containsOffset(textOffset)) {
+ return mappingFileRef;
+ }
+ }
+ for (Iterator<ClassRef> stream = this.classRefs(); stream.hasNext(); ) {
+ ClassRef classRef = stream.next();
+ if (classRef.containsOffset(textOffset)) {
+ return classRef;
+ }
+ }
+ return this;
+ }
+
+ // ------------------- all entities -----------------
+ public Iterable<Entity> getEntities() {
+ return new SubIterableWrapper<TypeMapping, Entity>(this.getEntities_());
+ }
+
+ protected Iterable<TypeMapping> getEntities_() {
+ return new FilteringIterable<TypeMapping>(this.getTypeMappings()) {
+ @Override
+ protected boolean accept(TypeMapping typeMapping) {
+ return typeMapping instanceof Entity;
+ }
+ };
+ }
+
+ protected Iterable<TypeMapping> getTypeMappings() {
+ return new TransformationIterable<PersistentType, TypeMapping>(this.getPersistentTypes()) {
+ @Override
+ protected TypeMapping transform(PersistentType persistentType) {
+ return persistentType.getMapping(); // the mapping should never be null
+ }
+ };
+ }
+
+ protected Iterator<String> ormMappedClassNames() {
+ return new TransformationIterator<PersistentType, String>(this.getMappingFilePersistentTypes()) {
+ @Override
+ protected String transform(PersistentType persistentType) {
+ return persistentType.getName();
+ }
+ };
+ }
+
+ // ------------------ orm entities --------------------
+ protected Iterator<String> ormEntityClassNames() {
+ return new TransformationIterator<Entity, String>(this.getOrmEntities()) {
+ @Override
+ protected String transform(Entity ormEntity) {
+ return ormEntity.getPersistentType().getName();
+ }
+ };
+ }
+
+ public Iterator<String> ormEntityNames() {
+ return new TransformationIterator<Entity, String>(this.getOrmEntities()) {
+ @Override
+ protected String transform(Entity ormEntity) {
+ return ormEntity.getName();
+ }
+ };
+ }
+
+ public Iterable<Entity> getOrmEntities(){
+ return new SubIterableWrapper<TypeMapping, Entity>(this.getOrmEntities_());
+ }
+
+ protected Iterable<TypeMapping> getOrmEntities_(){
+ return new FilteringIterable<TypeMapping>(this.getOrmTypeMappings()){
+ @Override
+ protected boolean accept(TypeMapping typeMapping) {
+ return typeMapping instanceof Entity;
+ }
+ };
+ }
+
+ private Iterable<? extends TypeMapping> getOrmTypeMappings() {
+ return new TransformationIterable<PersistentType, TypeMapping>(this.getMappingFilePersistentTypes()) {
+ @Override
+ protected TypeMapping transform(PersistentType persistentType) {
+ return persistentType.getMapping();
+ }
+ };
+ }
+
+ //--------------- java entities -----------------
+ protected Iterator<String> javaEntityClassNames(){
+ return new TransformationIterator<Entity, String>(this.getJavaEntities()) {
+ @Override
+ protected String transform(Entity javaEntity) {
+ return javaEntity.getPersistentType().getName();
+ }
+ };
+ }
+
+ public Iterator<String> javaEntityNamesExclOverridden() {
+ HashBag<String> ormMappedClassNames = new HashBag<String>();
+ CollectionTools.addAll(ormMappedClassNames, this.ormMappedClassNames());
+ List<String> javaEntityNamesExclOverridden = new ArrayList<String>();
+ for (Iterator<String> javaEntityClassNames = this.javaEntityClassNames(); javaEntityClassNames.hasNext();){
+ String javaEntityClassName = javaEntityClassNames.next();
+ if (!ormMappedClassNames.contains(javaEntityClassName)) {
+ javaEntityNamesExclOverridden.add((this.getEntity(javaEntityClassName)).getName());
+ }
+ }
+ return javaEntityNamesExclOverridden.iterator();
+ }
+
+ public Iterator<String> javaEntityNames(){
+ return new TransformationIterator<Entity, String>(this.getJavaEntities()) {
+ @Override
+ protected String transform(Entity javaEntity) {
+ return javaEntity.getName();
+ }
+ };
+ }
+
+ public Iterable<Entity> getJavaEntities(){
+ return new SubIterableWrapper<TypeMapping, Entity>(this.getJavaEntities_());
+ }
+
+ protected Iterable<TypeMapping> getJavaEntities_(){
+ return new FilteringIterable<TypeMapping>(this.getJavaTypeMappings()){
+ @Override
+ protected boolean accept(TypeMapping typeMapping) {
+ return typeMapping instanceof Entity;
+ }
+ };
+ }
+
+ private Iterable<? extends TypeMapping> getJavaTypeMappings() {
+ return new TransformationIterable<PersistentType, TypeMapping>(this.getNonNullClassPersistentTypes()) {
+ @Override
+ protected TypeMapping transform(PersistentType persistentType) {
+ return persistentType.getMapping();
+ }
+ };
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<PersistentType> getPersistentTypes() {
+ return new CompositeIterable<PersistentType>(
+ this.getMappingFilePersistentTypes(),
+ this.getNonNullClassPersistentTypes(),
+ this.getJarFilePersistentTypes()
+ );
+ }
+
+ protected Iterable<PersistentType> getMappingFilePersistentTypes() {
+ return new CompositeIterable<PersistentType>(this.getMappingFilePersistentTypeLists());
+ }
+
+ protected Iterable<Iterable<? extends PersistentType>> getMappingFilePersistentTypeLists() {
+ return new TransformationIterable<PersistentTypeContainer, Iterable<? extends PersistentType>>(
+ this.getMappingFileRefs(),
+ PersistentTypeContainer.TRANSFORMER
+ );
+ }
+
+ protected Iterable<PersistentType> getNonNullClassPersistentTypes() {
+ return new FilteringIterable<PersistentType>(this.getClassPersistentTypes(), NotNullFilter.<PersistentType>instance());
+ }
+
+ protected Iterable<PersistentType> getClassPersistentTypes() {
+ return new TransformationIterable<ClassRef, PersistentType>(this.getClassRefs()) {
+ @Override
+ protected PersistentType transform(ClassRef classRef) {
+ return classRef.getJavaPersistentType();
+ }
+ };
+ }
+
+ protected Iterable<PersistentType> getJarFilePersistentTypes() {
+ return new CompositeIterable<PersistentType>(this.getJarFilePersistentTypeLists());
+ }
+
+ protected Iterable<Iterable<? extends PersistentType>> getJarFilePersistentTypeLists() {
+ return new TransformationIterable<PersistentTypeContainer, Iterable<? extends PersistentType>>(
+ this.getJarFileRefs(),
+ PersistentTypeContainer.TRANSFORMER
+ );
+ }
+
+ public PersistentType getPersistentType(String typeName) {
+ if (typeName == null) {
+ return null;
+ }
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ PersistentType persistentType = mappingFileRef.getPersistentType(typeName);
+ if (persistentType != null) {
+ return persistentType;
+ }
+ }
+ for (ClassRef classRef : this.getClassRefs()) {
+ if (classRef.isFor(typeName)) {
+ return classRef.getJavaPersistentType();
+ }
+ }
+ for (JarFileRef jarFileRef : this.getJarFileRefs()) {
+ PersistentType persistentType = jarFileRef.getPersistentType(typeName);
+ if (persistentType != null) {
+ return persistentType;
+ }
+ }
+ return null;
+ }
+
+ public boolean specifiesPersistentType(String className) {
+ for (ClassRef classRef : this.getSpecifiedClassRefs()) {
+ if (classRef.isFor(className)) {
+ return true;
+ }
+ }
+ for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
+ if (mappingFileRef.getPersistentType(className) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Entity getEntity(String typeName) {
+ TypeMapping typeMapping = this.getTypeMapping(typeName);
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public Embeddable getEmbeddable(String typeName) {
+ TypeMapping typeMapping = this.getTypeMapping(typeName);
+ return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
+ }
+
+ protected TypeMapping getTypeMapping(String typeName) {
+ PersistentType persistentType = this.getPersistentType(typeName);
+ return (persistentType == null) ? null : persistentType.getMapping();
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return (this.xmlPersistenceUnit != null) && this.xmlPersistenceUnit.containsOffset(textOffset);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(this.name);
+ }
+
+
+ // ********** metamodel **********
+ // put metamodel stuff here so it can be shared by Generic and EclipseLink implementations
+
+ public void initializeMetamodel() {
+ this.initializeMetamodelFiles_();
+ }
+
+ protected void initializeMetamodelFiles() {
+ if (this.isJpa2_0Compatible()) {
+ this.initializeMetamodelFiles_();
+ }
+ }
+
+ protected void initializeMetamodelFiles_() {
+ CollectionTools.addAll(this.metamodelFiles, this.getGeneratedMetamodelFiles());
+ }
+
+ protected Iterable<IFile> getGeneratedMetamodelFiles() {
+ return new TransformationIterable<JavaResourcePersistentType2_0, IFile>(this.getGeneratedMetamodelTopLevelTypes()) {
+ @Override
+ protected IFile transform(JavaResourcePersistentType2_0 jrpt) {
+ return jrpt.getFile();
+ }
+ };
+ }
+
+ protected Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTopLevelTypes() {
+ return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTopLevelTypes();
+ }
+
+ /**
+ * Not the prettiest code....
+ */
+ public void synchronizeMetamodel() {
+ // gather up the persistent unit's types, eliminating duplicates;
+ // if we have persistent types with the same name in multiple locations,
+ // the last one we encounter wins (i.e. the classes in the orm.xml take
+ // precedence)
+ HashMap<String, PersistentType2_0> allPersistentTypes = new HashMap<String, PersistentType2_0>();
+ this.addPersistentTypesTo_(this.getJarFileRefs(), allPersistentTypes);
+ this.addPersistentTypesTo(this.getNonNullClassPersistentTypes(), allPersistentTypes);
+ this.addPersistentTypesTo_(this.getMappingFileRefs(), allPersistentTypes);
+
+ // build a list of the top-level types and a tree of their associated
+ // member types etc.
+ ArrayList<MetamodelSourceType> topLevelTypes = new ArrayList<MetamodelSourceType>(allPersistentTypes.size());
+ HashMap<String, Collection<MetamodelSourceType>> memberTypeTree = new HashMap<String, Collection<MetamodelSourceType>>();
+ for (PersistentType2_0 type : allPersistentTypes.values()) {
+ String declaringTypeName = type.getDeclaringTypeName();
+ MetamodelSourceType memberType = type;
+ while (true) {
+ if (declaringTypeName == null) {
+ topLevelTypes.add(memberType);
+ break; // stop at the top-level type
+ }
+
+ // associate the member type with its declaring type
+ Collection<MetamodelSourceType> memberTypes = memberTypeTree.get(declaringTypeName);
+ if (memberTypes == null) {
+ memberTypes = new ArrayList<MetamodelSourceType>();
+ memberTypeTree.put(declaringTypeName, memberTypes);
+ }
+ memberTypes.add(memberType);
+
+ // move out to the member type's declaring type
+ String memberTypeName = declaringTypeName;
+ // check for a context persistent type
+ memberType = allPersistentTypes.get(memberTypeName);
+ if (memberType != null) {
+ break; // stop - this will be processed in the outer 'for' loop
+ }
+ // check for a Java resource persistent type
+ JavaResourcePersistentType jrpt = this.getJpaProject().getJavaResourcePersistentType(memberTypeName);
+ if (jrpt != null) {
+ declaringTypeName = jrpt.getDeclaringTypeName();
+ } else {
+ // check for a JDT type
+ IType jdtType = this.findJdtType(memberTypeName);
+ if (jdtType != null) {
+ IType jdtDeclaringType = jdtType.getDeclaringType();
+ declaringTypeName = (jdtDeclaringType == null) ? null : jdtDeclaringType.getFullyQualifiedName('.');
+ } else {
+ // assume we have a non-persistent top-level type...?
+ declaringTypeName = null;
+ }
+ }
+ if (declaringTypeName == null) {
+ memberType = this.selectSourceType(topLevelTypes, memberTypeName);
+ } else {
+ memberType = this.selectSourceType(memberTypeTree.get(declaringTypeName), memberTypeName);
+ }
+ if (memberType != null) {
+ break; // stop - this type has already been processed
+ }
+ memberType = this.buildNonPersistentMetamodelSourceType(memberTypeName);
+ }
+ }
+
+ // remove any top-level type whose name differs from another only by case,
+ // since, on Windows, file names are case-insensitive :-(
+ // sort the original list so we end up with the same top-level type
+ // remaining every time (i.e. the one that sorts out first)
+ Collections.sort(topLevelTypes, MetamodelSourceType.COMPARATOR);
+ HashSet<String> names = new HashSet<String>(topLevelTypes.size());
+ for (Iterator<MetamodelSourceType> stream = topLevelTypes.iterator(); stream.hasNext(); ) {
+ MetamodelSourceType topLevelType = stream.next();
+ // hopefully this is case-insensitive enough...
+ if ( ! names.add(topLevelType.getName().toLowerCase())) {
+ stream.remove();
+ }
+ }
+
+ // copy the list of metamodel files...
+ HashSet<IFile> deadMetamodelFiles = new HashSet<IFile>(this.metamodelFiles);
+ this.metamodelFiles.clear();
+ for (MetamodelSourceType topLevelType : topLevelTypes) {
+ IFile metamodelFile = topLevelType.getMetamodelFile();
+ // ...remove whatever files are still present...
+ deadMetamodelFiles.remove(metamodelFile);
+ // ...rebuild the list of metamodel files...
+ if (this.fileIsGeneratedMetamodel(metamodelFile)) { // only add files with the Dali tag
+ this.metamodelFiles.add(metamodelFile);
+ }
+ }
+ // ...delete the files that are now gone
+ // [perform the deletes first - this is critical when a file has been
+ // renamed by only altering its name's case; since we will try to write
+ // out a new file that, on Windows, collides with the old file :-( ]
+ for (IFile deadMetamodelFile : deadMetamodelFiles) {
+ this.deleteMetamodelFile(deadMetamodelFile);
+ }
+
+ // now generate the metamodel classes
+ for (MetamodelSourceType topLevelType : topLevelTypes) {
+ topLevelType.synchronizeMetamodel(memberTypeTree);
+ }
+ }
+
+ protected void addPersistentTypesTo_(Iterable<? extends PersistentTypeContainer> ptContainers, HashMap<String, PersistentType2_0> persistentTypeMap) {
+ for (PersistentTypeContainer ptContainer : ptContainers) {
+ this.addPersistentTypesTo(ptContainer.getPersistentTypes(), persistentTypeMap);
+ }
+ }
+
+ protected void addPersistentTypesTo(Iterable<? extends PersistentType> persistentTypes, HashMap<String, PersistentType2_0> persistentTypeMap) {
+ for (PersistentType persistentType : persistentTypes) {
+ if (persistentType.getName() != null) {
+ persistentTypeMap.put(persistentType.getName(), (PersistentType2_0) persistentType);
+ }
+ }
+ }
+
+ protected MetamodelSourceType selectSourceType(Iterable<MetamodelSourceType> types, String typeName) {
+ if (types != null) {
+ for (MetamodelSourceType type : types) {
+ if (type.getName().equals(typeName)) {
+ return type;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected MetamodelSourceType buildNonPersistentMetamodelSourceType(String nonPersistentTypeName) {
+ return new NonPersistentMetamodelSourceType(nonPersistentTypeName, this.getJpaProject());
+ }
+
+ protected IType findJdtType(String typeName) {
+ try {
+ return this.getJpaProject().getJavaProject().findType(typeName);
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ protected void deleteMetamodelFile(IFile file) {
+ try {
+ this.deleteMetamodelFile_(file);
+ } catch (CoreException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ protected void deleteMetamodelFile_(IFile file) throws CoreException {
+ if (this.fileIsGeneratedMetamodel(file)) {
+ file.delete(true, null); // true = force
+ }
+ }
+
+ protected boolean fileIsGeneratedMetamodel(IFile file) {
+ return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTopLevelType(file) != null;
+ }
+
+ public void disposeMetamodel() {
+ this.metamodelFiles.clear();
+ }
+
+
+ // ***** Metamodel source for non-persistent types
+ protected static class NonPersistentMetamodelSourceType
+ implements MetamodelSourceType
+ {
+ protected final String name;
+ protected final JpaProject jpaProject;
+ protected final MetamodelSourceType.Synchronizer metamodelSynchronizer;
+
+ protected NonPersistentMetamodelSourceType(String name, JpaProject jpaProject) {
+ super();
+ this.name = name;
+ this.jpaProject = jpaProject;
+ this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
+ }
+
+ protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() {
+ return this.getJpaFactory().buildMetamodelSynchronizer(this);
+ }
+
+ protected JpaFactory2_0 getJpaFactory() {
+ return (JpaFactory2_0) this.getJpaProject().getJpaPlatform().getJpaFactory();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public boolean isManaged() {
+ return false;
+ }
+
+ public PersistentType getSuperPersistentType() {
+ return null;
+ }
+
+ public <T extends PersistentAttribute> ListIterator<T> attributes() {
+ return EmptyListIterator.instance();
+ }
+
+ public IFile getMetamodelFile() {
+ return this.metamodelSynchronizer.getFile();
+ }
+
+ public JpaProject getJpaProject() {
+ return this.jpaProject;
+ }
+
+ public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ this.metamodelSynchronizer.synchronize(memberTypeTree);
+ }
+
+ public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java
new file mode 100644
index 0000000000..96edeee601
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java
@@ -0,0 +1,529 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.ReflectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * AbstractPersistenceUnitProperties
+ */
+public abstract class AbstractPersistenceUnitProperties extends AbstractModel
+ implements PersistenceUnitProperties
+{
+ private PersistenceUnit persistenceUnit;
+
+ // key = PersistenceUnit property key; value = property id
+ private Map<String, String> propertyNames;
+
+ public static final String PROPERTY_VALUE_DELIMITER = ","; //$NON-NLS-1$
+ private static final long serialVersionUID = 1L;
+
+ // ********** constructors / initialization **********
+ protected AbstractPersistenceUnitProperties(PersistenceUnit parent) {
+ super();
+ this.initialize();
+ this.initialize(parent);
+ this.postInitialize();
+ }
+
+ /**
+ * Base initialization.
+ */
+ protected void initialize() {
+ this.propertyNames = new HashMap<String, String>();
+ }
+
+ /**
+ * Initialization based on the persistence unit.
+ */
+ protected void initialize(PersistenceUnit parent) {
+ this.persistenceUnit = parent;
+
+ this.initializePropertyNames();
+ this.initializeProperties();
+ }
+
+ protected void initializePropertyNames() {
+ this.addPropertyNames(this.propertyNames);
+ }
+
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ protected abstract void initializeProperties();
+
+ /**
+ * Does all post treatment in this method after the properties are initialized
+ */
+ protected void postInitialize() {
+ // do nothing by default
+ }
+
+ // ********** behavior **********
+ public PersistenceUnit getPersistenceUnit() {
+ return this.persistenceUnit;
+ }
+
+ public JpaProject getJpaProject() {
+ return this.persistenceUnit.getJpaProject();
+ }
+
+ /**
+ * Adds property names key/value pairs, used by the methods: itemIsProperty
+ * and propertyIdFor.
+ *
+ * key = property key; value = property id
+ */
+ protected abstract void addPropertyNames(Map<String, String> pNames);
+
+ /**
+ * Method used for identifying the given property.
+ */
+ public boolean itemIsProperty(PersistenceUnit.Property item) {
+ if (item == null) {
+ throw new NullPointerException();
+ }
+ return this.propertyNames().keySet().contains(item.getName());
+ }
+
+ /**
+ * Returns the property name used for change notification of the given
+ * property.
+ */
+ public String propertyIdOf(PersistenceUnit.Property property) {
+ String propertyId = this.propertyNames().get(property.getName());
+ if (propertyId == null) {
+ throw new IllegalArgumentException("Illegal property: " + property); //$NON-NLS-1$
+ }
+ return propertyId;
+ }
+
+ public String propertyIdOf(String eclipseLinkkey) {
+ String propertyId = this.propertyNames().get(eclipseLinkkey);
+ if (propertyId == null) {
+ throw new IllegalArgumentException("Illegal property: " + eclipseLinkkey); //$NON-NLS-1$
+ }
+ return propertyId;
+ }
+
+ /*
+ * Get the PersistenceUnit property key of the given property
+ */
+ protected String persistenceUnitKeyOf(String propertyId) {
+ for (String persistenceUnitKey : this.propertyNames().keySet()) {
+ if (this.propertyNames().get(persistenceUnitKey).equals(propertyId)) {
+ return persistenceUnitKey;
+ }
+ }
+ throw new IllegalArgumentException("Illegal property ID: " + propertyId); //$NON-NLS-1$
+ }
+
+ // ******** Convenience methods ********
+ /**
+ * Put into persistenceUnit properties.
+ *
+ * @param key -
+ * property name
+ * @param value -
+ * property value
+ */
+ protected void putProperty(String key, Object value) {
+ this.putProperty(key, value, false);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void putProperty(String key, Object value, boolean allowDuplicates) {
+ String persistenceUnitKey = this.persistenceUnitKeyOf(key);
+ if ((value != null) && value.getClass().isEnum()) {
+ this.putEnumValue(persistenceUnitKey, (Enum) value, allowDuplicates);
+ }
+ else {
+ this.putPersistenceUnitProperty(persistenceUnitKey, null, value, allowDuplicates);
+ }
+ }
+
+ /**
+ * Removes a persistenceUnit property.
+ *
+ * @param key -
+ * property name
+ * @param value -
+ * property value
+ */
+ protected void removeProperty(String key, String value) {
+ String persistenceUnitKey = this.persistenceUnitKeyOf(key);
+
+ this.getPersistenceUnit().removeProperty(persistenceUnitKey, value);
+ }
+
+ /**
+ * Returns true when the given key exits in the PersistenceXml.
+ */
+ protected boolean persistenceUnitKeyExists(String persistenceUnitKey) {
+ return (this.getStringValue(persistenceUnitKey) != null);
+ }
+
+ // ****** get/set String convenience methods *******
+ /**
+ * Returns the String value of the given Property from the PersistenceXml.
+ */
+ protected String getStringValue(String persistenceUnitKey) {
+ PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
+ return (p == null) ? null : p.getValue();
+ }
+
+ protected String getStringValue(String key, String keySuffix) {
+ return this.getStringValue((keySuffix == null) ? key : key + keySuffix);
+ }
+
+ /**
+ * Put the given String value into the PersistenceXml.
+ * @param key -
+ * property key
+ * @param newValue
+ * value to be associated with the key
+ */
+ protected void putStringValue(String key, String newValue) {
+ this.putStringValue(key, null, newValue, false);
+ }
+
+ /**
+ * Put the given String value into the PersistenceXml.
+ * @param key
+ * property key
+ * @param newValue
+ * value to be associated with the key
+ * @param allowDuplicate
+ */
+ protected void putStringValue(String key, String newValue, boolean allowDuplicate) {
+ this.putStringValue(key, null, newValue, allowDuplicate);
+ }
+
+ /**
+ * Put the given String value into the PersistenceXml.
+ * @param key
+ * property key
+ * @param keySuffix
+ * e.g. entity name
+ * @param newValue
+ * value to be associated with the key
+ * @param allowDuplicate
+ */
+ protected void putStringValue(String key, String keySuffix, String newValue, boolean allowDuplicate) {
+ this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate);
+ }
+
+ // ****** Integer convenience methods *******
+ /**
+ * Returns the Integer value of the given Property from the PersistenceXml.
+ */
+ protected Integer getIntegerValue(String persistenceUnitKey) {
+ PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
+ return (p == null) ? null : getIntegerValueOf(p.getValue());
+ }
+
+ protected Integer getIntegerValue(String key, String keySuffix) {
+ return this.getIntegerValue((keySuffix == null) ? key : key + keySuffix);
+ }
+
+ /**
+ * Put the given Integer value into the PersistenceXml.
+ * @param key -
+ * property key
+ * @param newValue
+ * value to be associated with the key
+ */
+ protected void putIntegerValue(String key, Integer newValue) {
+ this.putIntegerValue(key, null, newValue, false);
+ }
+
+ /**
+ * Put the given Integer value into the PersistenceXml.
+ * @param key
+ * property key
+ * @param newValue
+ * value to be associated with the key
+ * @param allowDuplicate
+ */
+ protected void putIntegerValue(String key, Integer newValue, boolean allowDuplicate) {
+ this.putIntegerValue(key, null, newValue, allowDuplicate);
+ }
+
+ /**
+ * Put the given Integer value into the PersistenceXml.
+ * @param key
+ * property key
+ * @param keySuffix
+ * e.g. entity name
+ * @param newValue
+ * value to be associated with the key
+ * @param allowDuplicate
+ */
+ protected void putIntegerValue(String key, String keySuffix, Integer newValue, boolean allowDuplicate) {
+ this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate);
+ }
+
+ // ****** Boolean convenience methods *******
+ /**
+ * Returns the Boolean value of the given Property from the PersistenceXml.
+ */
+ protected Boolean getBooleanValue(String persistenceUnitKey) {
+ PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
+ return (p == null) ? null : getBooleanValueOf(p.getValue());
+ }
+
+ protected Boolean getBooleanValue(String key, String keySuffix) {
+ return this.getBooleanValue((keySuffix == null) ? key : key + keySuffix);
+ }
+
+ /**
+ * Put the given Boolean value into the PersistenceXml.
+ * @param key
+ * property key
+ * @param newValue
+ * value to be associated with the key
+ */
+ protected void putBooleanValue(String key, Boolean newValue) {
+ this.putBooleanValue(key, null, newValue, false);
+ }
+
+ /**
+ * Put the given Boolean value into the PersistenceXml.
+ * @param key
+ * property key
+ * @param newValue
+ * value to be associated with the key
+ * @param allowDuplicate
+ */
+ protected void putBooleanValue(String key, Boolean newValue, boolean allowDuplicate) {
+ this.putBooleanValue(key, null, newValue, allowDuplicate);
+ }
+
+ /**
+ * Put the given Boolean value into the PersistenceXml.
+ * @param key
+ * property key
+ * @param keySuffix
+ * e.g. entity name
+ * @param newValue
+ * value to be associated with the key
+ * @param allowDuplicate
+ */
+ protected void putBooleanValue(String key, String keySuffix, Boolean newValue, boolean allowDuplicate) {
+ this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate);
+ }
+
+ // ****** Enum convenience methods *******
+ /**
+ * Returns the Enum value of the given Property from the PersistenceXml.
+ */
+ protected <T extends Enum<T>> T getEnumValue(String persistenceUnitKey, T[] enumValues) {
+ PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
+ return (p == null) ? null : getEnumValueOf(p.getValue(), enumValues);
+ }
+
+ protected <T extends Enum<T>> T getEnumValue(String key, String keySuffix, T[] enumValues) {
+ return this.getEnumValue((keySuffix == null) ? key : key + keySuffix, enumValues);
+ }
+
+ /**
+ * Put the given Enum value into the PersistenceXml.
+ *
+ * @param key -
+ * property key
+ */
+ protected <T extends Enum<T>> void putEnumValue(String key, T newValue) {
+ this.putEnumValue(key, null, newValue, false);
+ }
+
+ protected <T extends Enum<T>> void putEnumValue(String key, T newValue, boolean allowDuplicate) {
+ this.putEnumValue(key, null, newValue, allowDuplicate);
+ }
+
+ protected <T extends Enum<T>> void putEnumValue(String key, String keySuffix, T newValue, boolean allowDuplicate) {
+ this.putPersistenceUnitProperty(key, keySuffix, getPropertyStringValueOf(newValue), allowDuplicate);
+ }
+
+ // ****** get/set CompositeValue convenience methods *******
+ /**
+ * Returns the String values of the given Property from the PersistenceXml.
+ */
+ protected List<String> getCompositeValue(String persistenceUnitKey) {
+ String values = this.getStringValue(persistenceUnitKey);
+ return this.extractCompositeValue(values);
+ }
+
+ /**
+ * Put into persistenceUnit properties. If the property already exists,
+ * it appends the given value at the end of the property value.
+ *
+ * @param key
+ * @param valueToAppend
+ */
+ protected void putPropertyCompositeValue(String key, String valueToAppend) {
+ String persistenceUnitKey = this.persistenceUnitKeyOf(key);
+
+ String persistenceUnitValue = this.buildCompositeValue(
+ this.getStringValue(persistenceUnitKey), valueToAppend);
+
+ this.putPersistenceUnitProperty(persistenceUnitKey, null, persistenceUnitValue, false);
+ }
+
+ /**
+ * Removes a value from a property with composite values.
+ * If the resulting value is empty, the property is removed from the persistenceUnit.
+ *
+ * @param key -
+ * property name
+ * @param valueToRemove -
+ * value to remove from the property
+ */
+ protected void removePropertyCompositeValue(String key, String valueToRemove) {
+ String persistenceUnitKey = this.persistenceUnitKeyOf(key);
+
+ String persistenceUnitValue = this.removeValueFrom(
+ this.getStringValue(persistenceUnitKey), valueToRemove.trim());
+
+ this.putPersistenceUnitProperty(persistenceUnitKey, null, persistenceUnitValue, false);
+ }
+
+ // ****** Static methods *******
+
+ public static Boolean getBooleanValueOf(String puStringValue) {
+ if (StringTools.stringIsEmpty(puStringValue)) {
+ return null;
+ }
+ return Boolean.valueOf(puStringValue);
+ }
+
+ public static Integer getIntegerValueOf(String puStringValue) {
+ if (StringTools.stringIsEmpty(puStringValue)) {
+ return null;
+ }
+ try {
+ return Integer.valueOf(puStringValue);
+ }
+ catch (NumberFormatException nfe) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the enum constant of the specified enum type with the specified
+ * Property string value.
+ */
+ public static <T extends Enum<T>> T getEnumValueOf(String puStringValue, T[] enumValues) {
+ for (T enumValue : enumValues) {
+ if (getPropertyStringValueOf(enumValue).equals(puStringValue)) {
+ return enumValue;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the Property string value of the given property value.
+ */
+ public static String getPropertyStringValueOf(Object value) {
+ if (value == null) {
+ return null;
+ }
+ if (value.getClass().isEnum()) {
+ return (String) ReflectionTools.getStaticFieldValue(value.getClass(), value.toString().toUpperCase(Locale.ENGLISH));
+ }
+ return value.toString();
+ }
+
+ // ********** internal methods **********
+
+ private Map<String, String> propertyNames() {
+ return this.propertyNames;
+ }
+
+ private void putPersistenceUnitProperty(String key, String keySuffix, Object value, boolean allowDuplicates) {
+ String persistenceUnitKey = (keySuffix == null) ? key : key + keySuffix;
+ String stringValue = (value == null) ? null : value.toString();
+ this.getPersistenceUnit().setProperty(persistenceUnitKey, stringValue, allowDuplicates);
+ }
+
+ private String buildCompositeValue(String value, String valueToAppend) {
+ if((StringTools.stringIsEmpty(valueToAppend)) ) {
+ return value;
+ }
+ return (StringTools.stringIsEmpty(value)) ?
+ valueToAppend :
+ (value + PROPERTY_VALUE_DELIMITER + valueToAppend);
+ }
+
+ protected List<String> extractCompositeValue(String compositeValue) {
+ if(StringTools.stringIsEmpty(compositeValue)) {
+ return new ArrayList<String>(0);
+ }
+ String[] values = compositeValue.split(PROPERTY_VALUE_DELIMITER);
+ List<String> results = new ArrayList<String>(values.length);
+ for(String value : values) {
+ results.add(value.trim());
+ }
+ return results;
+ }
+
+ private String removeValueFrom(String compositeValue, String valueToRemove) {
+ if((StringTools.stringIsEmpty(valueToRemove))) {
+ return compositeValue;
+ }
+ String[] values = compositeValue.split(PROPERTY_VALUE_DELIMITER);
+ ArrayList<String> results = new ArrayList<String>(values.length);
+
+ for(String value : values) {
+ if(value.trim().equals(valueToRemove)) {
+ continue;
+ }
+ results.add(value);
+ }
+ if(results.isEmpty()) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder(values.length);
+ for(String value : results) {
+ sb.append(value).append(PROPERTY_VALUE_DELIMITER);
+ }
+ sb.deleteCharAt(sb.length() - 1); // remove the last delimiter
+ return sb.toString();
+ }
+
+
+ // ********** refactoring ************
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return EmptyIterable.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java
new file mode 100644
index 0000000000..11431d2f8b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
+
+/**
+ * Use this abstract class for context nodes that are part of an
+ * <code>orm.xml</code> file.
+ * This will not work for a pure {@link org.eclipse.jpt.jpa.core.context.MappingFile}
+ * implementation.
+ */
+public abstract class AbstractPersistenceXmlContextNode
+ extends AbstractXmlContextNode
+{
+ // ********** constructor **********
+
+ protected AbstractPersistenceXmlContextNode(JpaContextNode parent) {
+ super(parent);
+ }
+
+
+ // ********** convenience methods **********
+
+ protected PersistenceXmlDefinition getPersistenceXmlDefinition() {
+ return (PersistenceXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.getResourceType());
+ }
+
+ protected EFactory getResourceNodeFactory() {
+ return this.getPersistenceXmlDefinition().getResourceNodeFactory();
+ }
+
+ protected PersistenceXmlContextNodeFactory getContextNodeFactory() {
+ return this.getPersistenceXmlDefinition().getContextNodeFactory();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
new file mode 100644
index 0000000000..d0f241c83e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.java.JarFile;
+import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
+import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJarFile;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericClassRef;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericJarFileRef;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericMappingFileRef;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistence;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnitProperty;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
+
+public abstract class AbstractPersistenceXmlContextNodeFactory implements PersistenceXmlContextNodeFactory
+{
+
+ public Persistence buildPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) {
+ return new GenericPersistence(parent, xmlPersistence);
+ }
+
+ public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
+ return new GenericPersistenceUnit(parent, xmlPersistenceUnit);
+ }
+
+ public MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
+ return new GenericMappingFileRef(parent, xmlMappingFileRef);
+ }
+
+ public MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent) {
+ return new ImpliedMappingFileRef(parent, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ }
+
+ public ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) {
+ return new GenericClassRef(parent, classRef);
+ }
+
+ public ClassRef buildClassRef(PersistenceUnit parent, String className) {
+ return new GenericClassRef(parent, className);
+ }
+
+ public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
+ return new GenericJarFileRef(parent, xmlJarFileRef);
+ }
+
+ public JarFile buildJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) {
+ return new GenericJarFile(parent, jarResourcePackageFragmentRoot);
+ }
+
+ public PersistenceUnit.Property buildProperty(PersistenceUnit parent, XmlProperty xmlProperty) {
+ return new GenericPersistenceUnitProperty(parent, xmlProperty);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
new file mode 100644
index 0000000000..712ef7e546
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
+
+/**
+ * All the state in the definition should be "static"
+ * (i.e. unchanging once it is initialized).
+ */
+public abstract class AbstractPersistenceXmlDefinition
+ implements PersistenceXmlDefinition
+{
+ private final PersistenceXmlContextNodeFactory factory;
+
+
+ /**
+ * zero-argument constructor
+ */
+ protected AbstractPersistenceXmlDefinition() {
+ super();
+ this.factory = this.buildContextNodeFactory();
+ }
+
+ protected abstract PersistenceXmlContextNodeFactory buildContextNodeFactory();
+
+ public PersistenceXmlContextNodeFactory getContextNodeFactory() {
+ return this.factory;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
new file mode 100644
index 0000000000..3f329ec9bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.NullConnection2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.NullOptions2_0;
+
+
+public class GenericPersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
+{
+
+ public PersistenceUnitProperties buildConnection(PersistenceUnit parent) {
+ return new NullConnection2_0(parent);
+ }
+
+ public PersistenceUnitProperties buildOptions(PersistenceUnit parent) {
+ return new NullOptions2_0(parent);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java
new file mode 100644
index 0000000000..a34318fd10
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
+import org.eclipse.wst.common.project.facet.core.IGroup;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class FacetTools {
+
+ public static IGroup MODULES_GROUP = ProjectFacetsManager.getGroup("modules"); //$NON-NLS-1$
+
+
+ public static boolean hasModuleFacet(IFacetedProjectBase fproj) {
+ for (IProjectFacetVersion fv : fproj.getProjectFacets()) {
+ if (MODULES_GROUP.getMembers().contains(fv)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static IProjectFacetVersion getModuleFacet(IFacetedProjectBase fproj) {
+ for (IProjectFacetVersion fv : fproj.getProjectFacets()) {
+ if (MODULES_GROUP.getMembers().contains(fv)) {
+ return fv;
+ }
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java
new file mode 100644
index 0000000000..69485c5d54
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
+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;
+
+/**
+ * Performs things common to install, version change
+ */
+public abstract class JpaFacetActionDelegate
+ implements IDelegate, JpaFacetDataModelProperties
+{
+ public final void execute(
+ IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+
+ this.execute_(project, fv, config, monitor);
+ }
+
+ protected void execute_(
+ IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+
+ SubMonitor subMonitor = SubMonitor.convert(monitor, 7);
+
+ IDataModel dataModel = (IDataModel) config;
+
+ // project settings
+ JpaPlatformDescription platform = (JpaPlatformDescription) dataModel.getProperty(PLATFORM);
+ JptJpaCorePlugin.setJpaPlatformId(project, platform.getId());
+ subMonitor.worked(1);
+
+ // do NOT use IDataModel.getStringProperty(String) - or the connection profile name can
+ // be set to an empty string - we want it to be null
+ JptJpaCorePlugin.setConnectionProfileName(project, (String) dataModel.getProperty(CONNECTION));
+ subMonitor.worked(1);
+
+ if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
+ JptJpaCorePlugin.setUserOverrideDefaultCatalog(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_CATALOG));
+ }
+ subMonitor.worked(1);
+
+ if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
+ JptJpaCorePlugin.setUserOverrideDefaultSchema(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_SCHEMA));
+ }
+ subMonitor.worked(1);
+
+ JptJpaCorePlugin.setDiscoverAnnotatedClasses(project, dataModel.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES));
+ subMonitor.worked(1);
+
+ // defaults settings
+ JptJpaCorePlugin.setDefaultJpaPlatformId(fv.getVersionString(), platform.getId());
+ subMonitor.worked(1);
+
+ //Delegate to LibraryInstallDelegate to configure the project classpath
+ ((LibraryInstallDelegate) dataModel.getProperty(JpaFacetDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).execute(subMonitor.newChild(1));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java
new file mode 100644
index 0000000000..9b3c1b5b0a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
+
+public interface JpaFacetDataModelProperties
+ extends IDataModelProperties
+{
+ String PREFIX = "JpaFacetDataModelProperties";
+ String PREFIX_ = PREFIX + '.';
+
+ /**
+ * Internal, type IRuntime, identifies runtime associated with project
+ * Used only in conjunction with validation of other properties, because this information
+ * is otherwise inaccessible to this data model
+ */
+ String RUNTIME = PREFIX_ + "RUNTIME";
+
+ /**
+ * Required, type JpaPlatformDescription, identifies Jpa Platform
+ */
+ String PLATFORM = PREFIX_ + "PLATFORM";
+
+ /**
+ * Required, type LibraryInstallDelegate, the library install delegate used to configure JPA provider library
+ */
+ String LIBRARY_PROVIDER_DELEGATE = PREFIX_ + "LIBRARY_PROVIDER_DELEGATE";
+
+ /**
+ * Not required, type String, identifies database connection
+ */
+ String CONNECTION = PREFIX_ + "CONNECTION";
+
+ /**
+ * Required, type Boolean, identifies whether database connection is active
+ */
+ String CONNECTION_ACTIVE = PREFIX_ + "CONNECTION_ACTIVE";
+
+ /**
+ * Required, type Boolean, identifies if the user wishes to override default Catalog name
+ */
+ String USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG";
+
+ /**
+ * Not required, type String, identifies the user overridden default Catalog name
+ */
+ String USER_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_OVERRIDE_DEFAULT_CATALOG";
+
+ /**
+ * Required, type Boolean, identifies if the user wishes to override default schema name
+ */
+ String USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA";
+
+ /**
+ * Not required, type String, identifies the user overridden default schema name
+ */
+ String USER_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_OVERRIDE_DEFAULT_SCHEMA";
+
+ /**
+ * Required, type boolean, opposite of LIST_ANNOTATED_CLASSES, identifies
+ * whether all annotated classes are to be automatically included as part of
+ * all persistence units
+ */
+ String DISCOVER_ANNOTATED_CLASSES = PREFIX_ + "DISCOVER_ANNOTATED_CLASSES";
+
+ /**
+ * Required, type boolean, opposite of DISCOVER_ANNOTATED_CLASSES, identifies
+ * if annotated classes should be listed in the persistence.xml in order to
+ * be considered part of a persistence unit
+ * (This additional setting is necessary in order to use synchHelper within
+ * the wizard - there must be a unique property for each radio button. Stupid
+ * but true)
+ */
+ String LIST_ANNOTATED_CLASSES = PREFIX_ + "LIST_ANNOTATED_CLASSES";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
new file mode 100644
index 0000000000..b342c07b07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
@@ -0,0 +1,715 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.ConnectionProfile;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
+import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
+import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
+import org.eclipse.osgi.util.NLS;
+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.project.facet.core.IFacetedProjectWorkingCopy;
+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;
+
+public abstract class JpaFacetDataModelProvider
+ extends FacetInstallDataModelProvider
+ implements JpaFacetDataModelProperties
+{
+ protected static final String EJB_FACET_ID = IModuleConstants.JST_EJB_MODULE;
+
+ protected static final IStatus PLATFORM_NOT_SPECIFIED_STATUS =
+ buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_NOT_SPECIFIED);
+
+ protected static final IStatus CONNECTION_NOT_CONNECTED_STATUS =
+ buildInfoStatus(JptCoreMessages.VALIDATE_CONNECTION_NOT_CONNECTED);
+
+ protected static final IStatus USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS =
+ buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED);
+
+ protected static final IStatus USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS =
+ buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED);
+
+
+ private LibraryInstallDelegate defaultLibraryProvider;
+
+ /** cache the connection profile - change it whenever the user selects a different name */
+ private ConnectionProfile connectionProfile;
+
+
+ /**
+ * required default constructor
+ */
+ protected JpaFacetDataModelProvider() {
+ super();
+ }
+
+
+ @Override
+ public Set<String> getPropertyNames() {
+ @SuppressWarnings("unchecked") Set<String> propertyNames = super.getPropertyNames();
+ propertyNames.add(RUNTIME);
+ propertyNames.add(PLATFORM);
+ propertyNames.add(LIBRARY_PROVIDER_DELEGATE);
+ propertyNames.add(CONNECTION);
+ propertyNames.add(CONNECTION_ACTIVE);
+ propertyNames.add(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG);
+ propertyNames.add(USER_OVERRIDE_DEFAULT_CATALOG);
+ propertyNames.add(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA);
+ propertyNames.add(USER_OVERRIDE_DEFAULT_SCHEMA);
+ propertyNames.add(DISCOVER_ANNOTATED_CLASSES);
+ propertyNames.add(LIST_ANNOTATED_CLASSES);
+ return propertyNames;
+ }
+
+
+ // ********** properties **********
+
+ protected IFacetedProjectWorkingCopy getFacetedProjectWorkingCopy() {
+ return (IFacetedProjectWorkingCopy) this.getProperty(FACETED_PROJECT_WORKING_COPY);
+ }
+
+ protected IProjectFacetVersion getProjectFacetVersion() {
+ return (IProjectFacetVersion) this.getProperty(FACET_VERSION);
+ }
+
+ protected IRuntime getRuntime() {
+ return (IRuntime) this.getProperty(RUNTIME);
+ }
+
+ protected JpaPlatformDescription getPlatform() {
+ return (JpaPlatformDescription) getProperty(PLATFORM);
+ }
+
+ protected LibraryInstallDelegate getLibraryInstallDelegate() {
+ return (LibraryInstallDelegate) this.getProperty(LIBRARY_PROVIDER_DELEGATE);
+ }
+
+ protected String getConnectionName() {
+ return (String) this.getProperty(CONNECTION);
+ }
+
+ protected boolean userWantsToOverrideDefaultCatalog() {
+ return this.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG);
+ }
+
+ protected String getUserOverrideDefaultCatalog() {
+ return (String) this.getProperty(USER_OVERRIDE_DEFAULT_CATALOG);
+ }
+
+ protected boolean userWantsToOverrideDefaultSchema() {
+ return this.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA);
+ }
+
+ protected String getUserOverrideDefaultSchema() {
+ return (String) this.getProperty(USER_OVERRIDE_DEFAULT_SCHEMA);
+ }
+
+ protected boolean discoverAnnotatedClasses() {
+ return this.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES);
+ }
+
+
+ // ********** enabled **********
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
+ return this.connectionIsActive() && this.databaseSupportsCatalogs();
+ }
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
+ return this.userWantsToOverrideDefaultCatalog();
+ }
+ if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
+ return this.connectionIsActive();
+ }
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
+ return this.userWantsToOverrideDefaultSchema();
+ }
+
+ return super.isPropertyEnabled(propertyName);
+ }
+
+
+ // ********** defaults **********
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(FACET_ID)) {
+ return JpaFacet.ID;
+ }
+ if (propertyName.equals(RUNTIME)) {
+ return null;
+ }
+ if (propertyName.equals(PLATFORM)) {
+ return getDefaultPlatform();
+ }
+ if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) {
+ return getDefaultLibraryProvider();
+ }
+ if (propertyName.equals(CONNECTION)) {
+ return getDefaultConnection();
+ }
+ if (propertyName.equals(CONNECTION_ACTIVE)) {
+ return Boolean.valueOf(this.connectionIsActive());
+ }
+ if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
+ return getDefaultUserWantsToOverrideDefaultCatalog();
+ }
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
+ return getDefaultCatalogIdentifier();
+ }
+ if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
+ return getDefaultUserWantsToOverrideDefaultSchema();
+ }
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
+ return getDefaultSchemaIdentifier();
+ }
+ if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) {
+ return getDefaultDiscoverAnnotatedClasses();
+ }
+ if (propertyName.equals(LIST_ANNOTATED_CLASSES)) {
+ return getDefaultListAnnotatedClasses();
+ }
+
+ return super.getDefaultProperty(propertyName);
+ }
+
+ protected abstract JpaPlatformDescription getDefaultPlatform();
+
+ protected LibraryInstallDelegate getDefaultLibraryProvider() {
+ // delegate itself changes only when facet version changes
+ if (this.defaultLibraryProvider == null) {
+ this.defaultLibraryProvider = buildDefaultLibraryProvider();
+ }
+ else if (! this.defaultLibraryProvider.getProjectFacetVersion().equals(getProjectFacetVersion())) {
+ this.defaultLibraryProvider.dispose();
+ this.defaultLibraryProvider = buildDefaultLibraryProvider();
+ }
+ return defaultLibraryProvider;
+ }
+
+ protected LibraryInstallDelegate buildDefaultLibraryProvider() {
+ IFacetedProjectWorkingCopy fpjwc = this.getFacetedProjectWorkingCopy();
+ if (fpjwc == null) {
+ return null;
+ }
+ IProjectFacetVersion pfv = this.getProjectFacetVersion();
+ if (pfv == null) {
+ return null;
+ }
+ LibraryInstallDelegate lp = new LibraryInstallDelegate(fpjwc, pfv);
+ lp.addListener(buildLibraryProviderListener());
+ return lp;
+ }
+
+ protected IPropertyChangeListener buildLibraryProviderListener() {
+ return new IPropertyChangeListener() {
+ public void propertyChanged(String property, Object oldValue, Object newValue ) {
+ if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) {
+ adjustLibraryProviders();
+ }
+ JpaFacetDataModelProvider.this.getDataModel().notifyPropertyChange(
+ LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG);
+ }
+ };
+ }
+
+ protected abstract String getDefaultConnection();
+
+ protected abstract Boolean getDefaultUserWantsToOverrideDefaultCatalog();
+
+ protected abstract String getDefaultCatalogIdentifier();
+
+ protected abstract Boolean getDefaultUserWantsToOverrideDefaultSchema();
+
+ protected abstract String getDefaultSchemaIdentifier();
+
+ protected abstract Boolean getDefaultDiscoverAnnotatedClasses();
+
+ protected Boolean getDefaultListAnnotatedClasses() {
+ return Boolean.valueOf( ! this.discoverAnnotatedClasses());
+ }
+
+ protected boolean runtimeSupportsEjb30() {
+ IRuntime runtime = this.getRuntime();
+ return (runtime != null) && runtime.supports(this.getEJB30());
+ }
+
+ protected IProjectFacetVersion getEJB30() {
+ return ProjectFacetsManager.getProjectFacet(EJB_FACET_ID).getVersion("3.0"); //$NON-NLS-1$
+ }
+
+
+ // ********** synchronize data model **********
+
+ /**
+ * The specified property's value has changed to the specified value.
+ * Return whether to fire a VALUE_CHG DataModelEvent.
+ */
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ boolean ok = super.propertySet(propertyName, propertyValue);
+
+ if (propertyName.equals(FACETED_PROJECT_WORKING_COPY)) {
+ //no-op
+ }
+ else if (propertyName.equals(FACET_VERSION)) {
+ adjustLibraryProviders();
+ this.model.notifyPropertyChange(PLATFORM, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(LIBRARY_PROVIDER_DELEGATE, IDataModel.DEFAULT_CHG);
+ }
+ else if (propertyName.equals(RUNTIME)) {
+ LibraryInstallDelegate lid = this.getLibraryInstallDelegate();
+ if (lid != null) {
+ // may be null while model is being built up
+ // ... or in tests
+ lid.refresh();
+ }
+ this.model.notifyPropertyChange(DISCOVER_ANNOTATED_CLASSES, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(LIST_ANNOTATED_CLASSES, IDataModel.DEFAULT_CHG);
+ }
+ else if (propertyName.equals(PLATFORM)) {
+ adjustLibraryProviders();
+ }
+ else if (propertyName.equals(CONNECTION)) {
+ this.setBooleanProperty(CONNECTION_ACTIVE, this.connectionIsActive());
+
+ // JpaFacetWizardPage sets the connection when the user adds a new connection
+ // implying that there is a new set of valid connections to choose from
+ this.model.notifyPropertyChange(CONNECTION, IDataModel.VALID_VALUES_CHG);
+
+ // catalog
+ if ((propertyValue != null) && this.databaseSupportsCatalogs()) { // connection set to something that supports catalogs
+ this.setProperty(USER_OVERRIDE_DEFAULT_CATALOG, this.getDefaultCatalogIdentifier());
+ } else { // connection either '<None>' or non-catalog database
+ this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, false);
+ }
+ this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, IDataModel.ENABLE_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.VALID_VALUES_CHG);
+
+ // schema
+ if (propertyValue == null) { // connection set to '<None>'
+ this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, false);
+ } else {
+ this.setProperty(USER_OVERRIDE_DEFAULT_SCHEMA, this.getDefaultSchemaIdentifier());
+ }
+ this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, IDataModel.ENABLE_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.VALID_VALUES_CHG);
+ }
+ else if (propertyName.equals(CONNECTION_ACTIVE)) {
+ // catalog
+ if (this.propertyValueIsFalse(propertyValue)) { // connection is inactive
+ this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, false);
+ }
+ this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, IDataModel.ENABLE_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.VALID_VALUES_CHG);
+
+ // schema
+ if (this.propertyValueIsFalse(propertyValue)) { // connection is inactive
+ this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, false);
+ }
+ this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, IDataModel.ENABLE_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.VALID_VALUES_CHG);
+ }
+ else if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.ENABLE_CHG);
+ if (this.propertyValueIsFalse(propertyValue)) {
+ this.setProperty(USER_OVERRIDE_DEFAULT_CATALOG, null);
+ }
+ }
+ else if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
+ this.setProperty(USER_OVERRIDE_DEFAULT_SCHEMA, this.getDefaultSchemaIdentifier());
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.VALID_VALUES_CHG);
+ }
+ else if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
+ this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.ENABLE_CHG);
+ if (this.propertyValueIsFalse(propertyValue)) {
+ this.setProperty(USER_OVERRIDE_DEFAULT_SCHEMA, null);
+ }
+ }
+ else if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) {
+ this.setBooleanProperty(LIST_ANNOTATED_CLASSES, this.propertyValueIsFalse(propertyValue));
+ }
+ else if (propertyName.equals(LIST_ANNOTATED_CLASSES)) {
+ this.setBooleanProperty(DISCOVER_ANNOTATED_CLASSES, this.propertyValueIsFalse(propertyValue));
+ }
+ return ok;
+ }
+
+ protected boolean propertyValueIsFalse(Object propertyValue) {
+ return ! this.propertyValueIsTrue(propertyValue);
+ }
+
+ protected boolean propertyValueIsTrue(Object propertyValue) {
+ return ((Boolean) propertyValue).booleanValue();
+ }
+
+ protected void adjustLibraryProviders() {
+ LibraryInstallDelegate lid = this.getLibraryInstallDelegate();
+ if (lid != null) {
+ List<JpaLibraryProviderInstallOperationConfig> jpaConfigs
+ = new ArrayList<JpaLibraryProviderInstallOperationConfig>();
+ // add the currently selected one first
+ JpaLibraryProviderInstallOperationConfig currentJpaConfig = null;
+ LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig();
+ if (config instanceof JpaLibraryProviderInstallOperationConfig) {
+ currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config;
+ jpaConfigs.add(currentJpaConfig);
+ }
+ for (ILibraryProvider lp : lid.getLibraryProviders()) {
+ config = lid.getLibraryProviderOperationConfig(lp);
+ if (config instanceof JpaLibraryProviderInstallOperationConfig
+ && ! config.equals(currentJpaConfig)) {
+ jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config);
+ }
+ }
+ for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) {
+ jpaConfig.setJpaPlatform(getPlatform());
+ }
+ }
+ }
+
+
+ // ********** property descriptors **********
+
+ @Override
+ public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
+ if (propertyName.equals(PLATFORM)) {
+ return this.buildValidPlatformDescriptors();
+ }
+ if (propertyName.equals(CONNECTION)) {
+ return this.buildValidConnectionDescriptors();
+ }
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
+ return this.buildValidCatalogDescriptors();
+ }
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
+ return this.buildValidSchemaDescriptors();
+ }
+
+ return super.getValidPropertyDescriptors(propertyName);
+ }
+
+ protected DataModelPropertyDescriptor[] buildValidPlatformDescriptors() {
+ Iterable<JpaPlatformDescription> validPlatformDescriptions = buildValidPlatformDescriptions();
+ Iterable<DataModelPropertyDescriptor> validPlatformDescriptors =
+ new TransformationIterable<JpaPlatformDescription, DataModelPropertyDescriptor>(validPlatformDescriptions) {
+ @Override
+ protected DataModelPropertyDescriptor transform(JpaPlatformDescription desc) {
+ return buildPlatformDescriptor(desc);
+ }
+ };
+ return ArrayTools.sort(ArrayTools.array(validPlatformDescriptors, EMPTY_DMPD_ARRAY), DESCRIPTOR_COMPARATOR);
+ }
+
+ protected Iterable<JpaPlatformDescription> buildValidPlatformDescriptions() {
+ return new FilteringIterable<JpaPlatformDescription>(
+ JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatforms()) {
+ @Override
+ protected boolean accept(JpaPlatformDescription o) {
+ return o.supportsJpaFacetVersion(getProjectFacetVersion());
+ }
+ };
+ }
+
+ protected static final Comparator<DataModelPropertyDescriptor> DESCRIPTOR_COMPARATOR =
+ new Comparator<DataModelPropertyDescriptor>() {
+ public int compare(DataModelPropertyDescriptor dmpd1, DataModelPropertyDescriptor dmpd2) {
+ return dmpd1.getPropertyDescription().compareTo(dmpd2.getPropertyDescription());
+ }
+ };
+
+ protected DataModelPropertyDescriptor[] buildValidConnectionDescriptors() {
+ List<String> connectionNames = this.buildValidConnectionNames();
+ DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[connectionNames.size()];
+ for (int i = 0; i < descriptors.length; i++) {
+ descriptors[i] = this.buildConnectionDescriptor(connectionNames.get(i));
+ }
+ return descriptors;
+ }
+
+ /**
+ * put a null entry at the top of the list (for <none>)
+ */
+ protected List<String> buildValidConnectionNames() {
+ List<String> connectionNames = CollectionTools.sort(CollectionTools.list(this.getConnectionProfileNames()));
+ connectionNames.add(0, null);
+ return connectionNames;
+ }
+
+ protected DataModelPropertyDescriptor[] buildValidCatalogDescriptors() {
+ Database db = this.getDatabase();
+ return (db == null) ? EMPTY_DMPD_ARRAY : this.buildDescriptors(this.buildValidCatalogIdentifiers(db));
+ }
+
+ /**
+ * pre-condition: 'db' is not null
+ */
+ protected List<String> buildValidCatalogIdentifiers(Database db) {
+ // use catalog *identifiers* since the string ends up being the "default" for various text entries
+ return this.buildValidStrings(db.getSortedCatalogIdentifiers(), this.getDefaultCatalogIdentifier());
+ }
+
+ protected DataModelPropertyDescriptor[] buildValidSchemaDescriptors() {
+ Database db = this.getDatabase();
+ return (db == null) ? EMPTY_DMPD_ARRAY : this.buildDescriptors(this.buildValidSchemaIdentifiers());
+ }
+
+ protected List<String> buildValidSchemaIdentifiers() {
+ return this.buildValidStrings(this.getSchemaIdentifiers(), this.getDefaultSchemaIdentifier());
+ }
+
+ protected Iterable<String> getSchemaIdentifiers() {
+ SchemaContainer sc = this.getSchemaContainer();
+ // use schema *identifiers* since the string ends up being the "default" for various text entries
+ return (sc != null) ? sc.getSortedSchemaIdentifiers() : EmptyIterable.<String>instance();
+ }
+
+ /**
+ * put an entry for the default at the top of the list
+ */
+ protected List<String> buildValidStrings(Iterable<String> strings, String defaultString) {
+ List<String> validStrings = CollectionTools.list(strings);
+ if ((defaultString != null) && ! validStrings.contains(defaultString)) {
+ validStrings.add(0, defaultString);
+ }
+ return validStrings;
+ }
+
+ protected DataModelPropertyDescriptor[] buildDescriptors(List<String> strings) {
+ DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[strings.size()];
+ for (int i = 0; i < descriptors.length; i++) {
+ descriptors[i] = new DataModelPropertyDescriptor(strings.get(i));
+ }
+ return descriptors;
+ }
+
+ protected static final DataModelPropertyDescriptor[] EMPTY_DMPD_ARRAY = new DataModelPropertyDescriptor[0];
+
+ /**
+ * platform and connection have 'description's (in addition to 'value's)
+ */
+ @Override
+ public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
+ if (propertyName.equals(PLATFORM)) {
+ return buildPlatformDescriptor(this.getPlatform());
+ }
+ if (propertyName.equals(CONNECTION)) {
+ return buildConnectionDescriptor(this.getConnectionName());
+ }
+ return super.getPropertyDescriptor(propertyName);
+ }
+
+ protected DataModelPropertyDescriptor buildPlatformDescriptor(JpaPlatformDescription platform) {
+ return new DataModelPropertyDescriptor(platform, platform.getLabel());
+ }
+
+ protected String getPlatformLabel(String platformId) {
+ return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(platformId).getLabel();
+ }
+
+ protected DataModelPropertyDescriptor buildConnectionDescriptor(String connectionName) {
+ String description = (connectionName == null) ? JptCoreMessages.NONE : null;
+ return new DataModelPropertyDescriptor(connectionName, description);
+ }
+
+
+ // ********** database **********
+
+ protected SchemaContainer getSchemaContainer() {
+ return this.databaseSupportsCatalogs() ? this.getCatalog() : this.getDatabase();
+ }
+
+ protected Catalog getCatalog() {
+ String name = this.getUserOverrideDefaultCatalog();
+ return (name == null) ? null : this.getCatalog(name);
+ }
+
+ /**
+ * pre-condition: 'name' is not null
+ */
+ protected Catalog getCatalog(String name) {
+ Database db = this.getDatabase();
+ return (db == null) ? null : db.getCatalogForIdentifier(name);
+ }
+
+ protected boolean databaseSupportsCatalogs() {
+ Database db = this.getDatabase();
+ return (db != null) && db.supportsCatalogs();
+ }
+
+ protected Database getDatabase() {
+ ConnectionProfile cp = this.getConnectionProfile();
+ return (cp == null) ? null : cp.getDatabase();
+ }
+
+ protected boolean connectionIsActive() {
+ ConnectionProfile cp = this.getConnectionProfile();
+ return (cp != null) && cp.isActive();
+ }
+
+ protected ConnectionProfile getConnectionProfile() {
+ String name = this.getConnectionName();
+ return (name == null) ? null : this.getConnectionProfile(name);
+ }
+
+ /**
+ * pre-condition: 'name' is not null
+ */
+ protected ConnectionProfile getConnectionProfile(String name) {
+ if (this.cachedConnectionProfileIsStale(name)) {
+ this.connectionProfile = this.buildConnectionProfile(name);
+ }
+ return this.connectionProfile;
+ }
+
+ protected boolean cachedConnectionProfileIsStale(String name) {
+ return (this.connectionProfile == null) || ! this.connectionProfile.getName().equals(name);
+ }
+
+ protected ConnectionProfile buildConnectionProfile(String name) {
+ return this.getConnectionProfileFactory().buildConnectionProfile(name, DatabaseIdentifierAdapter.Default.instance());
+ }
+
+ protected Iterable<String> getConnectionProfileNames() {
+ return this.getConnectionProfileFactory().getConnectionProfileNames();
+ }
+
+ protected ConnectionProfileFactory getConnectionProfileFactory() {
+ // we don't have a JPA project yet, so go to the db plug-in directly to get the factory
+ return JptJpaDbPlugin.getConnectionProfileFactory();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public IStatus validate(String propertyName) {
+ if (propertyName.equals(PLATFORM)) {
+ return this.validatePlatform();
+ }
+ if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) {
+ return this.getLibraryInstallDelegate().validate();
+ }
+ if (propertyName.equals(CONNECTION)) {
+ return this.validateConnection();
+ }
+ if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)
+ || propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
+ return this.validateUserOverrideDefaultCatalog();
+ }
+ if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)
+ || propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
+ return this.validateUserOverrideDefaultSchema();
+ }
+ if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) {
+ return this.validatePersistentClassManagement();
+ }
+
+ return super.validate(propertyName);
+ }
+
+ protected IStatus validatePlatform() {
+ return (this.getPlatform() == null) ? PLATFORM_NOT_SPECIFIED_STATUS : OK_STATUS;
+ }
+
+ protected IStatus validateConnection() {
+ String connectionName = this.getConnectionName();
+ return (connectionName == null) ? OK_STATUS : this.validateNonNullConnection(connectionName);
+ }
+
+ protected IStatus validateNonNullConnection(String connectionName) {
+ ConnectionProfile cp = this.getConnectionProfile(connectionName);
+ if (cp == null) {
+ return buildErrorStatus(NLS.bind(JptCoreMessages.VALIDATE_CONNECTION_INVALID, connectionName));
+ }
+ if ( ! cp.isActive()) {
+ return CONNECTION_NOT_CONNECTED_STATUS;
+ }
+ return OK_STATUS;
+ }
+
+ protected IStatus validateUserOverrideDefaultCatalog() {
+ if (this.userWantsToOverrideDefaultCatalog()) {
+ if (this.getUserOverrideDefaultCatalog() == null) {
+ return USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS;
+ }
+ }
+ return OK_STATUS;
+ }
+
+ protected IStatus validateUserOverrideDefaultSchema() {
+ if (this.userWantsToOverrideDefaultSchema()) {
+ if (this.getUserOverrideDefaultSchema() == null) {
+ return USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS;
+ }
+ }
+ return OK_STATUS;
+ }
+
+ protected IStatus validatePersistentClassManagement() {
+ // TODO warning if "discovery" is used, but no runtime specified ??
+ // boolean discoverAnnotatedClasses = this.discoverAnnotatedClasses();
+ return OK_STATUS;
+ }
+
+
+ // ********** static methods **********
+
+ protected static IStatus buildInfoStatus(String message) {
+ return buildStatus(IStatus.INFO, message);
+ }
+
+// private static IStatus buildWarningStatus(String message) {
+// return buildStatus(IStatus.WARNING, message);
+// }
+
+ protected static IStatus buildErrorStatus(String message) {
+ return buildStatus(IStatus.ERROR, message);
+ }
+
+ protected static IStatus buildStatus(int severity, String message) {
+ return new Status(severity, JptJpaCorePlugin.PLUGIN_ID, message);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java
new file mode 100644
index 0000000000..a72c4206a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+@SuppressWarnings("nls")
+public interface JpaFacetInstallDataModelProperties
+ extends JpaFacetDataModelProperties
+{
+ String PREFIX = "JpaFacetInstallDataModelProperties";
+ String PREFIX_ = PREFIX + '.';
+
+ /**
+ * Required, type Boolean, identifies if the user wishes to add the database driver jars to the classpath
+ */
+ String USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH = PREFIX_ + "USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH";
+
+ /**
+ * Not required, type String, identifies the database driver library added to the classpath
+ */
+ String DB_DRIVER_NAME = PREFIX_ + "DB_DRIVER_NAME";
+
+ /**
+ * Required, type boolean, details whether orm.xml should be created
+ */
+ String CREATE_ORM_XML = PREFIX_ + "CREATE_ORM_XML";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java
new file mode 100644
index 0000000000..a70e069003
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import java.util.Set;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.db.ConnectionProfile;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class JpaFacetInstallDataModelProvider
+ extends JpaFacetDataModelProvider
+ implements JpaFacetInstallDataModelProperties
+{
+ /**
+ * required default constructor
+ */
+ public JpaFacetInstallDataModelProvider() {
+ super();
+ }
+
+ @Override
+ public Set<String> getPropertyNames() {
+ Set<String> propertyNames = super.getPropertyNames();
+ propertyNames.add(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH);
+ propertyNames.add(DB_DRIVER_NAME);
+ propertyNames.add(CREATE_ORM_XML);
+ return propertyNames;
+ }
+
+
+ // ********** properties **********
+
+ protected boolean userWantsToAddDbDriverJarsToClasspath() {
+ return this.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH);
+ }
+
+ protected String getDriverName() {
+ return (String) this.getProperty(DB_DRIVER_NAME);
+ }
+
+
+ // ********** enabled **********
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
+ return (this.getConnectionProfile() != null);
+ }
+ if (propertyName.equals(DB_DRIVER_NAME)) {
+ return this.userWantsToAddDbDriverJarsToClasspath();
+ }
+
+ return super.isPropertyEnabled(propertyName);
+ }
+
+
+ // ********** defaults **********
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
+ return Boolean.FALSE;
+ }
+ if (propertyName.equals(DB_DRIVER_NAME)) {
+ return this.getDefaultDriverName();
+ }
+ if (propertyName.equals(CREATE_ORM_XML)) {
+ return Boolean.FALSE;
+ }
+
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ protected JpaPlatformDescription getDefaultPlatform() {
+ return JptJpaCorePlugin.getDefaultJpaPlatform(getProjectFacetVersion());
+ }
+
+ @Override
+ protected String getDefaultConnection() {
+ return null;
+ }
+
+ @Override
+ protected Boolean getDefaultUserWantsToOverrideDefaultCatalog() {
+ return Boolean.FALSE;
+ }
+
+ @Override
+ protected String getDefaultCatalogIdentifier() {
+ Database db = this.getDatabase();
+ return (db == null) ? null : db.getDefaultCatalogIdentifier();
+ }
+
+ @Override
+ protected Boolean getDefaultUserWantsToOverrideDefaultSchema() {
+ return Boolean.FALSE;
+ }
+
+ @Override
+ protected String getDefaultSchemaIdentifier() {
+ SchemaContainer sc = this.getSchemaContainer();
+ return (sc == null) ? null : sc.getDefaultSchemaIdentifier();
+ }
+
+ protected String getDefaultDriverName() {
+ ConnectionProfile cp = this.getConnectionProfile();
+ return (cp == null) ? null : cp.getDriverName();
+ }
+
+ @Override
+ protected Boolean getDefaultDiscoverAnnotatedClasses() {
+ return Boolean.valueOf(this.runtimeSupportsEjb30());
+ }
+
+
+ // ********** synchronize data model **********
+
+ /**
+ * The specified property's value has changed to the specified value.
+ * Return whether to fire a VALUE_CHG DataModelEvent.
+ */
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ boolean ok = super.propertySet(propertyName, propertyValue);
+
+ if (propertyName.equals(CONNECTION)) {
+ // db driver
+ if (propertyValue == null) { // connection set to '<None>'
+ this.setBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH, false);
+ }
+ this.model.notifyPropertyChange(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH, IDataModel.ENABLE_CHG);
+ this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.VALID_VALUES_CHG);
+ }
+ else if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
+ this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.ENABLE_CHG);
+ if (this.propertyValueIsFalse(propertyValue)) {
+ this.setProperty(DB_DRIVER_NAME, null);
+ }
+ }
+
+ return ok;
+ }
+
+
+ // ********** property descriptors **********
+
+ @Override
+ public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
+ if (propertyName.equals(PLATFORM)) {
+ return this.buildValidPlatformDescriptors();
+ }
+
+ if (propertyName.equals(CONNECTION)) {
+ return this.buildValidConnectionDescriptors();
+ }
+
+ if (propertyName.equals(DB_DRIVER_NAME)) {
+ return this.buildValidDriverDescriptors();
+ }
+
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
+ return this.buildValidCatalogDescriptors();
+ }
+
+ if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
+ return this.buildValidSchemaDescriptors();
+ }
+
+ return super.getValidPropertyDescriptors(propertyName);
+ }
+
+ protected DataModelPropertyDescriptor[] buildValidDriverDescriptors() {
+ return new DataModelPropertyDescriptor[] { new DataModelPropertyDescriptor(this.getDriverName()) };
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public IStatus validate(String propertyName) {
+ if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)
+ || propertyName.equals(DB_DRIVER_NAME)) {
+ return this.validateDbDriverName();
+ }
+
+ return super.validate(propertyName);
+ }
+
+ protected IStatus validateDbDriverName() {
+ return OK_STATUS;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java
new file mode 100644
index 0000000000..5c07250f1a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.resource.ResourceLocator;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
+import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProvider;
+import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.validation.ValidationFramework;
+
+/**
+ * We don't really "install" the JPA facet here. We simply store all the various
+ * data model properties in the appropriate preferences. These settings will
+ * used in the POST_INSTALL event listener to build the JPA project.
+ */
+public class JpaFacetInstallDelegate
+ extends JpaFacetActionDelegate
+ implements JpaFacetInstallDataModelProperties
+{
+ @Override
+ protected void execute_(
+ IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+
+ SubMonitor sm = SubMonitor.convert(monitor, 10);
+
+ ValidationFramework.getDefault().addValidationBuilder(project);
+
+ super.execute_(project, fv, config, sm.newChild(1));
+
+ IJavaProject javaProject = JavaCore.create(project);
+ IDataModel dataModel = (IDataModel) config;
+
+ // project settings
+ this.addDbDriverLibraryToClasspath(javaProject, dataModel, sm.newChild(1));
+
+ // create project XML files
+ this.createProjectXml(project, dataModel.getBooleanProperty(CREATE_ORM_XML), sm.newChild(8));
+ }
+
+ protected void addDbDriverLibraryToClasspath(
+ IJavaProject javaProject, IDataModel dataModel,
+ IProgressMonitor monitor) throws CoreException {
+
+ if( ! dataModel.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
+ return;
+ }
+ String driverName = dataModel.getStringProperty(DB_DRIVER_NAME);
+
+ IClasspathContainer container = JptJpaDbPlugin.instance().buildDriverClasspathContainerFor(driverName);
+ IClasspathEntry entry = JavaCore.newContainerEntry(container.getPath());
+ this.addClasspathEntryToProject(entry, javaProject, monitor);
+ }
+
+ private void addClasspathEntryToProject(
+ IClasspathEntry classpathEntry, IJavaProject javaProject, IProgressMonitor monitor)
+ throws CoreException {
+
+ // if the classpathEntry is already there, do nothing
+ IClasspathEntry[] classpath = javaProject.getRawClasspath();
+ if (ArrayTools.contains(classpath, classpathEntry)) {
+ return;
+ }
+
+ // add the given classpathEntry to the project classpath
+ int len = classpath.length;
+ IClasspathEntry[] newClasspath = new IClasspathEntry[len + 1];
+ System.arraycopy(classpath, 0, newClasspath, 0, len);
+ newClasspath[len] = classpathEntry;
+ javaProject.setRawClasspath(newClasspath, monitor);
+ }
+
+ private void createProjectXml(IProject project, boolean buildOrmXml, IProgressMonitor monitor) {
+ int tasks = 1 + (buildOrmXml ? 1 : 0);
+ SubMonitor sm = SubMonitor.convert(monitor, tasks);
+
+ this.createPersistenceXml(project, sm.newChild(1));
+ if (buildOrmXml) {
+ this.createOrmXml(project, sm.newChild(1));
+ }
+ }
+
+ private void createPersistenceXml(IProject project, IProgressMonitor monitor) {
+ SubMonitor sm = SubMonitor.convert(monitor, 5);
+
+ IDataModel config = DataModelFactory.createDataModel(new PersistenceFileCreationDataModelProvider());
+ config.setProperty(CONTAINER_PATH, defaultResourceLocation(project));
+ sm.worked(1);
+ // default values for all other properties should suffice
+ try {
+ config.getDefaultOperation().execute(sm.newChild(4), null);
+ } catch (ExecutionException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ private void createOrmXml(IProject project, IProgressMonitor monitor) {
+ SubMonitor sm = SubMonitor.convert(monitor, 5);
+
+ IDataModel config = DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
+ config.setProperty(CONTAINER_PATH, defaultResourceLocation(project));
+ sm.worked(1);
+ // default values for all other properties should suffice
+ try {
+ config.getDefaultOperation().execute(sm.newChild(4), null);
+ } catch (ExecutionException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ protected IPath defaultResourceLocation(IProject project) {
+ ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(project);
+ if (resourceLocator == null) {
+ JptJpaCorePlugin.log("No resource locator for project");
+ return null;
+ }
+ return resourceLocator.getDefaultResourceLocation(project).getFullPath();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java
new file mode 100644
index 0000000000..b71b2ce923
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class JpaFacetUninstallDelegate
+ implements IDelegate
+{
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+
+ JptJpaCorePlugin.clearProjectPreferences(project);
+ JptJpaCorePlugin.clearProjectPersistentProperties(project);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
new file mode 100644
index 0000000000..ab06bfed9c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+
+public class JpaFacetVersionChangeDataModelProvider
+ extends JpaFacetDataModelProvider
+ implements JpaFacetDataModelProperties
+{
+ protected static final IStatus PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS =
+ buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION);
+
+
+ /**
+ * required default constructor
+ */
+ public JpaFacetVersionChangeDataModelProvider() {
+ super();
+ }
+
+
+ protected String getProjectName() {
+ return getStringProperty(FACET_PROJECT_NAME);
+ }
+
+ protected JpaProject getJpaProject() {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
+ return JptJpaCorePlugin.getJpaProject(project);
+ }
+
+
+ // **************** defaults **********************************************
+
+ @Override
+ protected JpaPlatformDescription getDefaultPlatform() {
+ return getJpaProject().getJpaPlatform().getDescription();
+ }
+
+ @Override
+ protected String getDefaultConnection() {
+ return getJpaProject().getDataSource().getConnectionProfileName();
+ }
+
+ @Override
+ protected Boolean getDefaultUserWantsToOverrideDefaultCatalog() {
+ return getJpaProject().getUserOverrideDefaultCatalog() != null;
+ }
+
+ @Override
+ protected String getDefaultCatalogIdentifier() {
+ return getJpaProject().getUserOverrideDefaultCatalog();
+ }
+
+ @Override
+ protected Boolean getDefaultUserWantsToOverrideDefaultSchema() {
+ return getJpaProject().getUserOverrideDefaultSchema() != null;
+ }
+
+ @Override
+ protected String getDefaultSchemaIdentifier() {
+ return getJpaProject().getDefaultSchema();
+ }
+
+ @Override
+ protected Boolean getDefaultDiscoverAnnotatedClasses() {
+ return getJpaProject().discoversAnnotatedClasses();
+ }
+
+
+ // **************** valid property descriptors ****************************
+
+ @Override
+ protected Iterable<JpaPlatformDescription> buildValidPlatformDescriptions() {
+ // add existing platform to list of choices
+ Iterable<JpaPlatformDescription> validPlatformDescs = super.buildValidPlatformDescriptions();
+ if (! CollectionTools.contains(validPlatformDescs, getDefaultPlatform())) {
+ validPlatformDescs = new CompositeIterable(getDefaultPlatform(), validPlatformDescs);
+ }
+ return validPlatformDescs;
+ }
+
+
+ // **************** validation ********************************************
+
+ @Override
+ protected IStatus validatePlatform() {
+ IStatus status = super.validatePlatform();
+
+ if (status.isOK()) {
+ if (! getPlatform().supportsJpaFacetVersion(getProjectFacetVersion())) {
+ status = PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS;
+ }
+ }
+
+ return status;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java
new file mode 100644
index 0000000000..9935431623
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class JpaFacetVersionChangeDelegate
+ extends JpaFacetActionDelegate
+{
+ @Override
+ protected void execute_(
+ IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException
+ {
+ SubMonitor sm = SubMonitor.convert(monitor, 2);
+ super.execute_(project, fv, config, sm.newChild(1));
+
+ JptJpaCorePlugin.rebuildJpaProject(project);
+ sm.worked(1);
+ // nothing further to do here *just* yet
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java
new file mode 100644
index 0000000000..59d4ef4ee1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+
+public class RuntimeChangedListener
+ implements IFacetedProjectListener {
+
+ public void handleEvent(IFacetedProjectEvent facetedProjectEvent) {
+
+ IFacetedProjectBase fpb = facetedProjectEvent.getWorkingCopy();
+ if (fpb == null) {
+ fpb = facetedProjectEvent.getProject();
+ }
+ IProjectFacetVersion pfv = fpb.getProjectFacetVersion(JpaFacet.FACET);
+ if (pfv != null) {
+ LibraryInstallDelegate lp = new LibraryInstallDelegate(fpb, pfv);
+ try {
+ lp.execute(new NullProgressMonitor());
+ }
+ catch (CoreException ce) {
+ JptJpaCorePlugin.log(ce);
+ }
+ }
+ }
+
+ protected String getJpaPlatformId(IProject project) {
+ JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
+ return (jpaProject == null) ? null : jpaProject.getJpaPlatform().getId();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java
new file mode 100644
index 0000000000..f7f658d9e6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1;
+
+import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
+import org.eclipse.jpt.jpa.db.ConnectionAdapter;
+import org.eclipse.jpt.jpa.db.ConnectionListener;
+import org.eclipse.jpt.jpa.db.ConnectionProfile;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
+import org.eclipse.jpt.jpa.db.ConnectionProfileListener;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
+import org.eclipse.jpt.jpa.db.DatabaseObject;
+
+/**
+ * GenericJpaDataSource
+ */
+public class GenericJpaDataSource
+ extends AbstractJpaNode
+ implements JpaDataSource
+{
+ /**
+ * cache the connection profile name so we can detect when
+ * it changes and notify listeners
+ */
+ protected String connectionProfileName;
+
+ protected transient ConnectionProfile connectionProfile;
+
+ /**
+ * listen for the connection to be added or removed or its name changed
+ */
+ protected final ConnectionProfileListener connectionProfileListener;
+
+ /**
+ * listen for the connection to be opened or closed
+ */
+ protected final ConnectionListener connectionListener;
+
+ private static final long serialVersionUID = 1L;
+
+
+ // ********** constructor/initialization **********
+
+ public GenericJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
+ super(jpaProject);
+ //moving the building of the connection profile before the connectionProfileListener
+ //is added. Need to make sure the loading of db profiles is completed before
+ //listening, otherwise we get notifications before our model is finished being built.
+ //this means our updater is called before it is set which results in an IllegalStateException.
+ //Hopefully this change is temporary and DTP will fix bug 246270 where I suggest they
+ //not fire events when building profiles.
+ this.connectionProfileName = connectionProfileName;
+ this.connectionProfile = this.buildConnectionProfile(connectionProfileName);
+
+ this.connectionProfileListener = this.buildConnectionProfileListener();
+ this.getConnectionProfileFactory().addConnectionProfileListener(this.connectionProfileListener);
+
+ this.connectionListener = this.buildConnectionListener();
+ if (this.connectionProfile != null) {
+ this.connectionProfile.addConnectionListener(this.connectionListener);
+ }
+ }
+
+ protected ConnectionProfileFactory getConnectionProfileFactory() {
+ return this.getJpaPlatform().getConnectionProfileFactory();
+ }
+
+ protected ConnectionProfileListener buildConnectionProfileListener() {
+ return new LocalConnectionProfileListener();
+ }
+
+ protected ConnectionListener buildConnectionListener() {
+ return new LocalConnectionListener();
+ }
+
+
+ // ********** JpaDataSource implementation **********
+
+ public String getConnectionProfileName() {
+ return this.connectionProfileName;
+ }
+
+ public void setConnectionProfileName(String name) {
+ String old = this.connectionProfileName;
+ this.connectionProfileName = name;
+ if (this.firePropertyChanged(CONNECTION_PROFILE_NAME_PROPERTY, old, name)) {
+ // synch the connection profile when the name changes
+ this.setConnectionProfile(this.buildConnectionProfile(name));
+ JptJpaCorePlugin.setConnectionProfileName(this.getJpaProject().getProject(), name);
+ }
+ }
+
+ public ConnectionProfile getConnectionProfile() {
+ return this.connectionProfile;
+ }
+
+ @Override
+ public boolean connectionProfileIsActive() {
+ ConnectionProfile cp = this.connectionProfile;
+ return (cp != null) && cp.isActive();
+ }
+
+ @Override
+ public Database getDatabase() {
+ ConnectionProfile cp = this.connectionProfile;
+ return (cp == null) ? null : cp.getDatabase();
+ }
+
+ public <T extends DatabaseObject> T selectDatabaseObjectForIdentifier(Iterable<T> databaseObjects, String identifier) {
+ Database db = this.getDatabase();
+ return (db == null) ? null : db.selectDatabaseObjectForIdentifier(databaseObjects, identifier);
+ }
+
+ public void dispose() {
+ if (this.connectionProfile != null) {
+ this.connectionProfile.removeConnectionListener(this.connectionListener);
+ }
+ this.getConnectionProfileFactory().removeConnectionProfileListener(this.connectionProfileListener);
+ }
+
+
+ // ********** internal methods **********
+
+ protected ConnectionProfile buildConnectionProfile(String name) {
+ return this.getConnectionProfileFactory().buildConnectionProfile(name, this.buildDatabaseIdentifierAdapter());
+ }
+
+ protected DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildDatabaseIdentifierAdapter(this) :
+ DatabaseIdentifierAdapter.Default.instance();
+ }
+
+ protected void setConnectionProfile(ConnectionProfile connectionProfile) {
+ ConnectionProfile old = this.connectionProfile;
+ if (old != null) {
+ old.removeConnectionListener(this.connectionListener);
+ }
+ this.connectionProfile = connectionProfile;
+ if (connectionProfile != null) {
+ connectionProfile.addConnectionListener(this.connectionListener);
+ }
+ this.firePropertyChanged(CONNECTION_PROFILE_PROPERTY, old, connectionProfile);
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.connectionProfileName);
+ }
+
+
+ // ********** member classes **********
+
+ /**
+ * Listen for a connection profile with our name being removed.
+ * Also listen for our connection's name being changed.
+ */
+ protected class LocalConnectionProfileListener
+ implements ConnectionProfileListener
+ {
+ protected LocalConnectionProfileListener() {
+ super();
+ }
+
+ public void connectionProfileAdded(String name) {
+ // check to see if a connection profile with our name was added
+ // (assume our connection profile is null)
+ if (GenericJpaDataSource.this.connectionProfile == null) {
+ if (name.equals(GenericJpaDataSource.this.getConnectionProfileName())) {
+ GenericJpaDataSource.this.setConnectionProfileName(name); // this will trigger creation of CP
+ }
+ }
+ }
+
+ public void connectionProfileRemoved(String name) {
+ if (GenericJpaDataSource.this.connectionProfile == null) {
+ return;
+ }
+ if (name.equals(GenericJpaDataSource.this.connectionProfile.getName())) {
+ GenericJpaDataSource.this.setConnectionProfile(null);
+ }
+ }
+
+ public void connectionProfileRenamed(String oldName, String newName) {
+ if (GenericJpaDataSource.this.connectionProfile == null) {
+ if (newName.equals(GenericJpaDataSource.this.connectionProfileName)) {
+ GenericJpaDataSource.this.setConnectionProfileName(newName);
+ }
+ return;
+ }
+ // the connection profile will already have the new name,
+ // we just need to synch the name held by the data source
+ if (newName.equals(GenericJpaDataSource.this.connectionProfile.getName())) {
+ GenericJpaDataSource.this.setConnectionProfileName(newName);
+ }
+ }
+ }
+
+
+ /**
+ * Whenever the connection is opened or closed trigger a project update.
+ */
+ protected class LocalConnectionListener
+ extends ConnectionAdapter
+ {
+ @Override
+ public void opened(ConnectionProfile profile) {
+ GenericJpaDataSource.this.stateChanged();
+ }
+
+ @Override
+ public void closed(ConnectionProfile profile) {
+ GenericJpaDataSource.this.stateChanged();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java
new file mode 100644
index 0000000000..5c44239337
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1;
+
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory;
+
+/**
+ * Generic JPA
+ */
+public class GenericJpaFactory
+ extends AbstractJpaFactory
+{
+ public GenericJpaFactory() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java
new file mode 100644
index 0000000000..ff1204c53c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
+
+/**
+ * The transition between a JPA project and the resource model associated
+ * with a file.
+ * Hold the associated root structure nodes, which are hooks to the
+ * context model.
+ */
+public class GenericJpaFile
+ extends AbstractJpaNode
+ implements JpaFile
+{
+ /**
+ * typically a .java or .xml file.
+ */
+ protected final IFile file;
+
+ /**
+ * cache the content type - if the content type changes, the JPA project
+ * will throw out the JPA file and build a new one
+ */
+ protected final IContentType contentType;
+
+ /**
+ * the resource model corresponding to the file
+ */
+ protected final JptResourceModel resourceModel;
+
+ /**
+ * the root structure (context model) nodes corresponding to the resource
+ * model
+ */
+ protected final Hashtable<Object, JpaStructureNode> rootStructureNodes = new Hashtable<Object, JpaStructureNode>();
+
+
+ // ********** construction **********
+
+ public GenericJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel) {
+ super(jpaProject);
+ this.file = file;
+ this.contentType = contentType;
+ this.resourceModel = resourceModel;
+ }
+
+ /**
+ * Changes to {@link #ROOT_STRUCTURE_NODES_COLLECTION} do not need to trigger a
+ * project update. Only the UI cares about the root structure nodes.
+ * If a project update is allowed to happen, an infinite loop will result
+ * if any Java class is specified in more than one location in the
+ * persistence unit.
+ */
+ @Override
+ protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
+ super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ nonUpdateAspectNames.add(ROOT_STRUCTURE_NODES_COLLECTION);
+ }
+
+
+ // ********** file **********
+
+ public IFile getFile() {
+ return this.file;
+ }
+
+ public IContentType getContentType() {
+ return this.contentType;
+ }
+
+ public JptResourceModel getResourceModel() {
+ return this.resourceModel;
+ }
+
+ public JptResourceModel getResourceModel(IContentType ct) {
+ return this.contentType.isKindOf(ct) ? this.resourceModel : null;
+ }
+
+
+ // ********** root structure nodes **********
+
+ public Iterator<JpaStructureNode> rootStructureNodes() {
+ return this.getRootStructureNodes().iterator();
+ }
+
+ protected Iterable<JpaStructureNode> getRootStructureNodes() {
+ return new LiveCloneIterable<JpaStructureNode>(this.rootStructureNodes.values());
+ }
+
+ public int rootStructureNodesSize() {
+ return this.rootStructureNodes.size();
+ }
+
+ public void addRootStructureNode(Object key, JpaStructureNode rootStructureNode) {
+ JpaStructureNode old = this.rootStructureNodes.put(key, rootStructureNode);
+ if (rootStructureNode != old) {
+ if (old != null) {
+ this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, old);
+ }
+ this.fireItemAdded(ROOT_STRUCTURE_NODES_COLLECTION, rootStructureNode);
+ }
+ }
+
+ public void removeRootStructureNode(Object key, JpaStructureNode rootStructureNode) {
+ if (Tools.valuesAreEqual(rootStructureNode, this.rootStructureNodes.get(key))) {
+ this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, this.rootStructureNodes.remove(key));
+ }
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ for (JpaStructureNode rootNode : this.getRootStructureNodes()) {
+ JpaStructureNode node = rootNode.getStructureNode(textOffset);
+ if (node != null) {
+ return node;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.file);
+ sb.append('[');
+ sb.append(this.contentType.getName());
+ sb.append(']');
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java
new file mode 100644
index 0000000000..2502f19457
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1;
+
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaProject;
+
+/**
+ * Not much different from the abstract JPA project.
+ */
+public class GenericJpaProject
+ extends AbstractJpaProject
+{
+
+ // ********** constructor/initialization **********
+
+ public GenericJpaProject(JpaProject.Config config) {
+ super(config);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java
new file mode 100644
index 0000000000..159df40278
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.IdClassReference;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractEntityPrimaryKeyValidator extends
+ AbstractPrimaryKeyValidator {
+
+ public AbstractEntityPrimaryKeyValidator(Entity entity,
+ PrimaryKeyTextRangeResolver textRangeResolver) {
+ super(entity, textRangeResolver);
+ }
+
+ protected Entity entity() {
+ return (Entity) this.typeMapping();
+ }
+
+ @Override
+ protected IdClassReference idClassReference() {
+ return entity().getIdClassReference();
+ }
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ // if an entity is non-root, it is not allowed to define primary keys
+ if (! entity().isRoot()) {
+ validatePrimaryKeyForNonRoot(messages, reporter);
+ }
+ else {
+ validatePrimaryKeyForRoot(messages, reporter);
+ }
+ return true;
+ }
+
+ protected void validatePrimaryKeyForNonRoot(List<IMessage> messages, IReporter reporter) {
+ validateNonRootEntityDoesNotSpecifyIdClass(messages, reporter);
+ validateNonRootEntityDoesNotSpecifyPrimaryKeyAttributes(messages, reporter);
+ }
+
+ protected void validatePrimaryKeyForRoot(List<IMessage> messages, IReporter reporter) {
+ validatePrimaryKeyIsNotRedefined(messages, reporter);
+ validateIdClassIsUsedIfNecessary(messages, reporter);
+
+ // if the primary key is not defined on an ancestor, it must be defined here
+ if (! definesPrimaryKey(typeMapping())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_NO_PK,
+ EMPTY_STRING_ARRAY,
+ entity(),
+ textRangeResolver().getTypeMappingTextRange()));
+ }
+
+ // if primary key is composite, it may either use an id class or embedded id, not both
+ validateOneOfIdClassOrEmbeddedIdIsUsed(messages, reporter);
+ // ... and only one embedded id
+ validateOneEmbeddedId(messages, reporter);
+
+ validateMapsIdMappings(messages, reporter);
+
+ if (specifiesIdClass()) {
+ validateIdClass(idClassReference().getIdClass(), messages, reporter);
+ }
+ }
+
+ protected void validateNonRootEntityDoesNotSpecifyIdClass(List<IMessage> messages, IReporter reporter) {
+ if (idClassReference().isSpecified()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_NON_ROOT_ID_CLASS_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ entity(),
+ textRangeResolver().getIdClassTextRange()));
+ }
+ }
+
+ protected void validateNonRootEntityDoesNotSpecifyPrimaryKeyAttributes(List<IMessage> messages, IReporter reporter) {
+ for (AttributeMapping each : getPrimaryKeyMappingsDefinedLocally(typeMapping())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ each,
+ textRangeResolver().getAttributeMappingTextRange(each.getName())));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java
new file mode 100644
index 0000000000..58e53d7f21
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public abstract class AbstractJoinTableValidator extends AbstractTableValidator
+{
+ protected AbstractJoinTableValidator(JoinTable table, TableTextRangeResolver textRangeResolver) {
+ super(table, textRangeResolver);
+ }
+
+ protected AbstractJoinTableValidator(PersistentAttribute persistentAttribute, JoinTable table, TableTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, table, textRangeResolver);
+ }
+
+ @Override
+ protected String getUnresolvedCatalogMessage() {
+ return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_CATALOG;
+ }
+
+ @Override
+ protected String getUnresolvedSchemaMessage() {
+ return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA;
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java
new file mode 100644
index 0000000000..37552dc286
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.IdClassReference;
+import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractMappedSuperclassPrimaryKeyValidator
+ extends AbstractPrimaryKeyValidator
+{
+ public AbstractMappedSuperclassPrimaryKeyValidator(
+ MappedSuperclass mappedSuperclass, PrimaryKeyTextRangeResolver textRangeResolver) {
+
+ super(mappedSuperclass, textRangeResolver);
+ }
+
+
+ protected MappedSuperclass mappedSuperclass() {
+ return (MappedSuperclass) this.typeMapping();
+ }
+
+ @Override
+ protected IdClassReference idClassReference() {
+ return mappedSuperclass().getIdClassReference();
+ }
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ validatePrimaryKeyIsNotRedefined(messages, reporter);
+ validateIdClassIsUsedIfNecessary(messages, reporter);
+
+ // if primary key is composite, it may either use an id class or embedded id, not both
+ validateOneOfIdClassOrEmbeddedIdIsUsed(messages, reporter);
+ // ... and only one embedded id
+ validateOneEmbeddedId(messages, reporter);
+
+ if (specifiesIdClass()) {
+ validateIdClass(idClassReference().getIdClass(), messages, reporter);
+ }
+ return true;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java
new file mode 100644
index 0000000000..81080e19ba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractNamedColumnValidator<C extends NamedColumn, R extends NamedColumnTextRangeResolver>
+ implements JptValidator
+{
+ protected final PersistentAttribute persistentAttribute;
+
+ protected final C column;
+
+ protected final R textRangeResolver;
+
+ protected final TableValidator tableValidator;
+
+ protected final TableDescriptionProvider tableDescriptionProvider;
+
+ protected AbstractNamedColumnValidator(
+ C column,
+ R textRangeResolver) {
+ this(null, column, textRangeResolver);
+ }
+
+ protected AbstractNamedColumnValidator(
+ C column,
+ R textRangeResolver,
+ TableDescriptionProvider provider) {
+ this(null, column, textRangeResolver, provider);
+ }
+
+ protected AbstractNamedColumnValidator(
+ PersistentAttribute persistentAttribute,
+ C column,
+ R textRangeResolver) {
+ this(persistentAttribute, column, textRangeResolver, new NullTableDescriptionProvider());
+ }
+
+ protected AbstractNamedColumnValidator(
+ PersistentAttribute persistentAttribute,
+ C column,
+ R textRangeResolver,
+ TableDescriptionProvider provider) {
+ this.persistentAttribute = persistentAttribute;
+ this.column = column;
+ this.textRangeResolver = textRangeResolver;
+ this.tableDescriptionProvider = provider;
+ this.tableValidator = this.buildTableValidator();
+ }
+
+ protected TableValidator buildTableValidator() {
+ return new NullTableValidator();
+ }
+
+ protected boolean isPersistentAttributeVirtual() {
+ return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual();
+ }
+
+ protected String getPersistentAttributeName() {
+ return this.persistentAttribute.getName();
+ }
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ if (this.tableValidator.tableNameIsInvalid()) {
+ return this.tableValidator.validate(messages, reporter);
+ }
+ this.validateName(messages);
+ return true;
+ }
+
+ protected void validateName(List<IMessage> messages) {
+ Table dbTable = this.column.getDbTable();
+ if ((dbTable != null) && ! this.column.isResolved()) {
+ messages.add(this.buildUnresolvedNameMessage());
+ }
+ }
+
+ protected IMessage buildUnresolvedNameMessage() {
+ return this.isPersistentAttributeVirtual() ?
+ this.buildVirtualAttributeUnresolvedNameMessage() :
+ this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage());
+ }
+
+ protected IMessage buildUnresolvedNameMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getUnresolvedNameMessage();
+
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedNameMessage();
+
+
+ // ********** table validator **********
+
+ public interface TableValidator
+ extends JptValidator
+ {
+ boolean tableNameIsInvalid();
+ }
+
+ public static class NullTableValidator
+ implements TableValidator
+ {
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ return true;
+ }
+ public boolean tableNameIsInvalid() {
+ return false;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
new file mode 100644
index 0000000000..b62e5a415f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractPersistentAttributeValidator
+ implements JptValidator
+{
+ protected PersistentAttribute persistentAttribute;
+
+ protected JavaPersistentAttribute javaPersistentAttribute;
+
+ protected PersistentAttributeTextRangeResolver textRangeResolver;
+
+
+ protected AbstractPersistentAttributeValidator(
+ PersistentAttribute persistentAttribute, JavaPersistentAttribute javaPersistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
+ this.persistentAttribute = persistentAttribute;
+ this.javaPersistentAttribute = javaPersistentAttribute;
+ this.textRangeResolver = textRangeResolver;
+ }
+
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ this.validateAttribute(messages);
+ return true;
+ }
+
+ protected abstract void validateAttribute(List<IMessage> messages);
+
+ protected boolean isFieldAttribute() {
+ if (this.javaPersistentAttribute == null) {
+ return false;
+ }
+ return this.javaPersistentAttribute.isField();
+ }
+
+ protected boolean isPropertyAttribute() {
+ if (this.javaPersistentAttribute == null) {
+ return false;
+ }
+ return this.javaPersistentAttribute.isProperty();
+ }
+
+ protected boolean isFinalAttribute() {
+ if (this.javaPersistentAttribute == null) {
+ return false;
+ }
+ return this.javaPersistentAttribute.isFinal();
+ }
+
+ protected boolean isPublicAttribute() {
+ if (this.javaPersistentAttribute == null) {
+ return false;
+ }
+ return this.javaPersistentAttribute.isPublic();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
new file mode 100644
index 0000000000..4c3f9fd870
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
@@ -0,0 +1,618 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.HashBag;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.IdClassReference;
+import org.eclipse.jpt.jpa.core.context.IdMapping;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractPrimaryKeyValidator
+ implements JptValidator
+{
+ private TypeMapping typeMapping;
+
+ private PrimaryKeyTextRangeResolver textRangeResolver;
+
+ public static final String[] EMPTY_STRING_ARRAY = StringTools.EMPTY_STRING_ARRAY;
+
+ protected AbstractPrimaryKeyValidator(
+ TypeMapping typeMapping, PrimaryKeyTextRangeResolver textRangeResolver) {
+
+ this.typeMapping = typeMapping;
+ this.textRangeResolver = textRangeResolver;
+ }
+
+
+ protected TypeMapping typeMapping() {
+ return this.typeMapping;
+ }
+
+ protected abstract IdClassReference idClassReference();
+
+ protected PrimaryKeyTextRangeResolver textRangeResolver() {
+ return this.textRangeResolver;
+ }
+
+ // for JPA portability, a hierarchy must define its primary key on one class
+ // (entity *or* mapped superclass)
+ protected void validatePrimaryKeyIsNotRedefined(List<IMessage> messages, IReporter reporter) {
+ if (definesPrimaryKeyOnAncestor(typeMapping())) {
+ if (idClassReference().isSpecified()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_PK_REDEFINED_ID_CLASS,
+ EMPTY_STRING_ARRAY,
+ typeMapping(),
+ textRangeResolver().getIdClassTextRange()));
+ }
+ for (AttributeMapping each : getPrimaryKeyMappingsDefinedLocally(typeMapping())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE,
+ EMPTY_STRING_ARRAY,
+ each,
+ textRangeResolver().getAttributeMappingTextRange(each.getName())));
+ }
+ return;
+ }
+ }
+
+ // if a primary key defining class has multiple primary keys, it must use an id class
+ protected void validateIdClassIsUsedIfNecessary(List<IMessage> messages, IReporter reporter) {
+ if (! specifiesIdClass() && idClassIsRequired()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_REQUIRED,
+ EMPTY_STRING_ARRAY,
+ typeMapping(),
+ textRangeResolver().getTypeMappingTextRange()));
+ }
+ }
+
+ // only one composite primary key strategy may be used
+ protected void validateOneOfIdClassOrEmbeddedIdIsUsed(List<IMessage> messages, IReporter reporter) {
+ if (idClassReference().isSpecified()
+ && CollectionTools.size(typeMapping().getAllAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)) > 0) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_AND_EMBEDDED_ID_BOTH_USED,
+ EMPTY_STRING_ARRAY,
+ typeMapping(),
+ textRangeResolver().getTypeMappingTextRange()));
+ }
+ }
+
+ // only one embedded id may be used
+ protected void validateOneEmbeddedId(List<IMessage> messages, IReporter reporter) {
+ if (CollectionTools.size(getEmbeddedIdMappings(typeMapping())) > 1) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_MULTIPLE_EMBEDDED_ID,
+ EMPTY_STRING_ARRAY,
+ typeMapping(),
+ textRangeResolver().getTypeMappingTextRange()));
+ }
+ }
+
+ protected void validateMapsIdMappings(List<IMessage> messages, IReporter reporter) {
+ for (SingleRelationshipMapping2_0 mapsIdRelationshipMapping : getMapsIdMappingsDefinedLocally(typeMapping())) {
+ // can't use maps id mappings with an id class
+ if (definesIdClass(typeMapping())) {
+ messages.add(DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_WITH_MAPS_ID,
+ new String[] {mapsIdRelationshipMapping.getName()},
+ mapsIdRelationshipMapping,
+ textRangeResolver().getAttributeMappingTextRange(mapsIdRelationshipMapping.getName())));
+ }
+
+ AttributeMapping resolvedAttributeMapping =
+ mapsIdRelationshipMapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getResolvedAttributeMappingValue();
+ if (resolvedAttributeMapping != null
+ && ! ClassName.areAutoboxEquivalents(
+ resolvedAttributeMapping.getPersistentAttribute().getTypeName(),
+ getTargetEntityPrimaryKeyTypeName(mapsIdRelationshipMapping))) {
+ messages.add(DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_MAPS_ID_ATTRIBUTE_TYPE_DOES_NOT_AGREE,
+ new String[] {mapsIdRelationshipMapping.getName()},
+ mapsIdRelationshipMapping,
+ textRangeResolver().getAttributeMappingTextRange(mapsIdRelationshipMapping.getName())));
+ }
+ }
+ }
+
+ protected void validateIdClass(JavaPersistentType idClass, List<IMessage> messages, IReporter reporter) {
+ // there should already be a validation error if the id class does not resolve to a class
+ if (idClass == null) {
+ return;
+ }
+
+ if (hasDerivedIdMappingMatchingIdClass(idClass)) {
+ validateIdClass_derivedIdMappingMatchingIdClass(idClass, messages, reporter);
+ return;
+ }
+ for (JavaPersistentAttribute idClassAttribute :
+ new SubIterableWrapper<ReadOnlyPersistentAttribute, JavaPersistentAttribute>(
+ CollectionTools.iterable(idClass.allAttributes()))) {
+ boolean foundMatch = false;
+ for (AttributeMapping attributeMapping : getAttributeMappings(typeMapping())) {
+ if (idClassAttribute.getName().equals(attributeMapping.getName())) {
+ foundMatch = true;
+
+ // the matching attribute should be a primary key
+ if (! definesPrimaryKey(attributeMapping)) {
+ messages.add(DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NOT_PRIMARY_KEY,
+ new String[] {idClassAttribute.getName()},
+ typeMapping(),
+ textRangeResolver().getIdClassTextRange()));
+ }
+
+ // the matching attribute's type should agree
+ String idClassAttributeTypeName = idClassAttribute.getTypeName();
+ String attributeMappingTypeName = getTypeNameForIdClass(attributeMapping);
+ if (attributeMappingTypeName != null // if it's null, there should be
+ // another failing validation elsewhere
+ && ! ClassName.areAutoboxEquivalents(idClassAttributeTypeName, attributeMappingTypeName)) {
+ messages.add(DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_TYPE_DOES_NOT_AGREE,
+ new String[] {idClassAttribute.getName(), idClassAttributeTypeName},
+ typeMapping(),
+ textRangeResolver().getIdClassTextRange()));
+ }
+ }
+ }
+
+ if (! foundMatch) {
+ messages.add(DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NO_MATCH,
+ new String[] {idClassAttribute.getName()},
+ typeMapping(),
+ textRangeResolver().getIdClassTextRange()));
+ }
+ }
+ }
+
+ protected void validateIdClass_derivedIdMappingMatchingIdClass(
+ JavaPersistentType idClass, List<IMessage> messages, IReporter reporter) {
+
+ Collection<AttributeMapping> errorMappings = new HashBag<AttributeMapping>();
+ for (AttributeMapping each
+ : new CompositeIterable<AttributeMapping>(getIdMappings(typeMapping()), getEmbeddedIdMappings(typeMapping()))) {
+ errorMappings.add(each);
+ }
+ Collection<AttributeMapping> errorDerivedIdMappings = new HashBag<AttributeMapping>();
+ for (SingleRelationshipMapping2_0 each : getDerivedIdMappings(typeMapping())) {
+ if (idClass.getName().equals(getTargetEntityPrimaryKeyTypeName(each))) {
+ errorDerivedIdMappings.add(each);
+ }
+ else {
+ errorMappings.add(each);
+ }
+ }
+ for (AttributeMapping each : errorMappings) {
+ addNoIdClassAttributeMatchError(each, messages);
+ }
+ if (CollectionTools.size(errorDerivedIdMappings) > 1) {
+ for (AttributeMapping each : errorDerivedIdMappings) {
+ addDuplicateIdClassAttributeMatchError(each, messages);
+ }
+ }
+ }
+
+ protected void addNoIdClassAttributeMatchError(AttributeMapping attributeMapping, List<IMessage> messages) {
+ messages.add(DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_NO_MATCH,
+ new String[] {attributeMapping.getName()},
+ typeMapping(),
+ textRangeResolver().getIdClassTextRange()));
+ }
+
+ protected void addDuplicateIdClassAttributeMatchError(AttributeMapping attributeMapping, List<IMessage> messages) {
+ messages.add(DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_DUPLICATE_MATCH,
+ new String[] {attributeMapping.getName()},
+ typeMapping(),
+ textRangeResolver().getIdClassTextRange()));
+ }
+
+
+ // **************** convenience methods ********************************************************
+
+ // **************** primary key overall ********************************************************
+
+ /**
+ * Return whether an ancestor class has defined any aspect of the primary key
+ */
+ protected boolean definesPrimaryKeyOnAncestor(TypeMapping typeMapping) {
+ for (TypeMapping each : CollectionTools.iterable(typeMapping.inheritanceHierarchy())) {
+ if (each != typeMapping && definesPrimaryKey(each)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return whether the type mapping has defined any aspect of the primary key
+ */
+ protected boolean definesPrimaryKey(TypeMapping typeMapping) {
+ return getIdClass(typeMapping) != null
+ || ! CollectionTools.isEmpty(getPrimaryKeyMappings(typeMapping));
+ }
+
+ /**
+ * Return true if the type mapping has defined any aspect of a complex primary key
+ */
+ protected boolean definesComplexPrimaryKey(TypeMapping typeMapping) {
+ return definesIdClass(typeMapping)
+ || getEmbeddedIdMapping(typeMapping) != null;
+ }
+
+ /**
+ * Return the overriding type name of the primary key for the type mapping.
+ * This may be
+ * - type of the single simple primary key (id) attribute
+ * - type of the single complex primary key (embedded id) attribute
+ * - type of the id class
+ * - null if none of the above are coherent (i.e. there are multiple possibilities, or the
+ * primary key is invalid)
+ */
+ protected String getPrimaryKeyTypeName(TypeMapping typeMapping) {
+ JavaPersistentType idClass = getIdClass(typeMapping);
+ if (idClass != null) {
+ return idClass.getName();
+ }
+ EmbeddedIdMapping embeddedId = getEmbeddedIdMapping(typeMapping);
+ if (embeddedId != null) {
+ return embeddedId.getPersistentAttribute().getTypeName();
+ }
+ IdMapping id = getIdMapping(typeMapping);
+ if (id != null) {
+ return id.getPersistentAttribute().getTypeName();
+ }
+ return null;
+ }
+
+ /**
+ * Return whether the attribute mapping has defined any aspect of the primary key
+ */
+ protected boolean definesPrimaryKey(AttributeMapping attributeMapping) {
+ String mappingKey = attributeMapping.getKey();
+ if (CollectionTools.contains(this.getIdMappingKeys(), mappingKey)) {
+ return true;
+ }
+ if (CollectionTools.contains(this.getSingleRelationshipMappingKeys(), mappingKey)) {
+ SingleRelationshipMapping2_0 relationshipMapping = (SingleRelationshipMapping2_0) attributeMapping;
+ return (relationshipMapping.getDerivedIdentity().usesIdDerivedIdentityStrategy()
+ || relationshipMapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy());
+ }
+ return false;
+ }
+
+ protected Iterable<String> getIdMappingKeys() {
+ return ID_MAPPING_KEYS;
+ }
+
+ protected static final String[] ID_MAPPING_KEYS_ARRAY = new String[] {
+ MappingKeys.ID_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY
+ };
+
+ protected static final Iterable<String> ID_MAPPING_KEYS = new ArrayIterable<String>(ID_MAPPING_KEYS_ARRAY);
+
+ protected Iterable<String> getSingleRelationshipMappingKeys() {
+ return SINGLE_RELATIONSHIP_MAPPING_KEYS;
+ }
+
+ protected static final String[] SINGLE_RELATIONSHIP_MAPPING_KEYS_ARRAY = new String[] {
+ MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY
+ };
+
+ protected static final Iterable<String> SINGLE_RELATIONSHIP_MAPPING_KEYS = new ArrayIterable<String>(SINGLE_RELATIONSHIP_MAPPING_KEYS_ARRAY);
+
+
+ // **************** id class **********************************************
+
+ protected boolean specifiesIdClass() {
+ return idClassReference().isSpecified();
+ }
+
+ /**
+ * Return whether an id class is defined on the class
+ * NOTE: this is different from whether an id class is *specified*. If a specified id class
+ * is not resolved, it is not defined. There will be a validation error to that effect.
+ */
+ protected boolean definesIdClass(TypeMapping typeMapping) {
+ return getIdClass(typeMapping) != null;
+ }
+
+ /**
+ * Return whether an ancestor class has defined an id class
+ */
+ protected boolean definesIdClassOnAncestor(TypeMapping typeMapping) {
+ for (TypeMapping each : CollectionTools.iterable(typeMapping.inheritanceHierarchy())) {
+ if (each != typeMapping && definesIdClass(each)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return the id class to be used for the type mapping, whether that be locally
+ * or on an ancestor
+ */
+ protected JavaPersistentType getIdClass(TypeMapping typeMapping) {
+ for (Iterator<TypeMapping> stream = typeMapping.inheritanceHierarchy(); stream.hasNext(); ) {
+ TypeMapping next = stream.next();
+ if (next.getIdClass() != null) {
+ return next.getIdClass();
+ }
+ }
+ return null;
+ }
+
+
+ // **************** attribute mappings in general *************************
+
+ protected Iterable<AttributeMapping> getAttributeMappings(TypeMapping typeMapping) {
+ return CollectionTools.collection(typeMapping.allAttributeMappings());
+ }
+
+ /**
+ * Return all primary key mappings, defined on and above the type mapping
+ */
+ protected Iterable<AttributeMapping> getPrimaryKeyMappings(TypeMapping typeMapping) {
+ return new CompositeIterable<AttributeMapping>(
+ getIdMappings(typeMapping),
+ getEmbeddedIdMappings(typeMapping),
+ getDerivedIdMappings(typeMapping),
+ getMapsIdMappings(typeMapping));
+ }
+
+ /**
+ * Return primary key mappings declared directly on the type mapping
+ */
+ protected Iterable<AttributeMapping> getPrimaryKeyMappingsDefinedLocally(TypeMapping typeMapping) {
+ return new CompositeIterable<AttributeMapping>(
+ getIdMappingsDefinedLocally(typeMapping),
+ getEmbeddedIdMappingsDefinedLocally(typeMapping),
+ getDerivedIdMappingsDefinedLocally(typeMapping),
+ getMapsIdMappingsDefinedLocally(typeMapping));
+ }
+
+ protected boolean hasAnyPrimaryKeyMappings(TypeMapping typeMapping) {
+ return ! CollectionTools.isEmpty(getPrimaryKeyMappings(typeMapping));
+ }
+
+ // **************** id mappings *******************************************
+
+ protected IdMapping getIdMapping(TypeMapping typeMapping) {
+ Iterable<IdMapping> idMappings = getIdMappings(typeMapping);
+ if (CollectionTools.size(idMappings) == 1) {
+ return idMappings.iterator().next();
+ }
+ return null;
+ }
+
+ protected Iterable<IdMapping> getIdMappings(TypeMapping typeMapping) {
+ return new SubIterableWrapper<AttributeMapping, IdMapping>(
+ typeMapping.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
+ }
+
+ protected Iterable<IdMapping> getIdMappingsDefinedLocally(TypeMapping typeMapping) {
+ return new SubIterableWrapper<AttributeMapping, IdMapping>(
+ typeMapping.getAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
+ }
+
+
+ // **************** embedded id mappings **********************************
+
+ /**
+ * Return whether an embedded id is defined for this class, whether that be locally
+ * or on an ancestor
+ */
+ protected boolean definesEmbeddedIdMapping(TypeMapping typeMapping) {
+ return ! CollectionTools.isEmpty(getEmbeddedIdMappings(typeMapping));
+ }
+
+ protected EmbeddedIdMapping getEmbeddedIdMapping(TypeMapping typeMapping) {
+ Iterable<EmbeddedIdMapping> embeddedIdMappings = getEmbeddedIdMappings(typeMapping);
+ if (CollectionTools.size(embeddedIdMappings) == 1) {
+ return embeddedIdMappings.iterator().next();
+ }
+ return null;
+ }
+
+ protected Iterable<EmbeddedIdMapping> getEmbeddedIdMappings(TypeMapping typeMapping) {
+ return new SubIterableWrapper<AttributeMapping, EmbeddedIdMapping>(
+ typeMapping.getAllAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
+ }
+
+ protected Iterable<EmbeddedIdMapping> getEmbeddedIdMappingsDefinedLocally(TypeMapping typeMapping) {
+ return new SubIterableWrapper<AttributeMapping, EmbeddedIdMapping>(
+ typeMapping.getAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
+ }
+
+
+ // **************** derived id mappings ***********************************
+
+ protected Iterable<SingleRelationshipMapping2_0> getDerivedIdMappings(TypeMapping typeMapping) {
+ return new FilteringIterable<SingleRelationshipMapping2_0>(this.getAllSingleRelationshipMappings(typeMapping)) {
+ @Override
+ protected boolean accept(SingleRelationshipMapping2_0 o) {
+ return o.getDerivedIdentity().usesIdDerivedIdentityStrategy();
+ }
+ };
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getAllSingleRelationshipMappings(TypeMapping typeMapping) {
+ return new SubIterableWrapper<AttributeMapping, SingleRelationshipMapping2_0>(this.getAllSingleRelationshipMappings_(typeMapping));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<AttributeMapping> getAllSingleRelationshipMappings_(TypeMapping typeMapping) {
+ return new CompositeIterable<AttributeMapping>(
+ typeMapping.getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY),
+ typeMapping.getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)
+ );
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getDerivedIdMappingsDefinedLocally(TypeMapping typeMapping) {
+ return new FilteringIterable<SingleRelationshipMapping2_0>(this.getSingleRelationshipMappings(typeMapping)) {
+ @Override
+ protected boolean accept(SingleRelationshipMapping2_0 o) {
+ return o.getDerivedIdentity().usesIdDerivedIdentityStrategy();
+ }
+ };
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getSingleRelationshipMappings(TypeMapping typeMapping) {
+ return new SubIterableWrapper<AttributeMapping, SingleRelationshipMapping2_0>(this.getSingleRelationshipMappings_(typeMapping));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<AttributeMapping> getSingleRelationshipMappings_(TypeMapping typeMapping) {
+ return new CompositeIterable<AttributeMapping>(
+ typeMapping.getAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY),
+ typeMapping.getAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)
+ );
+ }
+
+
+ // **************** maps id mappings **************************************
+
+ protected Iterable<SingleRelationshipMapping2_0> getMapsIdMappings(TypeMapping typeMapping) {
+ return new FilteringIterable<SingleRelationshipMapping2_0>(this.getAllSingleRelationshipMappings(typeMapping)) {
+ @Override
+ protected boolean accept(SingleRelationshipMapping2_0 o) {
+ return o.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy();
+ }
+ };
+ }
+
+ protected Iterable<SingleRelationshipMapping2_0> getMapsIdMappingsDefinedLocally(TypeMapping typeMapping) {
+ return new FilteringIterable<SingleRelationshipMapping2_0>(this.getSingleRelationshipMappings(typeMapping)) {
+ @Override
+ protected boolean accept(SingleRelationshipMapping2_0 o) {
+ return o.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy();
+ }
+ };
+ }
+
+
+ // **************** misc **************************************************
+
+ /**
+ * Return whether an id class is required for this class
+ */
+ protected boolean idClassIsRequired() {
+ // An id class is required if
+ // - there are multiple "simple" primary key mappings
+ // - or there is at least one "complex" primary key mapping
+ // A simple primary key mapping can be
+ // - an id mapping
+ // - a derived id relationship mapping to an entity with a simple primary key
+ // A complex primary key mapping can be
+ // - a derived id relationship mapping to an entity with a complex primary key
+ int simplePrimaryKeyMappingCount =
+ CollectionTools.size(getIdMappings(typeMapping()));
+ if (simplePrimaryKeyMappingCount > 1) {
+ return true;
+ }
+ for (SingleRelationshipMapping2_0 relationshipMapping : getDerivedIdMappings(typeMapping())) {
+ Entity entity = relationshipMapping.getResolvedTargetEntity();
+ if (entity != null) {
+ if (definesComplexPrimaryKey(entity)) {
+ return true;
+ }
+ else {
+ simplePrimaryKeyMappingCount++;
+ }
+ if (simplePrimaryKeyMappingCount > 1) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected boolean hasDerivedIdMappingMatchingIdClass(JavaPersistentType idClass) {
+ for (SingleRelationshipMapping2_0 each : getDerivedIdMappings(typeMapping())) {
+ String primaryKeyTypeName = getTargetEntityPrimaryKeyTypeName(each);
+ if (idClass.getName().equals(primaryKeyTypeName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected String getTargetEntityPrimaryKeyTypeName(SingleRelationshipMapping2_0 relationshipMapping) {
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity != null) {
+ return getPrimaryKeyTypeName(targetEntity);
+ }
+ return null;
+ }
+
+ protected String getTypeNameForIdClass(AttributeMapping attributeMapping) {
+ String mappingKey = attributeMapping.getKey();
+ if (CollectionTools.contains(this.getIdMappingKeys(), mappingKey)) {
+ return attributeMapping.getPersistentAttribute().getTypeName();
+ }
+ if (CollectionTools.contains(this.getSingleRelationshipMappingKeys(), mappingKey)) {
+ SingleRelationshipMapping2_0 relationshipMapping = (SingleRelationshipMapping2_0) attributeMapping;
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity != null) {
+ return getPrimaryKeyTypeName(targetEntity);
+ }
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java
new file mode 100644
index 0000000000..18b0a273bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractTableValidator
+ implements JptValidator
+{
+
+ protected final PersistentAttribute persistentAttribute;
+
+ protected final Table table;
+
+ protected final TableTextRangeResolver textRangeResolver;
+
+ protected AbstractTableValidator(
+ Table table,
+ TableTextRangeResolver textRangeResolver) {
+ this(null, table, textRangeResolver);
+ }
+
+ protected AbstractTableValidator(
+ PersistentAttribute persistentAttribute,
+ Table table,
+ TableTextRangeResolver textRangeResolver) {
+ super();
+ this.persistentAttribute = persistentAttribute;
+ this.table = table;
+ this.textRangeResolver = textRangeResolver;
+ }
+
+ protected Table getTable() {
+ return this.table;
+ }
+
+ protected TableTextRangeResolver getTextRangeResolver() {
+ return this.textRangeResolver;
+ }
+
+ protected boolean isPersistentAttributeVirtual() {
+ return this.persistentAttribute != null && this.persistentAttribute.isVirtual();
+ }
+
+ protected String getPersistentAttributeName() {
+ return this.persistentAttribute.getName();
+ }
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ if (this.validatesAgainstDatabase()) {
+ return this.validateAgainstDatabase(messages);
+ }
+ return false;
+ }
+
+ protected boolean validatesAgainstDatabase() {
+ return this.table.validatesAgainstDatabase();
+ }
+
+ protected boolean validateAgainstDatabase(List<IMessage> messages) {
+ if ( ! this.table.catalogIsResolved()) {
+ messages.add(buildUnresolvedCatalogMessage());
+ return false;
+ }
+
+ if ( ! this.table.schemaIsResolved()) {
+ messages.add(buildUnresolvedSchemaMessage());
+ return false;
+ }
+
+ if ( ! this.table.isResolved()) {
+ if (this.table.getName() != null) { //if name is null, the validation will be handled elsewhere, such as the target entity is not defined
+ messages.add(buildUnresolvedNameMessage());
+ }
+ return false;
+ }
+ return true;
+ }
+
+ protected IMessage buildUnresolvedCatalogMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeUnresolvedCatalogMessage();
+ }
+ return this.buildUnresolvedCatalogMessage(this.getUnresolvedCatalogMessage());
+ }
+
+ protected abstract String getUnresolvedCatalogMessage();
+
+ protected IMessage buildUnresolvedCatalogMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {this.table.getCatalog(), this.table.getName()},
+ this.table,
+ this.textRangeResolver.getCatalogTextRange()
+ );
+ }
+
+ protected IMessage buildVirtualAttributeUnresolvedCatalogMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedCatalogMessage(),
+ new String[] {this.getPersistentAttributeName(), this.table.getCatalog(), this.table.getName()},
+ this.table,
+ this.textRangeResolver.getCatalogTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedCatalogMessage();
+
+ protected IMessage buildUnresolvedSchemaMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeUnresolvedSchemaMessage();
+ }
+ return this.buildUnresolvedSchemaMessage(this.getUnresolvedSchemaMessage());
+ }
+
+ protected abstract String getUnresolvedSchemaMessage();
+
+ protected IMessage buildUnresolvedSchemaMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {this.table.getSchema(), this.table.getName()},
+ this.table,
+ this.textRangeResolver.getSchemaTextRange()
+ );
+ }
+
+ protected IMessage buildVirtualAttributeUnresolvedSchemaMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedSchemaMessage(),
+ new String[] {this.getPersistentAttributeName(), this.table.getSchema(), this.table.getName()},
+ this.table,
+ this.textRangeResolver.getSchemaTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedSchemaMessage();
+
+ protected IMessage buildUnresolvedNameMessage() {
+ if (isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeUnresolvedNameMessage();
+ }
+ return this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage());
+ }
+
+ protected abstract String getUnresolvedNameMessage();
+
+ protected IMessage buildUnresolvedNameMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {this.table.getName()},
+ this.table,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {this.getPersistentAttributeName(), this.table.getName()},
+ this.table,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedNameMessage();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java
new file mode 100644
index 0000000000..88498168b8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class AbstractTypeMappingValidator<T extends TypeMapping>
+ implements JptValidator
+{
+ protected T typeMapping;
+
+ protected JavaResourcePersistentType jrpt;
+
+ protected TypeMappingTextRangeResolver textRangeResolver;
+
+
+ protected AbstractTypeMappingValidator(
+ T typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ this.typeMapping = typeMapping;
+ this.jrpt = jrpt;
+ this.textRangeResolver = textRangeResolver;
+ }
+
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ this.validateType(messages);
+ return true;
+ }
+
+ protected abstract void validateType(List<IMessage> messages);
+
+ protected boolean isMemberType() {
+ if (this.jrpt == null) {
+ return false;
+ }
+ return this.jrpt.isMemberType();
+ }
+
+ protected boolean isStaticType() {
+ if (this.jrpt == null) {
+ return false;
+ }
+ return this.jrpt.isStatic();
+ }
+
+ protected boolean isFinalType() {
+ if (this.jrpt == null) {
+ return false;
+ }
+ return this.jrpt.isFinal();
+ }
+
+ protected boolean hasPrivateNoArgConstructor() {
+ if (this.jrpt == null) {
+ return false;
+ }
+ return this.jrpt.hasPrivateNoArgConstructor();
+ }
+
+ protected boolean hasNoArgConstructor() {
+ if (this.jrpt == null) {
+ return false;
+ }
+ return this.jrpt.hasNoArgConstructor();
+ }
+
+ protected IMessage buildTypeMessage(String msgID) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ new String[] {this.typeMapping.getName()},
+ this.typeMapping,
+ this.textRangeResolver.getTypeMappingTextRange()
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java
new file mode 100644
index 0000000000..1a154b80b6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class AssociationOverrideInverseJoinColumnValidator
+ extends InverseJoinColumnValidator
+{
+ final AssociationOverride override;
+
+ public AssociationOverrideInverseJoinColumnValidator(
+ AssociationOverride override,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, joinColumnOwner, textRangeResolver, provider);
+ this.override = override;
+ }
+
+ public AssociationOverrideInverseJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ AssociationOverride override,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
+ this.override = override;
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new AssociationOverrideInverseJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected IMessage buildUnresolvedNameMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnresolvedNameMessage() :
+ super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {
+ this.override.getName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()},
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ public IMessage buildUnresolvedReferencedColumnNameMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnresolvedReferencedColumnNameMessage() :
+ super.buildUnresolvedReferencedColumnNameMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
+ new String[] {
+ this.override.getName(),
+ this.column.getReferencedColumnName(),
+ this.column.getReferencedColumnDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ this.column.getReferencedColumnName(),
+ this.column.getReferencedColumnDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() :
+ super.buildUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS,
+ new String[] {this.override.getName()},
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() :
+ super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS,
+ new String[] {this.override.getName()},
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS;
+ }
+
+
+ public class AssociationOverrideInverseJoinColumnTableValidator
+ extends InverseJoinColumnTableValidator
+ {
+ protected AssociationOverrideInverseJoinColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ public IMessage buildTableNotValidMessage() {
+ return AssociationOverrideInverseJoinColumnValidator.this.override.isVirtual() ?
+ this.buildVirtualOverrideColumnTableNotValidMessage() :
+ super.buildTableNotValidMessage();
+ }
+
+ protected IMessage buildVirtualOverrideColumnTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualOverrideColumnTableNotValidMessage(),
+ new String[] {
+ AssociationOverrideInverseJoinColumnValidator.this.override.getName(),
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ protected String getVirtualOverrideColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeColumnTableNotValidMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ AssociationOverrideInverseJoinColumnValidator.this.override.getName(),
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
new file mode 100644
index 0000000000..20ee22bc99
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
@@ -0,0 +1,269 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class AssociationOverrideJoinColumnValidator
+ extends JoinColumnValidator
+{
+ final AssociationOverride override;
+
+
+ public AssociationOverrideJoinColumnValidator(
+ AssociationOverride override,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, joinColumnOwner, textRangeResolver, provider);
+ this.override = override;
+ }
+
+ public AssociationOverrideJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ AssociationOverride override,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
+ this.override = override;
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new AssociationOverrideJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected IMessage buildUnresolvedNameMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnresolvedNameMessage() :
+ super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {
+ this.override.getName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ public IMessage buildUnresolvedReferencedColumnNameMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnresolvedReferencedColumnNameMessage() :
+ super.buildUnresolvedReferencedColumnNameMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
+ new String[] {
+ this.override.getName(),
+ this.column.getReferencedColumnName(),
+ this.column.getReferencedColumnDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ this.column.getReferencedColumnName(),
+ this.column.getReferencedColumnDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() :
+ super.buildUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.override.getName()},
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() :
+ super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.override.getName()},
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+
+ public class AssociationOverrideJoinColumnTableValidator
+ extends JoinColumnTableValidator
+ {
+ protected AssociationOverrideJoinColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ public IMessage buildTableNotValidMessage() {
+ return AssociationOverrideJoinColumnValidator.this.override.isVirtual() ?
+ this.buildVirtualOverrideColumnTableNotValidMessage() :
+ super.buildTableNotValidMessage();
+ }
+
+ protected IMessage buildVirtualOverrideColumnTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualOverrideColumnTableNotValidMessage(),
+ new String[] {
+ AssociationOverrideJoinColumnValidator.this.override.getName(),
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ protected String getVirtualOverrideColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeColumnTableNotValidMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ AssociationOverrideJoinColumnValidator.this.override.getName(),
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java
new file mode 100644
index 0000000000..c315e08b8f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class AssociationOverrideJoinTableValidator extends AbstractJoinTableValidator
+{
+ private final AssociationOverride override;
+
+ public AssociationOverrideJoinTableValidator(
+ AssociationOverride override,
+ JoinTable table,
+ TableTextRangeResolver textRangeResolver) {
+ super(table, textRangeResolver);
+ this.override = override;
+ }
+
+ public AssociationOverrideJoinTableValidator(
+ PersistentAttribute persistentAttribute,
+ AssociationOverride override,
+ JoinTable table,
+ TableTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, table, textRangeResolver);
+ this.override = override;
+ }
+
+ @Override
+ protected IMessage buildUnresolvedNameMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualOverrideUnresolvedNameMessage();
+ }
+ return super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME,
+ new String[] {this.override.getName(), this.getTable().getName()},
+ this.getTable(),
+ this.getTextRangeResolver().getNameTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildUnresolvedCatalogMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualOverrideUnresolvedCatalogMessage();
+ }
+ return super.buildUnresolvedCatalogMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedCatalogMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG,
+ new String[] {this.override.getName(), this.getTable().getCatalog()},
+ this.getTable(),
+ this.getTextRangeResolver().getCatalogTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildUnresolvedSchemaMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualOverrideUnresolvedSchemaMessage();
+ }
+ return super.buildUnresolvedSchemaMessage();
+ }
+
+ protected IMessage buildVirtualOverrideUnresolvedSchemaMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA,
+ new String[] {this.override.getName(), this.getTable().getSchema()},
+ this.getTable(),
+ this.getTextRangeResolver().getSchemaTextRange()
+ );
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedCatalogMessage() {
+ throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedSchemaMessage() {
+ throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedCatalogMessage() {
+ throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedSchemaMessage() {
+ throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java
new file mode 100644
index 0000000000..d0d4e0e8ce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class AssociationOverrideValidator
+ extends OverrideValidator
+{
+ public AssociationOverrideValidator(
+ AssociationOverride override,
+ AssociationOverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ super(override, container, textRangeResolver, overrideDescriptionProvider);
+ }
+
+ public AssociationOverrideValidator(
+ PersistentAttribute persistentAttribute,
+ AssociationOverride override,
+ AssociationOverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider);
+ }
+
+ @Override
+ protected String getVirtualOverrideUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.ASSOCIATION_OVERRIDE_INVALID_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
new file mode 100644
index 0000000000..9d4b58d081
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class AttributeOverrideColumnValidator
+ extends NamedColumnValidator
+{
+ final AttributeOverride override;
+
+ public AttributeOverrideColumnValidator(
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider message) {
+ super(column, textRangeResolver, message);
+ this.override = override;
+ }
+
+ public AttributeOverrideColumnValidator(
+ PersistentAttribute persistentAttribute,
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider message) {
+ super(persistentAttribute, column, textRangeResolver, message);
+ this.override = override;
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new AttributeOverrideColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected IMessage buildUnresolvedNameMessage() {
+ return this.override.isVirtual() ?
+ this.buildVirtualColumnUnresolvedNameMessage() :
+ super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualColumnUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualOverrideUnresolvedNameMessage(),
+ new String[] {
+ this.override.getName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected String getVirtualOverrideUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+
+ public class AttributeOverrideColumnTableValidator
+ extends BaseColumnTableValidator
+ {
+ protected AttributeOverrideColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ public IMessage buildTableNotValidMessage() {
+ return AttributeOverrideColumnValidator.this.override.isVirtual() ?
+ this.buildVirtualOverrideColumnTableNotValidMessage() :
+ super.buildTableNotValidMessage();
+ }
+
+ protected IMessage buildVirtualOverrideColumnTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualOverrideColumnTableNotValidMessage(),
+ new String[] {
+ AttributeOverrideColumnValidator.this.override.getName(),
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ protected String getVirtualOverrideColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected IMessage buildVirtualAttributeTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeColumnTableNotValidMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ AttributeOverrideColumnValidator.this.override.getName(),
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java
new file mode 100644
index 0000000000..4cc07bea91
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class AttributeOverrideValidator
+ extends OverrideValidator
+{
+ public AttributeOverrideValidator(
+ AttributeOverride override,
+ AttributeOverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ super(override, container, textRangeResolver, overrideDescriptionProvider);
+ }
+
+ public AttributeOverrideValidator(
+ PersistentAttribute persistentAttribute,
+ AttributeOverride override,
+ AttributeOverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider);
+ }
+
+ @Override
+ protected String getVirtualOverrideUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.ATTRIBUTE_OVERRIDE_INVALID_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java
new file mode 100644
index 0000000000..e05ac5aa80
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator.TableValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class BaseColumnTableValidator
+ implements TableValidator
+{
+ protected final PersistentAttribute persistentAttribute;
+
+ protected final BaseColumn column;
+
+ protected final BaseColumnTextRangeResolver textRangeResolver;
+
+ protected final TableDescriptionProvider tableDescriptionProvider;
+
+
+ protected BaseColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider tableDescriptionProvider) {
+ super();
+ this.persistentAttribute = persistentAttribute;
+ this.column = column;
+ this.textRangeResolver = textRangeResolver;
+ this.tableDescriptionProvider = tableDescriptionProvider;
+ }
+
+ protected boolean isPersistentAttributeVirtual() {
+ return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual();
+ }
+
+ protected String getPersistentAttributeName() {
+ return this.persistentAttribute.getName();
+ }
+
+ public boolean tableNameIsInvalid() {
+ return this.column.tableNameIsInvalid();
+ }
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ messages.add(this.buildTableNotValidMessage());
+ return false;
+ }
+
+ public IMessage buildTableNotValidMessage() {
+ if (this.isPersistentAttributeVirtual()) {
+ return this.buildVirtualAttributeTableNotValidMessage();
+ }
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getColumnTableNotValidMessage(),
+ new String[] {
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.COLUMN_TABLE_NOT_VALID;
+ }
+
+ protected String getColumnTableDescriptionMessage() {
+ return this.tableDescriptionProvider.getColumnTableDescriptionMessage();
+ }
+
+ protected IMessage buildVirtualAttributeTableNotValidMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeColumnTableNotValidMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.column.getTable(),
+ this.column.getName(),
+ this.getColumnTableDescriptionMessage()
+ },
+ this.column,
+ this.textRangeResolver.getTableTextRange()
+ );
+ }
+
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID;
+ }
+
+ public static interface TableDescriptionProvider {
+ String getColumnTableDescriptionMessage();
+ }
+
+ public static class NullTableDescriptionProvider implements TableDescriptionProvider {
+ public String getColumnTableDescriptionMessage() {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java
new file mode 100644
index 0000000000..8867a28110
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public abstract class BaseJoinColumnValidator<C extends BaseJoinColumn, R extends BaseJoinColumnTextRangeResolver>
+ extends AbstractNamedColumnValidator<C, R>
+{
+ private final BaseJoinColumn.Owner joinColumnOwner;
+
+ protected BaseJoinColumnValidator(
+ C column,
+ BaseJoinColumn.Owner joinColumnOwner,
+ R textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, textRangeResolver, provider);
+ this.joinColumnOwner = joinColumnOwner;
+ }
+
+ protected BaseJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ C column,
+ BaseJoinColumn.Owner joinColumnOwner,
+ R textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ this.joinColumnOwner = joinColumnOwner;
+ }
+
+ @Override
+ //this method will only be called if the table validates correctly
+ protected void validateName(List<IMessage> messages) {
+ this.validateJoinColumnName(messages);
+ this.validateReferencedColumnName(messages);
+ }
+
+ protected void validateJoinColumnName(List<IMessage> messages) {
+ if ((this.column.getSpecifiedName() == null) && (this.joinColumnOwner.joinColumnsSize() > 1)) {
+ messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage());
+ }
+ else if (this.column.getName() != null){
+ super.validateName(messages);
+ }
+ //If the name is null and there is only one join-column, one of these validation messages will apply
+ // 1. target entity does not have a primary key
+ // 2. target entity is not specified
+ // 3. target entity is not an entity
+ }
+
+ protected void validateReferencedColumnName(List<IMessage> messages) {
+ if ((this.column.getSpecifiedReferencedColumnName() == null) && (this.joinColumnOwner.joinColumnsSize() > 1)) {
+ messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage());
+ }
+ //bug 315292 is the reason we are only validating if there is a specified referenced column name
+ else if (this.column.getSpecifiedReferencedColumnName() != null) {
+ if ((this.column.getReferencedColumnDbTable() != null) && ! this.column.referencedColumnIsResolved()) {
+ messages.add(this.buildUnresolvedReferencedColumnNameMessage());
+ }
+ }
+ //If the referenced column name is null and there is only one join-column, one of these validation messages will apply
+ // 1. target entity does not have a primary key
+ // 2. target entity is not specified
+ // 3. target entity is not an entity
+ }
+
+ protected IMessage buildUnresolvedReferencedColumnNameMessage() {
+ return this.isPersistentAttributeVirtual() ?
+ this.buildVirtualAttributeUnresolvedReferencedColumnNameMessage() :
+ this.buildUnresolvedReferencedColumnNameMessage(this.getUnresolvedReferencedColumnNameMessage());
+ }
+
+ protected abstract String getUnresolvedReferencedColumnNameMessage();
+
+ protected IMessage buildUnresolvedReferencedColumnNameMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {
+ this.column.getReferencedColumnName(),
+ this.column.getReferencedColumnDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.column.getReferencedColumnName(),
+ this.column.getReferencedColumnDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedReferencedColumnNameMessage();
+
+ protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ return this.isPersistentAttributeVirtual() ?
+ this.buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() :
+ this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getUnspecifiedNameMultipleJoinColumnsMessage());
+ }
+
+ protected abstract String getUnspecifiedNameMultipleJoinColumnsMessage();
+
+ protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ StringTools.EMPTY_STRING_ARRAY,
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(),
+ new String[] {this.getPersistentAttributeName()},
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage();
+
+ protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return this.isPersistentAttributeVirtual() ?
+ this.buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() :
+ this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(this.getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage());
+ }
+
+ protected abstract String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+
+ protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ StringTools.EMPTY_STRING_ARRAY,
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(),
+ new String[] {this.getPersistentAttributeName()},
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
new file mode 100644
index 0000000000..3a771f49a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
@@ -0,0 +1,12 @@
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class CollectionTableTableDescriptionProvider implements TableDescriptionProvider
+{
+ public String getColumnTableDescriptionMessage() {
+ return JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java
new file mode 100644
index 0000000000..28b4c7c6f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class DiscriminatorColumnValidator
+ extends AbstractNamedColumnValidator<NamedColumn, NamedColumnTextRangeResolver>
+{
+ public DiscriminatorColumnValidator(
+ NamedColumn namedColumn,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ super(namedColumn, textRangeResolver);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java
new file mode 100644
index 0000000000..615e1c2ed0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class EmbeddableOverrideDescriptionProvider implements OverrideDescriptionProvider
+{
+ public String getOverrideDescriptionMessage() {
+ return JpaValidationDescriptionMessages.ON_EMBEDDABLE;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java
new file mode 100644
index 0000000000..a0d355339e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+
+public class EntityPrimaryKeyJoinColumnValidator
+ extends PrimaryKeyJoinColumnValidator
+{
+ public EntityPrimaryKeyJoinColumnValidator(
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(column, owner, textRangeResolver);
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java
new file mode 100644
index 0000000000..9b77915c89
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java
@@ -0,0 +1,12 @@
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class EntityTableDescriptionProvider implements TableDescriptionProvider
+{
+ public String getColumnTableDescriptionMessage() {
+ return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java
new file mode 100644
index 0000000000..8ce6e54411
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+
+public class GenericEntityPrimaryKeyValidator
+ extends AbstractEntityPrimaryKeyValidator
+{
+ public GenericEntityPrimaryKeyValidator(Entity entity, PrimaryKeyTextRangeResolver textRangeResolver) {
+ super(entity, textRangeResolver);
+ }
+
+ @Override
+ protected boolean idClassIsRequired() {
+ //Short circuit check for idClassIsRequired if any part of the primary key is defined
+ //in a superclass for Generic types. Other validation will exist and needs to be
+ //addressed first
+ if(definesPrimaryKeyOnAncestor(typeMapping())){
+ return false;
+ }
+ return super.idClassIsRequired();
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java
new file mode 100644
index 0000000000..b500925d93
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
+import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
+
+public class GenericMappedSuperclassPrimaryKeyValidator extends
+ AbstractMappedSuperclassPrimaryKeyValidator {
+
+ public GenericMappedSuperclassPrimaryKeyValidator(MappedSuperclass mappedSuperclass, PrimaryKeyTextRangeResolver textRangeResolver) {
+ super(mappedSuperclass, textRangeResolver);
+ }
+
+ @Override
+ protected boolean idClassIsRequired() {
+ //Short circuit check for idClassIsRequired if any part of the primary key is defined
+ //in a superclass for Generic types. Other validation will exist and needs to be
+ //addressed first
+ if(definesPrimaryKeyOnAncestor(typeMapping())){
+ return false;
+ }
+ return super.idClassIsRequired();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java
new file mode 100644
index 0000000000..8cee29d41a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class GenericPersistentAttributeValidator
+ extends AbstractPersistentAttributeValidator
+{
+ public GenericPersistentAttributeValidator(
+ PersistentAttribute persistentAttribute, JavaPersistentAttribute javaPersistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver)
+ {
+ super(persistentAttribute, javaPersistentAttribute, textRangeResolver);
+ }
+
+ @Override
+ protected void validateAttribute(List<IMessage> messages) {
+ if (this.persistentAttribute.getMappingKey() == MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
+ return;
+ }
+
+ if (this.isFieldAttribute()) {
+ if (this.isFinalAttribute()) {
+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD));
+ }
+ if (this.isPublicAttribute()) {
+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD));
+ }
+ }
+ else if (this.isPropertyAttribute()) {
+ //TODO need to check both the getter and the setter
+ if (this.isFinalAttribute()) {
+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER));
+ }
+ }
+ }
+
+ protected IMessage buildAttributeMessage(String msgID) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ new String[] {this.persistentAttribute.getName()},
+ this.persistentAttribute,
+ this.textRangeResolver.getAttributeTextRange()
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
new file mode 100644
index 0000000000..cee97f3904
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
@@ -0,0 +1,294 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.HashBag;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * the context model root
+ */
+public class GenericRootContextNode
+ extends AbstractJpaContextNode
+ implements JpaRootContextNode2_0
+{
+ /* This object has no parent, so it must point to the JPA project explicitly. */
+ protected final JpaProject jpaProject;
+
+ /* Main context object. */
+ protected PersistenceXml persistenceXml;
+
+
+ public GenericRootContextNode(JpaProject jpaProject) {
+ super(null); // the JPA project is not really a "parent"...
+
+ if (jpaProject == null) {
+ throw new NullPointerException();
+ }
+ this.jpaProject = jpaProject;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncPersistenceXml();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updatePersistenceXml();
+ }
+
+
+ // ********** persistence.xml **********
+
+ public PersistenceXml getPersistenceXml() {
+ return this.persistenceXml;
+ }
+
+ protected void setPersistenceXml(PersistenceXml persistenceXml) {
+ PersistenceXml old = this.persistenceXml;
+ this.persistenceXml = persistenceXml;
+ this.firePropertyChanged(PERSISTENCE_XML_PROPERTY, old, persistenceXml);
+ }
+
+ protected void syncPersistenceXml() {
+ if (this.persistenceXml != null) {
+ this.persistenceXml.synchronizeWithResourceModel();
+ }
+ }
+
+ /**
+ * Check whether the XML resource has either appeared or disappeared.
+ * If it is still present, it will be the same instance.
+ */
+ protected void updatePersistenceXml() {
+ JpaXmlResource xmlResource = this.resolvePersistenceXmlResource();
+ if (xmlResource == null) {
+ if (this.persistenceXml != null) {
+ this.persistenceXml.dispose();
+ this.setPersistenceXml(null);
+ }
+ } else {
+ if (this.persistenceXml == null) {
+ this.setPersistenceXml(this.buildPersistenceXml(xmlResource));
+ } else {
+ this.persistenceXml.update();
+ }
+ }
+ }
+
+ protected JpaXmlResource resolvePersistenceXmlResource() {
+ JpaXmlResource xmlResource = this.jpaProject.getPersistenceXmlResource();
+ if (xmlResource == null) {
+ return null;
+ }
+ if (xmlResource.isReverting()) {
+ // 308254 - this can happen when persistence.xml is closed without saving;
+ // the model is completely whacked in another thread - so wipe our model(?)
+ return null;
+ }
+ JptResourceType resourceType = xmlResource.getResourceType();
+ if (resourceType == null) {
+ return null;
+ }
+ if ( ! this.getJpaPlatform().supportsResourceType(resourceType)) {
+ return null;
+ }
+ return xmlResource;
+ }
+
+ protected PersistenceXml buildPersistenceXml(JpaXmlResource xmlResource) {
+ return this.getJpaFactory().buildPersistenceXml(this, xmlResource);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected boolean requiresParent() {
+ return false;
+ }
+
+ @Override
+ public void stateChanged() {
+ super.stateChanged();
+ // forward to JPA project
+ this.jpaProject.stateChanged();
+ }
+
+ @Override
+ public JpaProject getJpaProject() {
+ return this.jpaProject;
+ }
+
+ @Override
+ public IResource getResource() {
+ return this.getProject();
+ }
+
+ protected IProject getProject() {
+ return this.jpaProject.getProject();
+ }
+
+ @Override
+ public PersistenceUnit getPersistenceUnit() {
+ return null;
+ }
+
+ @Override
+ public MappingFileRoot getMappingFileRoot() {
+ return null;
+ }
+
+
+ // ********** metamodel **********
+
+ public void initializeMetamodel() {
+ if (this.persistenceXml != null) {
+ ((PersistenceXml2_0) this.persistenceXml).initializeMetamodel();
+ }
+ }
+
+ public void synchronizeMetamodel() {
+ if (this.persistenceXml != null) {
+ ((PersistenceXml2_0) this.persistenceXml).synchronizeMetamodel();
+ }
+ }
+
+ public void disposeMetamodel() {
+ if (this.persistenceXml != null) {
+ ((PersistenceXml2_0) this.persistenceXml).disposeMetamodel();
+ }
+ }
+
+
+ // ********** validation **********
+
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ if (reporter.isCancelled()) {
+ throw new ValidationCancelledException();
+ }
+
+ if (this.persistenceXml == null) {
+ messages.add(buildPersistenceXmlValidationMessage());
+ return;
+ }
+ if ( ! this.jpaProject.discoversAnnotatedClasses()) {
+ this.validateOrphanClasses(messages);
+ }
+ this.persistenceXml.validate(messages, reporter);
+ }
+
+ protected IMessage buildPersistenceXmlValidationMessage() {
+ int severity = IMessage.HIGH_SEVERITY;
+ IFile file = getPlatformFile();
+ if (file != null && file.exists()) {
+ JpaXmlResource xmlResource = this.jpaProject.getPersistenceXmlResource();
+ if (xmlResource != null
+ && ! getJpaPlatform().supportsResourceType(xmlResource.getResourceType())) {
+ return DefaultJpaValidationMessages.buildMessage(
+ severity,
+ JpaValidationMessages.PERSISTENCE_XML_UNSUPPORTED_CONTENT,
+ file);
+ }
+ return DefaultJpaValidationMessages.buildMessage(
+ severity,
+ JpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT,
+ file);
+ }
+ return DefaultJpaValidationMessages.buildMessage(
+ severity,
+ JpaValidationMessages.PROJECT_NO_PERSISTENCE_XML,
+ this);
+ }
+
+ protected IFile getPlatformFile() {
+ return this.jpaProject.getPlatformFile(JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
+ }
+
+ protected void validateOrphanClasses(List<IMessage> messages) {
+ Persistence persistence = this.persistenceXml.getPersistence();
+ if (persistence == null) {
+ return; // handled with other validation
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return; // the context model currently only supports 1 persistence unit
+ }
+
+ PersistenceUnit persistenceUnit = persistence.persistenceUnits().next();
+ HashBag<String> annotatedClassNames = CollectionTools.bag(this.jpaProject.annotatedJavaSourceClassNames());
+ HashBag<String> orphans = annotatedClassNames.clone();
+ for (String annotatedClassName : annotatedClassNames) {
+ if (persistenceUnit.specifiesPersistentType(annotatedClassName)) {
+ orphans.remove(annotatedClassName);
+ }
+ }
+
+ // TODO remove 'jrcu'
+ // replace jrcu.getFile() with jrpt.getFile()
+ // replace jrpt.getMappingAnnotation().getTextRange(jrcu.buildASTRoot())
+ // with jrpt.getMappingAnnotation().getTextRange()
+ // (new method #getTextRange() ?)
+ for (String orphan : orphans) {
+ JavaResourcePersistentType jrpt = this.jpaProject.getJavaResourcePersistentType(orphan);
+ JavaResourceCompilationUnit jrcu = jrpt.getJavaResourceCompilationUnit();
+ if (jrpt.isMapped()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
+ new String[] {jrpt.getQualifiedName()},
+ jrpt.getFile(),
+ jrpt.getNameTextRange(jrcu.buildASTRoot())
+ )
+ );
+ }
+ else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
+ new String[] {jrpt.getName()},
+ jrpt.getFile(),
+ jrpt.getNameTextRange(jrcu.buildASTRoot())
+ )
+ );
+ }
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java
new file mode 100644
index 0000000000..6a2ab46d5d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class GenericTypeMappingValidator
+ extends AbstractTypeMappingValidator<TypeMapping>
+{
+ public GenericTypeMappingValidator(TypeMapping typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ super(typeMapping, jrpt, textRangeResolver);
+ }
+
+ @Override
+ protected void validateType(List<IMessage> messages) {
+ if (this.isFinalType()) {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_FINAL_CLASS));
+ }
+ if (this.isMemberType()) {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_MEMBER_CLASS));
+ }
+ if (this.hasNoArgConstructor()) {
+ if (this.hasPrivateNoArgConstructor()) {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR));
+ }
+ }
+ else {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java
new file mode 100644
index 0000000000..bad52f726d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class InverseJoinColumnValidator
+ extends BaseJoinColumnValidator<JoinColumn, JoinColumnTextRangeResolver>
+{
+ public InverseJoinColumnValidator(
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ public InverseJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new InverseJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ public static class InverseJoinColumnTableValidator
+ extends BaseColumnTableValidator
+ {
+ public InverseJoinColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java
new file mode 100644
index 0000000000..9fa255dafb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class JoinColumnValidator
+ extends BaseJoinColumnValidator<JoinColumn, JoinColumnTextRangeResolver>
+{
+ public JoinColumnValidator(
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ public JoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumn.Owner joinColumnOwner,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new JoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ public static class JoinColumnTableValidator
+ extends BaseColumnTableValidator
+ {
+ public JoinColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ JoinColumn column,
+ JoinColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
new file mode 100644
index 0000000000..d2b27a49f7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
@@ -0,0 +1,12 @@
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class JoinTableTableDescriptionProvider implements TableDescriptionProvider
+{
+ public String getColumnTableDescriptionMessage() {
+ return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java
new file mode 100644
index 0000000000..352204fe2a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class JoinTableValidator extends AbstractJoinTableValidator
+{
+ public JoinTableValidator(JoinTable table, TableTextRangeResolver textRangeResolver) {
+ super(table, textRangeResolver);
+ }
+
+ public JoinTableValidator(PersistentAttribute persistentAttribute, JoinTable table, TableTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, table, textRangeResolver);
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedCatalogMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedSchemaMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
new file mode 100644
index 0000000000..34ddf7ba46
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class MapKeyAttributeOverrideColumnValidator
+ extends AttributeOverrideColumnValidator
+{
+ public MapKeyAttributeOverrideColumnValidator(
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(override, column, textRangeResolver, provider);
+ }
+
+ public MapKeyAttributeOverrideColumnValidator(
+ PersistentAttribute persistentAttribute,
+ AttributeOverride override,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, override, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new MapKeyAttributeOverrideColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getVirtualOverrideUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME;
+ }
+
+
+ public class MapKeyAttributeOverrideColumnTableValidator
+ extends AttributeOverrideColumnTableValidator
+ {
+ protected MapKeyAttributeOverrideColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getVirtualOverrideColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java
new file mode 100644
index 0000000000..9f6b16d93e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class MapKeyAttributeOverrideValidator
+ extends AttributeOverrideValidator
+{
+ public MapKeyAttributeOverrideValidator(
+ AttributeOverride override,
+ AttributeOverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ super(override, container, textRangeResolver, overrideDescriptionProvider);
+ }
+
+ public MapKeyAttributeOverrideValidator(
+ PersistentAttribute persistentAttribute,
+ AttributeOverride override,
+ AttributeOverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider);
+ }
+
+ @Override
+ protected String getVirtualOverrideUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java
new file mode 100644
index 0000000000..ce044fed43
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class MapKeyColumnValidator
+ extends AbstractNamedColumnValidator<BaseColumn, BaseColumnTextRangeResolver>
+{
+
+ public MapKeyColumnValidator(
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, textRangeResolver, provider);
+ }
+
+ public MapKeyColumnValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new MapKeyColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME;
+ }
+
+ public static class MapKeyColumnTableValidator
+ extends BaseColumnTableValidator
+ {
+ protected MapKeyColumnTableValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected String getColumnTableNotValidMessage() {
+ return JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID;
+ }
+
+ @Override
+ protected String getVirtualAttributeColumnTableNotValidMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java
new file mode 100644
index 0000000000..71a7dc083e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+
+public class MappedSuperclassOverrideDescriptionProvider implements OverrideDescriptionProvider
+{
+ public String getOverrideDescriptionMessage() {
+ return JpaValidationDescriptionMessages.ON_MAPPED_SUPERCLASS;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java
new file mode 100644
index 0000000000..76a6fd5513
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class NamedColumnValidator
+ extends AbstractNamedColumnValidator<BaseColumn, BaseColumnTextRangeResolver>
+{
+
+ public NamedColumnValidator(
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(column, textRangeResolver, provider);
+ }
+
+ public NamedColumnValidator(
+ PersistentAttribute persistentAttribute,
+ BaseColumn column,
+ BaseColumnTextRangeResolver textRangeResolver,
+ TableDescriptionProvider provider) {
+ super(persistentAttribute, column, textRangeResolver, provider);
+ }
+
+ @Override
+ protected TableValidator buildTableValidator() {
+ return new BaseColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java
new file mode 100644
index 0000000000..579b90c317
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class OneToOnePrimaryKeyJoinColumnValidator
+ extends PrimaryKeyJoinColumnValidator
+{
+ public OneToOnePrimaryKeyJoinColumnValidator(
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(column, owner, textRangeResolver);
+ }
+
+ public OneToOnePrimaryKeyJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, column, owner, textRangeResolver);
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java
new file mode 100644
index 0000000000..5e78c6a6ba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public abstract class OverrideValidator
+ implements JptValidator
+{
+ protected final PersistentAttribute persistentAttribute;
+
+ protected final Override_ override;
+
+ protected final OverrideContainer container;
+
+ protected final OverrideTextRangeResolver textRangeResolver;
+
+ protected final OverrideDescriptionProvider overrideDescriptionProvider;
+
+ protected OverrideValidator(
+ Override_ override,
+ OverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ this(null, override, container, textRangeResolver, overrideDescriptionProvider);
+ }
+
+
+ protected OverrideValidator(
+ PersistentAttribute persistentAttribute,
+ Override_ override,
+ OverrideContainer container,
+ OverrideTextRangeResolver textRangeResolver,
+ OverrideDescriptionProvider overrideDescriptionProvider) {
+ this.persistentAttribute = persistentAttribute;
+ this.override = override;
+ this.container = container;
+ this.textRangeResolver = textRangeResolver;
+ this.overrideDescriptionProvider = overrideDescriptionProvider;
+ }
+
+ protected boolean persistentAttributeIsVirtual() {
+ return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual();
+ }
+
+ protected String getPersistentAttributeName() {
+ return this.persistentAttribute.getName();
+ }
+
+ protected String getOverrideDescriptionMessage() {
+ return this.overrideDescriptionProvider.getOverrideDescriptionMessage();
+ }
+
+ public boolean validate(List<IMessage> messages, IReporter reporter) {
+ return this.validateName(messages);
+ }
+
+ protected boolean validateName(List<IMessage> messages) {
+ if ( ! CollectionTools.contains(this.container.allOverridableNames(), this.override.getName())) {
+ messages.add(this.buildUnresolvedNameMessage());
+ return false;
+ }
+ return true;
+ }
+
+ protected IMessage buildUnresolvedNameMessage() {
+ if (this.override.isVirtual()) {
+ return this.buildVirtualUnresolvedNameMessage();
+ }
+ if (this.persistentAttributeIsVirtual()) {
+ return this.buildVirtualAttributeUnresolvedNameMessage();
+ }
+ return this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage());
+ }
+
+ protected IMessage buildVirtualUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualOverrideUnresolvedNameMessage(),
+ new String[] {
+ this.override.getName(),
+ this.getOverrideDescriptionMessage(),
+ this.container.getOverridableTypeMapping().getName()
+ },
+ this.override,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualOverrideUnresolvedNameMessage();
+
+ protected IMessage buildUnresolvedNameMessage(String message) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ message,
+ new String[] {
+ this.override.getName(),
+ this.getOverrideDescriptionMessage(),
+ this.container.getOverridableTypeMapping().getName()
+ },
+ this.override,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getUnresolvedNameMessage();
+
+ protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ this.getVirtualAttributeUnresolvedNameMessage(),
+ new String[] {
+ this.getPersistentAttributeName(),
+ this.override.getName(),
+ this.getOverrideDescriptionMessage(),
+ this.container.getOverridableTypeMapping().getName()
+ },
+ this.override,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ protected abstract String getVirtualAttributeUnresolvedNameMessage();
+
+ public interface OverrideDescriptionProvider {
+ String getOverrideDescriptionMessage();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
new file mode 100644
index 0000000000..6317b29b16
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public abstract class PrimaryKeyJoinColumnValidator
+ extends BaseJoinColumnValidator<BaseJoinColumn, BaseJoinColumnTextRangeResolver>
+{
+ protected PrimaryKeyJoinColumnValidator(
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(column, owner, textRangeResolver, new NullTableDescriptionProvider());
+ }
+
+ protected PrimaryKeyJoinColumnValidator(
+ PersistentAttribute persistentAttribute,
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, column, owner, textRangeResolver, new NullTableDescriptionProvider());
+ }
+
+ @Override
+ public IMessage buildUnresolvedNameMessage() {
+ return this.column.isVirtual() ?
+ this.buildUnresolvedNameMessage(this.getVirtualPKJoinColumnUnresolvedNameMessage()) :
+ super.buildUnresolvedNameMessage();
+ }
+
+ protected String getVirtualPKJoinColumnUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected IMessage buildUnresolvedReferencedColumnNameMessage() {
+ return this.column.isVirtual() ?
+ this.buildUnresolvedReferencedColumnNameMessage(this.getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage()) :
+ super.buildUnresolvedReferencedColumnNameMessage();
+ }
+
+ protected String getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ return this.column.isVirtual() ?
+ this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getVirtualPKJoinColumnUnspecifiedNameMultipleJoinColumnsMessage()) :
+ super.buildUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+
+ protected String getVirtualPKJoinColumnUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return this.column.isVirtual() ?
+ this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getVirtualPKJoinColumnUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage()) :
+ super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+
+ protected String getVirtualPKJoinColumnUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getUnresolvedReferencedColumnNameMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
+ }
+
+ @Override
+ protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+
+ @Override
+ protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java
new file mode 100644
index 0000000000..abe27fb5d8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
+
+public class RelationshipStrategyTableDescriptionProvider
+ implements TableDescriptionProvider
+{
+ private final RelationshipStrategy relationshipStrategy;
+
+ public RelationshipStrategyTableDescriptionProvider(RelationshipStrategy relationshipStrategy) {
+ super();
+ this.relationshipStrategy = relationshipStrategy;
+ }
+
+ public String getColumnTableDescriptionMessage() {
+ return this.relationshipStrategy.getColumnTableNotValidDescription();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
new file mode 100644
index 0000000000..15823d3b42
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.SecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class SecondaryTablePrimaryKeyJoinColumnValidator
+ extends PrimaryKeyJoinColumnValidator
+{
+ private final SecondaryTable secondaryTable;
+
+ public SecondaryTablePrimaryKeyJoinColumnValidator(
+ SecondaryTable secondaryTable,
+ BaseJoinColumn column,
+ BaseJoinColumn.Owner owner,
+ BaseJoinColumnTextRangeResolver textRangeResolver) {
+ super(column, owner, textRangeResolver);
+ this.secondaryTable = secondaryTable;
+ }
+
+ protected boolean isSecondaryTableVirtual() {
+ return this.secondaryTable.isVirtual();
+ }
+
+ protected String getSecondaryTableName() {
+ return this.secondaryTable.getName();
+ }
+
+ @Override
+ public IMessage buildUnresolvedNameMessage() {
+ return this.isSecondaryTableVirtual() ?
+ this.buildVirtualSecondaryTableUnresolvedNameMessage() :
+ super.buildUnresolvedNameMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnresolvedNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {
+ this.getSecondaryTableName(),
+ this.column.getName(),
+ this.column.getDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IMessage buildUnresolvedReferencedColumnNameMessage() {
+ return this.isSecondaryTableVirtual() ?
+ this.buildVirtualSecondaryTableUnresolvedReferencedColumnNameMessage() :
+ super.buildUnresolvedReferencedColumnNameMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnresolvedReferencedColumnNameMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
+ new String[] {
+ this.getSecondaryTableName(),
+ this.column.getReferencedColumnName(),
+ this.column.getReferencedColumnDbTable().getName()
+ },
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
+ return this.isSecondaryTableVirtual() ?
+ this.buildVirtualSecondaryTableUnspecifiedNameMultipleJoinColumnsMessage() :
+ super.buildUnspecifiedNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnspecifiedNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.getSecondaryTableName()},
+ this.column,
+ this.textRangeResolver.getNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return this.isSecondaryTableVirtual() ?
+ this.buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() :
+ super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
+ }
+
+ protected IMessage buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
+ new String[] {this.getSecondaryTableName()},
+ this.column,
+ this.textRangeResolver.getReferencedColumnNameTextRange()
+ );
+ }
+
+ @Override
+ protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java
new file mode 100644
index 0000000000..03b4df0b81
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.SecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class SecondaryTableValidator extends AbstractTableValidator
+{
+ public SecondaryTableValidator(SecondaryTable table, TableTextRangeResolver textRangeResolver) {
+ super(table, textRangeResolver);
+ }
+
+ @Override
+ public SecondaryTable getTable() {
+ return (SecondaryTable) super.getTable();
+ }
+
+ @Override
+ protected String getUnresolvedCatalogMessage() {
+ return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_CATALOG;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedCatalogMessage() {
+ throw new UnsupportedOperationException("No SecondaryTable annotations exist on attributes"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getUnresolvedSchemaMessage() {
+ return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_SCHEMA;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedSchemaMessage() {
+ throw new UnsupportedOperationException("No SecondaryTable annotations exist on attributes"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException("No SecondaryTable annotations exist on attributes"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java
new file mode 100644
index 0000000000..a0dad72ed6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+public class TableValidator extends AbstractTableValidator
+{
+ public TableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ super(table, textRangeResolver);
+ }
+
+ @Override
+ protected String getUnresolvedCatalogMessage() {
+ return JpaValidationMessages.TABLE_UNRESOLVED_CATALOG;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedCatalogMessage() {
+ throw new UnsupportedOperationException("No Table annotations exist on attributes"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getUnresolvedSchemaMessage() {
+ return JpaValidationMessages.TABLE_UNRESOLVED_SCHEMA;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedSchemaMessage() {
+ throw new UnsupportedOperationException("No Table annotations exist on attributes"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.TABLE_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ throw new UnsupportedOperationException("No Table annotations exist on attributes"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java
new file mode 100644
index 0000000000..71d9610828
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+public abstract class AbstractJavaConverter
+ extends AbstractJavaJpaContextNode
+ implements JavaConverter
+{
+ protected AbstractJavaConverter(JavaAttributeMapping parent) {
+ super(parent);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ protected JavaAttributeMapping getAttributeMapping() {
+ return this.getParent();
+ }
+
+ protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getAttributeMapping().getResourcePersistentAttribute();
+ }
+
+ public Annotation getConverterAnnotation() {
+ return this.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName());
+ }
+
+ public void dispose() {
+ // NOP
+ }
+
+ protected abstract String getAnnotationName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
new file mode 100644
index 0000000000..860b447bac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
@@ -0,0 +1,587 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java override container
+ * <p>
+ * <strong>NB:</strong> Although not typical, a Java override container can
+ * correspond to only a subset of the annotations in the Java source code.
+ * In that case, the index of a specified override must be translated to its
+ * corresponding annotation's index before we manipulate the annotations.
+ * <p>
+ * As of JPA 2.0, the only place we need these translations is for the attribute
+ * overrides for an embedded collection. If an embedded collection is a
+ * {@link java.util.Map Map}, the attribute overrides can override the mappings
+ * for either the map's keys or the map's values. The names of the overrides for
+ * the map's keys are prefixed with <code>"key."</code> while the overrides
+ * for the map's values are prefixed with <code>"value."</code>.
+ * (Just a bit of hack, courtesy of the JPA spec committee.)
+ */
+public abstract class AbstractJavaOverrideContainer<
+ O extends JavaOverrideContainer.Owner,
+ R extends JavaReadOnlyOverride,
+ S extends JavaOverride,
+ V extends JavaVirtualOverride,
+ A extends OverrideAnnotation
+ >
+ extends AbstractJavaJpaContextNode
+ implements JavaOverrideContainer
+{
+ // this can be null if the container is "read-only" (i.e. a "null" container)
+ protected final O owner;
+
+ protected final Vector<S> specifiedOverrides = new Vector<S>();
+ protected final SpecifiedOverrideContainerAdapter specifiedOverrideContainerAdapter = new SpecifiedOverrideContainerAdapter();
+
+ protected final Vector<V> virtualOverrides = new Vector<V>();
+ protected final VirtualOverrideContainerAdapter virtualOverrideContainerAdapter = new VirtualOverrideContainerAdapter();
+
+
+ protected AbstractJavaOverrideContainer(JavaJpaContextNode parent, O owner) {
+ super(parent);
+ this.owner = owner;
+ this.initializeSpecifiedOverrides();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedOverrides();
+ // the virtual overrides do not need a sync
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedOverrides());
+ this.updateVirtualOverrides();
+ }
+
+
+ // ********** overrides **********
+
+ public ListIterator<R> overrides() {
+ return this.getOverrides().iterator();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ListIterable<R> getOverrides() {
+ return new CompositeListIterable<R>(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides());
+ }
+
+ public int overridesSize() {
+ return this.specifiedOverrides.size() + this.virtualOverrides.size();
+ }
+
+ public R getOverrideNamed(String name) {
+ return this.selectOverrideNamed(this.getOverrides(), name);
+ }
+
+
+ // ********** override conversions **********
+
+ /**
+ * <em>Silently</em> add the new virtual override before removing the
+ * specified override, or the <em>update</em> will discover the missing
+ * virtual override and add it preemptively.
+ */
+ public V convertOverrideToVirtual(Override_ override) {
+ if (override.isVirtual()) {
+ throw new IllegalArgumentException("Override is already virtual: " + override); //$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unchecked")
+ S specifiedOverride = (S) override;
+ int virtualIndex = this.virtualOverrides.size();
+ String overrideName = specifiedOverride.getName();
+ V virtualOverride = null;
+ // make sure the specified override actually overrides something before building the virtual override
+ if (this.overrideWillBeVirtual(overrideName, specifiedOverride)) {
+ virtualOverride = this.buildVirtualOverride(overrideName);
+ this.virtualOverrides.add(virtualIndex, virtualOverride);
+ }
+
+ this.removeSpecifiedOverride(specifiedOverride); // trigger update
+
+ if (virtualOverride != null) {
+ this.fireItemAdded(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride);
+ }
+ return virtualOverride;
+ }
+
+ /**
+ * Return whether the specified override name will be a
+ * <em>virtual</em> override when the specified specified override is
+ * removed from the container. The override name must be among the
+ * valid override names and it must not correspond to any of the
+ * remaining specified overrides.
+ */
+ protected boolean overrideWillBeVirtual(String overrideName, S specifiedOverrideToBeRemoved) {
+ return CollectionTools.contains(this.allOverridableNames(), overrideName) &&
+ (this.getSpecifiedOverrideNamed(overrideName, specifiedOverrideToBeRemoved) == null);
+ }
+
+ /**
+ * <em>Silently</em> remove the virtual override and add the new specified
+ * override before naming the specified override, or the <em>update</em>
+ * will discover the dangling virtual override and remove it preemptively.
+ */
+ public S convertOverrideToSpecified(VirtualOverride override) {
+ if ( ! override.isVirtual()) {
+ throw new IllegalArgumentException("Override is already specified: " + override); //$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unchecked")
+ V virtualOverride = (V) override;
+ int virtualIndex = this.virtualOverrides.indexOf(virtualOverride);
+ this.virtualOverrides.remove(virtualIndex);
+
+ int specifiedIndex = this.specifiedOverrides.size();
+ S specifiedOverride = this.buildSpecifiedOverride(this.buildOverrideAnnotation(specifiedIndex));
+ this.specifiedOverrides.add(specifiedIndex, specifiedOverride);
+
+ this.initializeSpecifiedOverride(specifiedOverride, virtualOverride); // trigger update
+
+ this.fireItemRemoved(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride);
+ this.fireItemAdded(SPECIFIED_OVERRIDES_LIST, specifiedIndex, specifiedOverride);
+ return specifiedOverride;
+ }
+
+ protected abstract void initializeSpecifiedOverride(S specifiedOverride, V virtualOverride);
+
+
+ // ********** specified overrides **********
+
+ public ListIterator<S> specifiedOverrides() {
+ return this.getSpecifiedOverrides().iterator();
+ }
+
+ protected ListIterable<S> getSpecifiedOverrides() {
+ return new LiveCloneListIterable<S>(this.specifiedOverrides);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ListIterable<R> getReadOnlySpecifiedOverrides() {
+ // S should always be a subtype of R, but we can't enforce that in the
+ // class declaration...
+ return (ListIterable<R>) this.getSpecifiedOverrides();
+ }
+
+ public int specifiedOverridesSize() {
+ return this.specifiedOverrides.size();
+ }
+
+ public S getSpecifiedOverride(int index) {
+ return this.specifiedOverrides.get(index);
+ }
+
+ public S getSpecifiedOverrideNamed(String name) {
+ return this.getSpecifiedOverrideNamed(name, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected S getSpecifiedOverrideNamed(String name, S exclude) {
+ return (S) this.selectOverrideNamed(this.getReadOnlySpecifiedOverrides(), name, exclude);
+ }
+
+ protected S addSpecifiedOverride() {
+ return this.addSpecifiedOverride(this.specifiedOverrides.size());
+ }
+
+ protected S addSpecifiedOverride(int index) {
+ A annotation = this.buildOverrideAnnotation(index);
+ return this.addSpecifiedOverride_(index, annotation);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected A buildOverrideAnnotation(int index) {
+ int annotationIndex = this.calculateNewAnnotationIndex(index);
+ return (A) this.getResourcePersistentMember().addAnnotation(annotationIndex, this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName());
+ }
+
+ protected int calculateNewAnnotationIndex(int index) {
+ // if we are adding to the end of the specified list,
+ // put the annotation after all the existing annotations
+ if (index == this.specifiedOverrides.size()) {
+ return CollectionTools.size(this.getOverrideAnnotations());
+ }
+
+ // if we are adding to the front of the specified list,
+ // put the annotation before of all the existing annotations
+ if (index == 0) {
+ return 0;
+ }
+
+ // if we are adding to the middle of the specified list,
+ // put the annotation immediately after all the previous override's
+ // existing annotation
+ return this.translateToAnnotationIndex(index - 1) + 1;
+ }
+
+ /**
+ * pre-condition: override exists at the specified index
+ */
+ protected int translateToAnnotationIndex(int index) {
+ return CollectionTools.indexOf(this.getOverrideAnnotations(), this.specifiedOverrides.get(index).getOverrideAnnotation());
+ }
+
+ protected abstract String getOverrideAnnotationName();
+
+ protected abstract String getOverrideContainerAnnotationName();
+
+ protected void removeSpecifiedOverride(S override) {
+ this.removeSpecifiedOverride(this.specifiedOverrides.indexOf(override));
+ }
+
+ protected void removeSpecifiedOverride(int index) {
+ this.removeOverrideAnnotation(index);
+ this.removeSpecifiedOverride_(index);
+ }
+
+ protected void removeOverrideAnnotation(int index) {
+ int annotationIndex = this.translateToAnnotationIndex(index);
+ this.getResourcePersistentMember().removeAnnotation(annotationIndex, this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName());
+ }
+
+ protected void removeSpecifiedOverride_(int index) {
+ this.removeItemFromList(index, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedOverride(int targetIndex, int sourceIndex) {
+ this.moveOverrideAnnotation(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ }
+
+ protected void moveOverrideAnnotation(int targetIndex, int sourceIndex) {
+ int targetAnnotationIndex = this.translateToAnnotationIndex(targetIndex);
+ int sourceAnnotationIndex = this.translateToAnnotationIndex(sourceIndex);
+ this.getResourcePersistentMember().moveAnnotation(targetAnnotationIndex, sourceAnnotationIndex, this.getOverrideContainerAnnotationName());
+ }
+
+ protected void initializeSpecifiedOverrides() {
+ for (A annotation : this.getRelevantOverrideAnnotations()) {
+ this.specifiedOverrides.add(this.buildSpecifiedOverride(annotation));
+ }
+ }
+
+ protected abstract S buildSpecifiedOverride(A overrideAnnotation);
+
+ protected void syncSpecifiedOverrides() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedOverrideContainerAdapter);
+ }
+
+ protected Iterable<A> getRelevantOverrideAnnotations() {
+ return new FilteringIterable<A>(this.getOverrideAnnotations()) {
+ @Override
+ protected boolean accept(A annotation) {
+ String overrideName = annotation.getName();
+ return (overrideName != null) && AbstractJavaOverrideContainer.this.owner.isRelevant(overrideName);
+ }
+ };
+ }
+
+ protected Iterable<A> getOverrideAnnotations() {
+ return new SubIterableWrapper<NestableAnnotation, A>(
+ CollectionTools.iterable(this.overrideAnnotations())
+ );
+ }
+
+ protected Iterator<NestableAnnotation> overrideAnnotations() {
+ return (this.owner == null) ? EmptyIterator.<NestableAnnotation>instance() : this.overrideAnnotations_();
+ }
+
+ /**
+ * pre-condition: {@link #owner} is not <code>null</code>
+ */
+ protected Iterator<NestableAnnotation> overrideAnnotations_() {
+ return this.getResourcePersistentMember().annotations(this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName());
+ }
+
+ protected void moveSpecifiedOverride_(int index, S override) {
+ this.moveItemInList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ }
+
+ protected S addSpecifiedOverride_(int index, A overrideAnnotation) {
+ S override = this.buildSpecifiedOverride(overrideAnnotation);
+ this.addItemToList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ return override;
+ }
+
+ protected void removeSpecifiedOverride_(S override) {
+ this.removeSpecifiedOverride_(this.specifiedOverrides.indexOf(override));
+ }
+
+ /**
+ * specified override container adapter
+ */
+ protected class SpecifiedOverrideContainerAdapter
+ implements ContextContainerTools.Adapter<S, A>
+ {
+ public Iterable<S> getContextElements() {
+ return AbstractJavaOverrideContainer.this.getSpecifiedOverrides();
+ }
+ public Iterable<A> getResourceElements() {
+ return AbstractJavaOverrideContainer.this.getRelevantOverrideAnnotations();
+ }
+ @SuppressWarnings("unchecked")
+ public A getResourceElement(S contextElement) {
+ return (A) contextElement.getOverrideAnnotation();
+ }
+ public void moveContextElement(int index, S element) {
+ AbstractJavaOverrideContainer.this.moveSpecifiedOverride_(index, element);
+ }
+ public void addContextElement(int index, A resourceElement) {
+ AbstractJavaOverrideContainer.this.addSpecifiedOverride_(index, resourceElement);
+ }
+ public void removeContextElement(S element) {
+ AbstractJavaOverrideContainer.this.removeSpecifiedOverride_(element);
+ }
+ }
+
+
+ // ********** virtual overrides **********
+
+ public ListIterator<V> virtualOverrides() {
+ return this.getVirtualOverrides().iterator();
+ }
+
+ protected ListIterable<V> getVirtualOverrides() {
+ return new LiveCloneListIterable<V>(this.virtualOverrides);
+ }
+
+ public int virtualOverridesSize() {
+ return this.virtualOverrides.size();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ListIterable<R> getReadOnlyVirtualOverrides() {
+ // V should always be a subtype of R, but we can't enforce that in the
+ // class declaration...
+ return (ListIterable<R>) this.getVirtualOverrides();
+ }
+
+ protected void updateVirtualOverrides() {
+ ContextContainerTools.update(this.virtualOverrideContainerAdapter);
+ }
+
+ /**
+ * Return the overridable names that are not already in the list of
+ * specified overrides.
+ */
+ protected Iterable<String> getVirtualOverrideNames() {
+ return CollectionTools.iterable(this.virtualOverrideNames());
+ }
+
+ protected Iterator<String> virtualOverrideNames() {
+ return new FilteringIterator<String>(this.allOverridableNames()) {
+ @Override
+ protected boolean accept(String name) {
+ return AbstractJavaOverrideContainer.this.overrideIsVirtual(name);
+ }
+ };
+ }
+
+ protected boolean overrideIsVirtual(String name) {
+ return this.getSpecifiedOverrideNamed(name) == null;
+ }
+
+ protected void moveVirtualOverride(int index, V override) {
+ this.moveItemInList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
+ }
+
+ protected V addVirtualOverride(int index, String name) {
+ V override = this.buildVirtualOverride(name);
+ this.addItemToList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
+ return override;
+ }
+
+ protected abstract V buildVirtualOverride(String name);
+
+ protected void removeVirtualOverride(V override) {
+ this.removeItemFromList(override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
+ }
+
+ /**
+ * virtual override container adapter
+ * NB: the context override is matched with a resource override by name
+ */
+ protected class VirtualOverrideContainerAdapter
+ implements ContextContainerTools.Adapter<V, String>
+ {
+ public Iterable<V> getContextElements() {
+ return AbstractJavaOverrideContainer.this.getVirtualOverrides();
+ }
+ public Iterable<String> getResourceElements() {
+ return AbstractJavaOverrideContainer.this.getVirtualOverrideNames();
+ }
+ public String getResourceElement(V contextElement) {
+ return contextElement.getName();
+ }
+ public void moveContextElement(int index, V element) {
+ AbstractJavaOverrideContainer.this.moveVirtualOverride(index, element);
+ }
+ public void addContextElement(int index, String resourceElement) {
+ AbstractJavaOverrideContainer.this.addVirtualOverride(index, resourceElement);
+ }
+ public void removeContextElement(V element) {
+ AbstractJavaOverrideContainer.this.removeVirtualOverride(element);
+ }
+ }
+
+
+ // ********** misc **********
+
+ public TypeMapping getTypeMapping() {
+ return this.owner.getTypeMapping();
+ }
+
+ protected JavaResourcePersistentMember getResourcePersistentMember() {
+ return this.owner.getResourcePersistentMember();
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return this.owner.getOverridableTypeMapping();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ return (this.owner != null) ? this.owner.allOverridableNames() : EmptyIterator.<String>instance();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.owner.tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.owner.candidateTableNames();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.owner.resolveDbTable(tableName);
+ }
+
+ public String getDefaultTableName() {
+ return this.owner.getDefaultTableName();
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideTextRangeResolver textRangeResolver) {
+ return this.owner.buildValidator(override, this, textRangeResolver);
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return this.owner.buildColumnValidator(override, column, columnOwner, textRangeResolver);
+ }
+
+ public String getPossiblePrefix() {
+ return this.owner.getPossiblePrefix();
+ }
+
+ public String getWritePrefix() {
+ return this.owner.getWritePrefix();
+ }
+
+ protected R selectOverrideNamed(Iterable<R> overrides, String name) {
+ return this.selectOverrideNamed(overrides, name, null);
+ }
+
+ protected R selectOverrideNamed(Iterable<R> overrides, String name, S exclude) {
+ for (R override : overrides) {
+ if (override == exclude) {
+ continue; // skip
+ }
+ if (this.valuesAreEqual(override.getName(), name)) {
+ return override;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** code completion **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (R override : this.getOverrides()) {
+ result = override.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ for (R override: this.getOverrides()) {
+ override.validate(messages, reporter, astRoot);
+ }
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ Annotation annotation = this.getValidationAnnotation();
+ return (annotation != null) ?
+ annotation.getTextRange(astRoot) :
+ this.owner.getValidationTextRange(astRoot);
+ }
+
+ protected Annotation getValidationAnnotation() {
+ JavaResourcePersistentMember resourceMember = this.getResourcePersistentMember();
+ Annotation annotation = resourceMember.getAnnotation(this.getOverrideContainerAnnotationName());
+ return (annotation != null) ? annotation : resourceMember.getAnnotation(this.getOverrideAnnotationName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
new file mode 100644
index 0000000000..16298f2d59
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JarFile;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Context JAR file
+ */
+public class GenericJarFile
+ extends AbstractPersistenceXmlContextNode
+ implements JarFile, PersistentType.Owner
+{
+ protected final JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot;
+
+ protected final Vector<JavaPersistentType> javaPersistentTypes = new Vector<JavaPersistentType>();
+ protected final JavaPersistentTypeContainerAdapter javaPersistentTypeContainerAdapter = new JavaPersistentTypeContainerAdapter();
+
+
+ // ********** constructor/initialization **********
+
+ public GenericJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) {
+ super(parent);
+ this.jarResourcePackageFragmentRoot = jarResourcePackageFragmentRoot;
+ this.initializeJavaPersistentTypes();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncJavaPersistentTypes();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getJavaPersistentTypes());
+ }
+
+ public JavaResourcePackageFragmentRoot getJarResourcePackageFragmentRoot() {
+ return this.jarResourcePackageFragmentRoot;
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return null;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return null;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ return null;
+ }
+
+ public void dispose() {
+ // nothing yet
+ }
+
+
+ // ********** JpaContextNode implementation **********
+
+ @Override
+ public JptResourceType getResourceType() {
+ return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
+ }
+
+
+ // ********** Java persistent types **********
+
+ public JavaPersistentType getPersistentType(String typeName) {
+ for (JavaPersistentType pt : this.getJavaPersistentTypes()) {
+ if (pt.getName().equals(typeName)) {
+ return pt;
+ }
+ }
+ return null;
+ }
+
+ public Iterator<JavaPersistentType> javaPersistentTypes() {
+ return this.getJavaPersistentTypes().iterator();
+ }
+
+ protected Iterable<JavaPersistentType> getJavaPersistentTypes() {
+ return new LiveCloneIterable<JavaPersistentType>(this.javaPersistentTypes);
+ }
+
+ public int javaPersistentTypesSize() {
+ return this.javaPersistentTypes.size();
+ }
+
+ protected void initializeJavaPersistentTypes() {
+ for (JavaResourcePersistentType jrpt : this.getJavaResourcePersistentTypes()) {
+ this.javaPersistentTypes.add(this.buildJavaPersistentType(jrpt));
+ }
+ }
+
+ protected void syncJavaPersistentTypes() {
+ ContextContainerTools.synchronizeWithResourceModel(this.javaPersistentTypeContainerAdapter);
+ }
+
+ protected void addJavaPersistentType(JavaResourcePersistentType jrpt) {
+ JavaPersistentType javaPersistentType = this.buildJavaPersistentType(jrpt);
+ this.addItemToCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION);
+ }
+
+ protected void removeJavaPersistentType(JavaPersistentType javaPersistentType ) {
+ this.removeItemFromCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION);
+ }
+
+ /**
+ * the resource JAR holds only annotated types, so we can use them all for
+ * building the context types
+ */
+ protected Iterable<JavaResourcePersistentType> getJavaResourcePersistentTypes() {
+ return CollectionTools.iterable(this.jarResourcePackageFragmentRoot.persistentTypes());
+ }
+
+ protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
+ return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
+ }
+
+ /**
+ * Java persistent type container adapter
+ */
+ protected class JavaPersistentTypeContainerAdapter
+ implements ContextContainerTools.Adapter<JavaPersistentType, JavaResourcePersistentType>
+ {
+ public Iterable<JavaPersistentType> getContextElements() {
+ return GenericJarFile.this.getJavaPersistentTypes();
+ }
+ public Iterable<JavaResourcePersistentType> getResourceElements() {
+ return GenericJarFile.this.getJavaResourcePersistentTypes();
+ }
+ public JavaResourcePersistentType getResourceElement(JavaPersistentType contextElement) {
+ return contextElement.getResourcePersistentType();
+ }
+ public void moveContextElement(int index, JavaPersistentType element) {
+ // ignore moves - we don't care about the order of the Java persistent types
+ }
+ public void addContextElement(int index, JavaResourcePersistentType resourceElement) {
+ // ignore the index - we don't care about the order of the Java persistent types
+ GenericJarFile.this.addJavaPersistentType(resourceElement);
+ }
+ public void removeContextElement(JavaPersistentType element) {
+ GenericJarFile.this.removeJavaPersistentType(element);
+ }
+ }
+
+
+ // ********** PersistentTypeContainer implementation **********
+
+ public Iterable<? extends PersistentType> getPersistentTypes() {
+ return this.getJavaPersistentTypes();
+ }
+
+
+ // ********** PersistentType.Owner implementation **********
+
+ public AccessType getDefaultPersistentTypeAccess() {
+ return this.getPersistenceUnit().getDefaultAccess();
+ }
+
+ public AccessType getOverridePersistentTypeAccess() {
+ // no access type at this level overrides any local access type specification
+ return null;
+ }
+
+
+ // ********** JpaNode implementation **********
+
+ @Override
+ public JarFileRef getParent() {
+ return (JarFileRef) super.getParent();
+ }
+
+ protected JarFileRef getJarFileRef() {
+ return this.getParent();
+ }
+
+ @Override
+ public IResource getResource() {
+ return this.jarResourcePackageFragmentRoot.getFile();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ // TODO validate 'javaPersistentTypes'
+ }
+
+ public boolean isIn(org.eclipse.core.resources.IFolder folder) {
+ IResource member = folder.findMember(this.jarResourcePackageFragmentRoot.getFile().getName());
+ IFile file = this.jarResourcePackageFragmentRoot.getFile();
+ return member != null && file != null && member.equals(file);
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getJarFileRef().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
new file mode 100644
index 0000000000..ebcec5ef3e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOverride;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Specified Java association override
+ */
+public class GenericJavaAssociationOverride
+ extends AbstractJavaOverride<JavaAssociationOverrideContainer, AssociationOverrideAnnotation>
+ implements JavaAssociationOverride
+{
+ protected final JavaOverrideRelationship relationship;
+
+
+ public GenericJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverrideAnnotation annotation) {
+ super(parent, annotation);
+ this.relationship = this.buildRelationship();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.relationship.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.relationship.update();
+ }
+
+
+ // ********** specified/virtual **********
+
+ @Override
+ public JavaVirtualAssociationOverride convertToVirtual() {
+ return (JavaVirtualAssociationOverride) super.convertToVirtual();
+ }
+
+
+ // ********** relationship **********
+
+ public JavaOverrideRelationship getRelationship() {
+ return this.relationship;
+ }
+
+ protected JavaOverrideRelationship buildRelationship() {
+ return this.getJpaFactory().buildJavaOverrideRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ public RelationshipMapping getMapping() {
+ return this.getContainer().getRelationshipMapping(this.name);
+ }
+
+ public void initializeFrom(ReadOnlyAssociationOverride oldOverride) {
+ super.initializeFrom(oldOverride);
+ this.relationship.initializeFrom(oldOverride.getRelationship());
+ }
+
+ public void initializeFromVirtual(ReadOnlyAssociationOverride virtualOverride) {
+ super.initializeFromVirtual(virtualOverride);
+ this.relationship.initializeFromVirtual(virtualOverride.getRelationship());
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.relationship.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+ @Override
+ protected Iterator<String> candidateNames() {
+ return this.getContainer().allOverridableNames();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.relationship.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
new file mode 100644
index 0000000000..4d672822da
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+
+/**
+ * Java attribute override container
+ */
+public class GenericJavaAssociationOverrideContainer
+ extends AbstractJavaOverrideContainer<
+ JavaAssociationOverrideContainer.Owner,
+ JavaReadOnlyAssociationOverride,
+ JavaAssociationOverride,
+ JavaVirtualAssociationOverride,
+ AssociationOverrideAnnotation
+ >
+ implements JavaAssociationOverrideContainer
+{
+ public GenericJavaAssociationOverrideContainer(JavaJpaContextNode parent, JavaAssociationOverrideContainer.Owner owner) {
+ super(parent, owner);
+ }
+
+
+ public RelationshipMapping getRelationshipMapping(String attributeName) {
+ return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping());
+ }
+
+ public Relationship resolveOverriddenRelationship(String associationOverrideName) {
+ return this.owner.resolveOverriddenRelationship(associationOverrideName);
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.owner.buildJoinTableJoinColumnValidator(override, column, owner, textRangeResolver);
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.owner.buildJoinTableInverseJoinColumnValidator(override, column, owner, textRangeResolver);
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
+ return this.owner.buildTableValidator(override, table, textRangeResolver);
+ }
+
+ @Override
+ protected String getOverrideAnnotationName() {
+ return AssociationOverrideAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getOverrideContainerAnnotationName() {
+ return AssociationOverridesAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected JavaAssociationOverride buildSpecifiedOverride(AssociationOverrideAnnotation overrideAnnotation) {
+ return this.getJpaFactory().buildJavaAssociationOverride(this, overrideAnnotation);
+ }
+
+ @Override
+ protected void initializeSpecifiedOverride(JavaAssociationOverride specifiedOverride, JavaVirtualAssociationOverride virtualOverride) {
+ specifiedOverride.initializeFromVirtual(virtualOverride);
+ }
+
+ @Override
+ protected JavaVirtualAssociationOverride buildVirtualOverride(String name) {
+ return this.getJpaFactory().buildJavaVirtualAssociationOverride(this, name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
new file mode 100644
index 0000000000..dda23b1611
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOverride;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Specified Java attribute override
+ */
+public class GenericJavaAttributeOverride
+ extends AbstractJavaOverride<JavaAttributeOverrideContainer, AttributeOverrideAnnotation>
+ implements JavaAttributeOverride, JavaColumn.Owner
+{
+ protected final JavaColumn column;
+
+
+ public GenericJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverrideAnnotation annotation) {
+ super(parent, annotation);
+ this.column = this.buildColumn();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ }
+
+
+ // ********** specified/virtual **********
+
+ @Override
+ public JavaVirtualAttributeOverride convertToVirtual() {
+ return (JavaVirtualAttributeOverride) super.convertToVirtual();
+ }
+
+
+ // ********** column **********
+
+ public JavaColumn getColumn() {
+ return this.column;
+ }
+
+ protected JavaColumn buildColumn() {
+ return this.getJpaFactory().buildJavaColumn(this, this);
+ }
+
+
+ // ********** misc **********
+
+ public void initializeFrom(ReadOnlyAttributeOverride oldOverride) {
+ super.initializeFrom(oldOverride);
+ this.column.initializeFrom(oldOverride.getColumn());
+ }
+
+ public void initializeFromVirtual(ReadOnlyAttributeOverride oldOverride) {
+ super.initializeFromVirtual(oldOverride);
+ this.column.initializeFromVirtual(oldOverride.getColumn());
+ }
+
+
+ // ********** column owner implementation **********
+
+ public TypeMapping getTypeMapping() {
+ return this.getContainer().getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ return this.getContainer().getDefaultTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getContainer().resolveDbTable(tableName);
+ }
+
+ public String getDefaultColumnName() {
+ return this.name;
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return this.getContainer().buildColumnValidator(this, (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getContainer().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getContainer().candidateTableNames();
+ }
+
+ public CompleteColumnAnnotation getColumnAnnotation() {
+ return this.getOverrideAnnotation().getNonNullColumn();
+ }
+
+ public void removeColumnAnnotation() {
+ this.getOverrideAnnotation().removeColumn();
+ }
+
+
+ // ********** mapped by relationship **********
+
+ protected boolean isMappedByRelationship() {
+ return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.buildQualifier());
+ }
+
+ protected Iterable<String> getMappedByRelationshipAttributeNames() {
+ return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
+ }
+
+ /**
+ * overridable names are (usually?) qualified with a container mapping,
+ * which may also be the one mapped by a relationship
+ */
+ protected String buildQualifier() {
+ if (this.name == null) {
+ return null;
+ }
+ int index = this.name.indexOf('.');
+ return (index == -1) ? this.name : this.name.substring(0, index);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+ @Override
+ protected Iterator<String> candidateNames() {
+ return this.getContainer().allOverridableNames();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ // [JPA 2.0] if the column is specified, or if the override is not mapped by a relationship,
+ // then the column is validated.
+ // (In JPA 1.0, the column will always be validated, since the override is never mapped by a
+ // relationship)
+ if (this.columnAnnotationIsSpecified() || ! this.isMappedByRelationship()) {
+ this.column.validate(messages, reporter, astRoot);
+ }
+
+ // [JPA 2.0] if the override is mapped by a relationship, then that actually is in itself
+ // a validation error
+ // (We prevent implied overrides that are mapped by a relationship ... hopefully)
+ // (In JPA 1.0, this will never occur)
+ if (this.isMappedByRelationship()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ this,
+ this.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ }
+
+ protected boolean columnAnnotationIsSpecified() {
+ return this.getOverrideAnnotation().getColumn() != null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
new file mode 100644
index 0000000000..26be7c2ef8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+
+/**
+ * Java attribute override container
+ */
+public class GenericJavaAttributeOverrideContainer
+ extends AbstractJavaOverrideContainer<
+ JavaAttributeOverrideContainer.Owner,
+ JavaReadOnlyAttributeOverride,
+ JavaAttributeOverride,
+ JavaVirtualAttributeOverride,
+ AttributeOverrideAnnotation
+ >
+ implements JavaAttributeOverrideContainer
+{
+ public GenericJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner) {
+ super(parent, owner);
+ }
+
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ return (attributeName == null) ? null : this.owner.resolveOverriddenColumn(attributeName);
+ }
+
+ @Override
+ protected String getOverrideAnnotationName() {
+ return AttributeOverrideAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getOverrideContainerAnnotationName() {
+ return AttributeOverridesAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected JavaAttributeOverride buildSpecifiedOverride(AttributeOverrideAnnotation overrideAnnotation) {
+ return this.getJpaFactory().buildJavaAttributeOverride(this, overrideAnnotation);
+ }
+
+ @Override
+ protected void initializeSpecifiedOverride(JavaAttributeOverride specifiedOverride, JavaVirtualAttributeOverride virtualOverride) {
+ specifiedOverride.initializeFromVirtual(virtualOverride);
+ }
+
+ @Override
+ protected JavaVirtualAttributeOverride buildVirtualOverride(String name) {
+ return this.getJpaFactory().buildJavaVirtualAttributeOverride(this, name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java
new file mode 100644
index 0000000000..fc88aeed80
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBasicMapping;
+
+public class GenericJavaBasicMapping
+ extends AbstractJavaBasicMapping
+{
+ public GenericJavaBasicMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java
new file mode 100644
index 0000000000..321792eaf2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaRelationshipMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCascade2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
+
+public class GenericJavaCascade
+ extends AbstractJavaJpaContextNode
+ implements JavaCascade2_0
+{
+ protected boolean all;
+
+ protected boolean persist;
+
+ protected boolean merge;
+
+ protected boolean remove;
+
+ protected boolean refresh;
+
+ /* JPA 2.0 */
+ protected boolean detach;
+
+
+ /**
+ * This is built directly by the mapping implementation; as opposed to via
+ * a platform-specific factory.
+ * @see AbstractJavaRelationshipMapping#buildCascade()
+ */
+ public GenericJavaCascade(JavaRelationshipMapping parent) {
+ super(parent);
+ this.all = this.buildAll();
+ this.persist = this.buildPersist();
+ this.merge = this.buildMerge();
+ this.remove = this.buildRemove();
+ this.refresh = this.buildRefresh();
+ this.detach = this.buildDetach();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setAll_(this.buildAll());
+ this.setPersist_(this.buildPersist());
+ this.setMerge_(this.buildMerge());
+ this.setRemove_(this.buildRemove());
+ this.setRefresh_(this.buildRefresh());
+ this.setDetach_(this.buildDetach());
+ }
+
+
+ // ********** all **********
+
+ public boolean isAll() {
+ return this.all;
+ }
+
+ public void setAll(boolean all) {
+ if (all != this.all) {
+ this.getMappingAnnotationForUpdate().setCascadeAll(all);
+ this.setAll_(all);
+ }
+ }
+
+ protected void setAll_(boolean all) {
+ boolean old = this.all;
+ this.all = all;
+ this.firePropertyChanged(ALL_PROPERTY, old, all);
+ }
+
+ protected boolean buildAll() {
+ RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation != null) && annotation.isCascadeAll();
+ }
+
+
+ // ********** persist **********
+
+ public boolean isPersist() {
+ return this.persist;
+ }
+
+ public void setPersist(boolean persist) {
+ if (persist != this.persist) {
+ this.getMappingAnnotationForUpdate().setCascadePersist(persist);
+ this.setPersist_(persist);
+ }
+ }
+
+ protected void setPersist_(boolean persist) {
+ boolean old = this.persist;
+ this.persist = persist;
+ this.firePropertyChanged(PERSIST_PROPERTY, old, persist);
+ }
+
+ protected boolean buildPersist() {
+ RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation != null) && annotation.isCascadePersist();
+ }
+
+
+ // ********** merge **********
+
+ public boolean isMerge() {
+ return this.merge;
+ }
+
+ public void setMerge(boolean merge) {
+ if (merge != this.merge) {
+ this.getMappingAnnotationForUpdate().setCascadeMerge(merge);
+ this.setMerge_(merge);
+ }
+ }
+
+ protected void setMerge_(boolean merge) {
+ boolean old = this.merge;
+ this.merge = merge;
+ this.firePropertyChanged(MERGE_PROPERTY, old, merge);
+ }
+
+ protected boolean buildMerge() {
+ RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation != null) && annotation.isCascadeMerge();
+ }
+
+
+ // ********** remove **********
+
+ public boolean isRemove() {
+ return this.remove;
+ }
+
+ public void setRemove(boolean remove) {
+ if (remove != this.remove) {
+ this.getMappingAnnotationForUpdate().setCascadeRemove(remove);
+ this.setRemove_(remove);
+ }
+ }
+
+ protected void setRemove_(boolean remove) {
+ boolean oldRemove = this.remove;
+ this.remove = remove;
+ this.firePropertyChanged(REMOVE_PROPERTY, oldRemove, remove);
+ }
+
+ protected boolean buildRemove() {
+ RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation != null) && annotation.isCascadeRemove();
+ }
+
+
+ // ********** refresh **********
+
+ public boolean isRefresh() {
+ return this.refresh;
+ }
+
+ public void setRefresh(boolean refresh) {
+ if (refresh != this.refresh) {
+ this.getMappingAnnotationForUpdate().setCascadeRefresh(refresh);
+ this.setRefresh_(refresh);
+ }
+ }
+
+ protected void setRefresh_(boolean refresh) {
+ boolean old = this.refresh;
+ this.refresh = refresh;
+ this.firePropertyChanged(REFRESH_PROPERTY, old, refresh);
+ }
+
+ protected boolean buildRefresh() {
+ RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation != null) && annotation.isCascadeRefresh();
+ }
+
+
+ // ********** detach **********
+
+ public boolean isDetach() {
+ return this.detach;
+ }
+
+ public void setDetach(boolean detach) {
+ if (detach != this.detach) {
+ this.getMappingAnnotationForUpdate2_0().setCascadeDetach(detach);
+ this.setDetach_(detach);
+ }
+ }
+
+ protected void setDetach_(boolean detach) {
+ boolean old = this.detach;
+ this.detach = detach;
+ this.firePropertyChanged(DETACH_PROPERTY, old, detach);
+ }
+
+ protected boolean buildDetach() {
+ return this.isJpa2_0Compatible() && this.buildDetach_();
+ }
+
+ protected boolean buildDetach_() {
+ RelationshipMapping2_0Annotation annotation = this.getMappingAnnotation2_0();
+ return (annotation != null) && annotation.isCascadeDetach();
+ }
+
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaRelationshipMapping getParent() {
+ return (JavaRelationshipMapping) super.getParent();
+ }
+
+ protected JavaRelationshipMapping getMapping() {
+ return this.getParent();
+ }
+
+ protected RelationshipMappingAnnotation getMappingAnnotation() {
+ return this.getMapping().getMappingAnnotation();
+ }
+
+ protected RelationshipMappingAnnotation getMappingAnnotationForUpdate() {
+ return this.getMapping().getAnnotationForUpdate();
+ }
+
+ protected RelationshipMapping2_0Annotation getMappingAnnotation2_0() {
+ return (RelationshipMapping2_0Annotation) this.getMappingAnnotation();
+ }
+
+ protected RelationshipMapping2_0Annotation getMappingAnnotationForUpdate2_0() {
+ return (RelationshipMapping2_0Annotation) this.getMappingAnnotationForUpdate();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getCascadeTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java
new file mode 100644
index 0000000000..2af11ca6fa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseColumn;
+import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
+
+/**
+ * Java column
+ * <p>
+ * Note: The <code>Column</code> annotation is one of only 2 annotations that
+ * can be nested outside of an array (i.e. in an <code>AttributeOverride</code>
+ * annotation); the other is {@link GenericJavaJoinTable JoinTable}.
+ */
+public class GenericJavaColumn
+ extends AbstractJavaBaseColumn<CompleteColumnAnnotation, JavaColumn.Owner>
+ implements JavaColumn
+{
+ protected Integer specifiedLength;
+ protected int defaultLength;
+
+ protected Integer specifiedPrecision;
+ protected int defaultPrecision;
+
+ protected Integer specifiedScale;
+ protected int defaultScale;
+
+
+ public GenericJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) {
+ super(parent, owner);
+ this.specifiedLength = this.buildSpecifiedLength();
+ this.specifiedPrecision = this.buildSpecifiedPrecision();
+ this.specifiedScale = this.buildSpecifiedScale();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedLength_(this.buildSpecifiedLength());
+ this.setSpecifiedPrecision_(this.buildSpecifiedPrecision());
+ this.setSpecifiedScale_(this.buildSpecifiedScale());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultLength(this.buildDefaultLength());
+ this.setDefaultPrecision(this.buildDefaultPrecision());
+ this.setDefaultScale(this.buildDefaultScale());
+ }
+
+
+ // ********** column annotation **********
+
+ @Override
+ public CompleteColumnAnnotation getColumnAnnotation() {
+ return this.owner.getColumnAnnotation();
+ }
+
+ @Override
+ protected void removeColumnAnnotation() {
+ this.owner.removeColumnAnnotation();
+ }
+
+
+ // ********** length **********
+
+ public int getLength() {
+ return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer length) {
+ if (this.valuesAreDifferent(this.specifiedLength, length)) {
+ this.getColumnAnnotation().setLength(length);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedLength_(length);
+ }
+ }
+
+ protected void setSpecifiedLength_(Integer length) {
+ Integer old = this.specifiedLength;
+ this.specifiedLength = length;
+ this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
+ }
+
+ protected Integer buildSpecifiedLength() {
+ return this.getColumnAnnotation().getLength();
+ }
+
+ public int getDefaultLength() {
+ return this.defaultLength;
+ }
+
+ protected void setDefaultLength(int length) {
+ int old = this.defaultLength;
+ this.defaultLength = length;
+ this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
+ }
+
+ protected int buildDefaultLength() {
+ return DEFAULT_LENGTH;
+ }
+
+
+ // ********** precision **********
+
+ public int getPrecision() {
+ return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision;
+ }
+
+ public Integer getSpecifiedPrecision() {
+ return this.specifiedPrecision;
+ }
+
+ public void setSpecifiedPrecision(Integer precision) {
+ if (this.valuesAreDifferent(this.specifiedPrecision, precision)) {
+ this.getColumnAnnotation().setPrecision(precision);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedPrecision_(precision);
+ }
+ }
+
+ protected void setSpecifiedPrecision_(Integer precision) {
+ Integer old = this.specifiedPrecision;
+ this.specifiedPrecision = precision;
+ this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
+ }
+
+ protected Integer buildSpecifiedPrecision() {
+ return this.getColumnAnnotation().getPrecision();
+ }
+
+ public int getDefaultPrecision() {
+ return this.defaultPrecision;
+ }
+
+ protected void setDefaultPrecision(int precision) {
+ int old = this.defaultPrecision;
+ this.defaultPrecision = precision;
+ this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision);
+ }
+
+ protected int buildDefaultPrecision() {
+ return DEFAULT_PRECISION;
+ }
+
+
+ // ********** scale **********
+
+ public int getScale() {
+ return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale;
+ }
+
+ public Integer getSpecifiedScale() {
+ return this.specifiedScale;
+ }
+
+ public void setSpecifiedScale(Integer scale) {
+ if (this.valuesAreDifferent(this.specifiedScale, scale)) {
+ this.getColumnAnnotation().setScale(scale);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedScale_(scale);
+ }
+ }
+
+ protected void setSpecifiedScale_(Integer scale) {
+ Integer old = this.specifiedScale;
+ this.specifiedScale = scale;
+ this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
+ }
+
+ protected Integer buildSpecifiedScale() {
+ return this.getColumnAnnotation().getScale();
+ }
+
+ public int getDefaultScale() {
+ return this.defaultScale;
+ }
+
+ protected void setDefaultScale(int scale) {
+ int old = this.defaultScale;
+ this.defaultScale = scale;
+ this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale);
+ }
+
+ protected int buildDefaultScale() {
+ return DEFAULT_SCALE;
+ }
+
+
+ // ********** misc **********
+
+ public void initializeFrom(ReadOnlyColumn oldColumn) {
+ super.initializeFrom(oldColumn);
+ this.setSpecifiedLength(oldColumn.getSpecifiedLength());
+ this.setSpecifiedPrecision(oldColumn.getSpecifiedPrecision());
+ this.setSpecifiedScale(oldColumn.getSpecifiedScale());
+ }
+
+ public void initializeFromVirtual(ReadOnlyColumn virtualColumn) {
+ super.initializeFromVirtual(virtualColumn);
+ // ignore other settings?
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
new file mode 100644
index 0000000000..a88cc6660c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0, which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
+import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java discriminator column
+ */
+public class GenericJavaDiscriminatorColumn
+ extends AbstractJavaNamedColumn<DiscriminatorColumnAnnotation, JavaDiscriminatorColumn.Owner>
+ implements JavaDiscriminatorColumn
+{
+ protected DiscriminatorType specifiedDiscriminatorType;
+ protected DiscriminatorType defaultDiscriminatorType;
+
+ protected Integer specifiedLength;
+ protected int defaultLength;
+
+
+ public GenericJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner) {
+ super(parent, owner);
+ this.specifiedDiscriminatorType = this.buildSpecifiedDiscriminatorType();
+ this.specifiedLength = this.buildSpecifiedLength();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedDiscriminatorType_(this.buildSpecifiedDiscriminatorType());
+ this.setSpecifiedLength_(this.buildSpecifiedLength());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType());
+ this.setDefaultLength(this.buildDefaultLength());
+ }
+
+
+ // ********** column annotation **********
+
+ @Override
+ public DiscriminatorColumnAnnotation getColumnAnnotation() {
+ return (DiscriminatorColumnAnnotation) this.getResourcePersistentType().getNonNullAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected void removeColumnAnnotation() {
+ this.getResourcePersistentType().removeAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** discriminator type **********
+
+ public DiscriminatorType getDiscriminatorType() {
+ return (this.specifiedDiscriminatorType != null) ? this.specifiedDiscriminatorType : this.defaultDiscriminatorType;
+ }
+
+ public DiscriminatorType getSpecifiedDiscriminatorType() {
+ return this.specifiedDiscriminatorType;
+ }
+
+ public void setSpecifiedDiscriminatorType(DiscriminatorType discriminatorType) {
+ if (this.valuesAreDifferent(this.specifiedDiscriminatorType, discriminatorType)) {
+ this.getColumnAnnotation().setDiscriminatorType(DiscriminatorType.toJavaResourceModel(discriminatorType));
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedDiscriminatorType_(discriminatorType);
+ }
+ }
+
+ protected void setSpecifiedDiscriminatorType_(DiscriminatorType discriminatorType) {
+ DiscriminatorType old = this.specifiedDiscriminatorType;
+ this.specifiedDiscriminatorType = discriminatorType;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
+ }
+
+ protected DiscriminatorType buildSpecifiedDiscriminatorType() {
+ return DiscriminatorType.fromJavaResourceModel(this.getColumnAnnotation().getDiscriminatorType());
+ }
+
+ public DiscriminatorType getDefaultDiscriminatorType() {
+ return this.defaultDiscriminatorType;
+ }
+
+ protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) {
+ DiscriminatorType old = this.defaultDiscriminatorType;
+ this.defaultDiscriminatorType = discriminatorType;
+ this.firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
+ }
+
+ protected DiscriminatorType buildDefaultDiscriminatorType() {
+ return this.owner.getDefaultDiscriminatorType();
+ }
+
+
+ // ********** length **********
+
+ public int getLength() {
+ return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer length) {
+ if (this.valuesAreDifferent(this.specifiedLength, length)) {
+ this.getColumnAnnotation().setLength(length);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedLength_(length);
+ }
+ }
+
+ protected void setSpecifiedLength_(Integer length) {
+ Integer old = this.specifiedLength;
+ this.specifiedLength = length;
+ this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
+ }
+
+ protected Integer buildSpecifiedLength() {
+ return this.getColumnAnnotation().getLength();
+ }
+
+ public int getDefaultLength() {
+ return this.defaultLength;
+ }
+
+ protected void setDefaultLength(int length) {
+ int old = this.defaultLength;
+ this.defaultLength = length;
+ this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
+ }
+
+ protected int buildDefaultLength() {
+ return this.owner.getDefaultLength();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaEntity getParent() {
+ return (JavaEntity) super.getParent();
+ }
+
+ protected JavaEntity getEntity() {
+ return this.getParent();
+ }
+
+ protected JavaPersistentType getPersistentType() {
+ return this.getEntity().getPersistentType();
+ }
+
+ protected JavaResourcePersistentType getResourcePersistentType() {
+ return this.getPersistentType().getResourcePersistentType();
+ }
+
+
+ // ********** validation **********
+
+ public boolean isResourceSpecified() {
+ return this.getColumnAnnotation().isSpecified();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java
new file mode 100644
index 0000000000..75bcc8579a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+
+/**
+ * Java embeddable type mapping
+ */
+public class GenericJavaEmbeddable
+ extends AbstractJavaEmbeddable
+{
+ public GenericJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ }
+
+ @Override
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ //generic only allows basic and transient within an Embeddable
+ return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
+ }
+
+ public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS =
+ new String[] {
+ MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
new file mode 100644
index 0000000000..2db8014c83
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedIdMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java embedded ID mapping
+ */
+public class GenericJavaEmbeddedIdMapping
+ extends AbstractJavaBaseEmbeddedMapping<EmbeddedIdAnnotation>
+ implements EmbeddedIdMapping2_0, JavaEmbeddedIdMapping
+{
+ /* 2.0 feature - a relationship may map this embedded id */
+ protected boolean mappedByRelationship;
+
+
+ public GenericJavaEmbeddedIdMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.setMappedByRelationship(this.buildMappedByRelationship());
+ }
+
+
+ // ********** mapped by relationship **********
+
+ public boolean isMappedByRelationship() {
+ return this.mappedByRelationship;
+ }
+
+ protected void setMappedByRelationship(boolean value) {
+ boolean old = this.mappedByRelationship;
+ this.mappedByRelationship = value;
+ this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, value);
+ }
+
+ protected boolean buildMappedByRelationship() {
+ return this.isJpa2_0Compatible() && this.buildMappedByRelationship_();
+ }
+
+ protected boolean buildMappedByRelationship_() {
+ return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.getName());
+ }
+
+ protected Iterable<String> getMappedByRelationshipAttributeNames() {
+ return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return EmbeddedIdAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected Iterator<String> embeddableOverridableAttributeMappingNames() {
+ return (this.mappedByRelationship) ?
+ EmptyIterator.<String>instance() :
+ super.embeddableOverridableAttributeMappingNames();
+ }
+
+ @Override
+ protected JavaAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() {
+ return new AttributeOverrideContainerOwner();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ // [JPA 2.0] if the embedded id is mapped by a relationship, then any specified
+ // attribute overrides are in error
+ // (in JPA 1.0, this will obviously never be reached)
+ if (this.mappedByRelationship
+ && (this.attributeOverrideContainer.specifiedOverridesSize() > 0)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ this.attributeOverrideContainer,
+ this.attributeOverrideContainer.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ }
+
+ // ********** attribute override container owner *********
+
+ protected class AttributeOverrideContainerOwner
+ extends AbstractJavaBaseEmbeddedMapping<EmbeddedIdAnnotation>.AttributeOverrideContainerOwner
+ {
+ @Override
+ public Iterator<String> allOverridableNames() {
+ return GenericJavaEmbeddedIdMapping.this.isMappedByRelationship() ?
+ EmptyIterator.<String>instance() :
+ super.allOverridableNames();
+ }
+
+ @Override
+ protected Iterator<String> allOverridableAttributeNames_(TypeMapping typeMapping) {
+ final Set<String> mappedByRelationshipAttributeNames = this.buildMappedByRelationshipAttributeNames();
+ if (mappedByRelationshipAttributeNames.isEmpty()) {
+ return super.allOverridableAttributeNames_(typeMapping);
+ }
+ return new FilteringIterator<String>(super.allOverridableAttributeNames_(typeMapping)) {
+ @Override
+ protected boolean accept(String attributeName) {
+ // overridable names are (usually?) qualified with a container mapping,
+ // which may also be the one mapped by a relationship
+ int dotIndex = attributeName.indexOf('.');
+ String qualifier = (dotIndex > 0) ? attributeName.substring(0, dotIndex) : attributeName;
+ return ! mappedByRelationshipAttributeNames.contains(qualifier);
+ }
+ };
+ }
+
+ protected Set<String> buildMappedByRelationshipAttributeNames() {
+ return CollectionTools.set(GenericJavaEmbeddedIdMapping.this.getMappedByRelationshipAttributeNames());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
new file mode 100644
index 0000000000..660bc2d6af
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java embedded mapping
+ */
+public class GenericJavaEmbeddedMapping
+ extends AbstractJavaBaseEmbeddedMapping<EmbeddedAnnotation>
+ implements JavaEmbeddedMapping2_0
+{
+ protected final JavaAssociationOverrideContainer associationOverrideContainer;
+
+
+ public GenericJavaEmbeddedMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ this.associationOverrideContainer = this.buildAssociationOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.associationOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.associationOverrideContainer.update();
+ }
+
+
+ // ********** association override container **********
+
+ protected JavaAssociationOverrideContainer buildAssociationOverrideContainer() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaAssociationOverrideContainer(this, this.buildAssociationOverrideContainerOwner()) :
+ new GenericJavaAssociationOverrideContainer(this, null);
+ }
+
+ public JavaAssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.associationOverrideContainer;
+ }
+
+ protected JavaAssociationOverrideContainer.Owner buildAssociationOverrideContainerOwner() {
+ return new AssociationOverrideContainerOwner();
+ }
+
+
+ // ********** embedded mappings **********
+
+ /**
+ * This is only to build the choices for a "mapped by" setting in a
+ * relationship mapping. JPA 2.0 does not support relationship mappings
+ * in an embedded ID class; so we only put this logic here.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterator<String> allMappingNames() {
+ return this.isJpa2_0Compatible() ?
+ new CompositeIterator<String>(super.allMappingNames(), this.allEmbeddableAttributeMappingNames()) :
+ super.allMappingNames();
+ }
+
+ protected Iterator<String> allEmbeddableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ @Override
+ public AttributeMapping resolveAttributeMapping(String attributeName) {
+ AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ return this.isJpa2_0Compatible() ? this.resolveAttributeMapping_(attributeName) : null;
+ }
+
+ protected AttributeMapping resolveAttributeMapping_(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ // recurse into the embeddable mappings
+ for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) {
+ AttributeMapping resolvedMapping = mapping.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return EmbeddedAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ return this.isJpa2_0Compatible() ? this.resolveOverriddenRelationship_(attributeName) : null;
+ }
+
+ protected Relationship resolveOverriddenRelationship_(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getRelationship() : this.resolveOverriddenRelationshipInTargetEmbeddable(attributeName);
+ }
+
+ protected Relationship resolveOverriddenRelationshipInTargetEmbeddable(String attributeName) {
+ return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenRelationship(attributeName);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.associationOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected void validateOverrides(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validateOverrides(messages, reporter, astRoot);
+ this.associationOverrideContainer.validate(messages, reporter, astRoot);
+ }
+
+
+ // ********** association override container owner **********
+
+ protected class AssociationOverrideContainerOwner
+ implements JavaAssociationOverrideContainer.Owner
+ {
+ public JavaResourcePersistentMember getResourcePersistentMember() {
+ return GenericJavaEmbeddedMapping.this.getResourcePersistentAttribute();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaEmbeddedMapping.this.getTypeMapping();
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return GenericJavaEmbeddedMapping.this.getTargetEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.<String>instance();
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public String getPossiblePrefix() {
+ return null;
+ }
+
+ public String getWritePrefix() {
+ return null;
+ }
+
+ // no maps, so all overrides are relevant
+ public boolean isRelevant(String overrideName) {
+ return true;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaEmbeddedMapping.this.getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinTableValidator(override, (JoinTable) table, textRangeResolver);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java
new file mode 100644
index 0000000000..e123367631
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEntity;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+
+public class GenericJavaEntity
+ extends AbstractJavaEntity
+{
+ // EclipseLink holds its cacheable in its caching
+ protected final JavaCacheable2_0 cacheable;
+
+
+ public GenericJavaEntity(JavaPersistentType parent, EntityAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ this.cacheable = this.buildCacheable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.cacheable.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.cacheable.update();
+ }
+
+
+ // ********** cacheable **********
+
+ public JavaCacheable2_0 getCacheable() {
+ return this.cacheable;
+ }
+
+ protected JavaCacheable2_0 buildCacheable() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaCacheable(this) :
+ new NullJavaCacheable2_0(this);
+ }
+
+ public boolean calculateDefaultCacheable() {
+ Cacheable2_0 parentCacheable = this.getParentCacheable();
+ return (parentCacheable != null) ?
+ parentCacheable.isCacheable() :
+ ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable();
+ }
+
+ protected Cacheable2_0 getParentCacheable() {
+ CacheableHolder2_0 parentEntity = (CacheableHolder2_0) this.getParentEntity();
+ return (parentEntity == null) ? null : parentEntity.getCacheable();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
new file mode 100644
index 0000000000..0ef279813f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.EnumType;
+import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+
+public class GenericJavaEnumeratedConverter
+ extends AbstractJavaConverter
+ implements JavaEnumeratedConverter
+{
+ protected final EnumeratedAnnotation enumeratedAnnotation;
+
+ protected EnumType specifiedEnumType;
+ protected EnumType defaultEnumType;
+
+
+ public GenericJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation enumeratedAnnotation) {
+ super(parent);
+ this.enumeratedAnnotation = enumeratedAnnotation;
+ this.specifiedEnumType = this.buildSpecifiedEnumType();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedEnumType_(this.buildSpecifiedEnumType());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultEnumType(this.buildDefaultEnumType());
+ }
+
+
+ // ********** enum type **********
+
+ public EnumType getEnumType() {
+ return (this.specifiedEnumType != null) ? this.specifiedEnumType : this.defaultEnumType;
+ }
+
+ public EnumType getSpecifiedEnumType() {
+ return this.specifiedEnumType;
+ }
+
+ public void setSpecifiedEnumType(EnumType enumType) {
+ this.enumeratedAnnotation.setValue(EnumType.toJavaResourceModel(enumType));
+ this.setSpecifiedEnumType_(enumType);
+ }
+
+ protected void setSpecifiedEnumType_(EnumType enumType) {
+ EnumType old = this.specifiedEnumType;
+ this.specifiedEnumType = enumType;
+ this.firePropertyChanged(SPECIFIED_ENUM_TYPE_PROPERTY, old, enumType);
+ }
+
+ protected EnumType buildSpecifiedEnumType() {
+ return EnumType.fromJavaResourceModel(this.enumeratedAnnotation.getValue());
+ }
+
+ public EnumType getDefaultEnumType() {
+ return this.defaultEnumType;
+ }
+
+ protected void setDefaultEnumType(EnumType enumType) {
+ EnumType old = this.defaultEnumType;
+ this.defaultEnumType = enumType;
+ this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType);
+ }
+
+ protected EnumType buildDefaultEnumType() {
+ return DEFAULT_ENUM_TYPE;
+ }
+
+
+ // ********** misc **********
+
+ public Class<? extends Converter> getType() {
+ return EnumeratedConverter.class;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return EnumeratedAnnotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.enumeratedAnnotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
new file mode 100644
index 0000000000..de5501141b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.GenerationType;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue;
+import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java generated value
+ */
+public class GenericJavaGeneratedValue
+ extends AbstractJavaJpaContextNode
+ implements JavaGeneratedValue
+{
+ protected final GeneratedValueAnnotation generatedValueAnnotation;
+
+ protected GenerationType specifiedStrategy;
+ protected GenerationType defaultStrategy;
+
+ protected String specifiedGenerator;
+ protected String defaultGenerator;
+
+
+ public GenericJavaGeneratedValue(JavaIdMapping parent, GeneratedValueAnnotation generatedValueAnnotation) {
+ super(parent);
+ this.generatedValueAnnotation = generatedValueAnnotation;
+ this.specifiedStrategy = this.buildSpecifiedStrategy();
+ this.specifiedGenerator = generatedValueAnnotation.getGenerator();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedStrategy_(this.buildSpecifiedStrategy());
+ this.setSpecifiedGenerator_(this.generatedValueAnnotation.getGenerator());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultStrategy(this.buildDefaultStrategy());
+ this.setDefaultGenerator(this.buildDefaultGenerator());
+ }
+
+
+ // ********** strategy **********
+
+ public GenerationType getStrategy() {
+ return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.defaultStrategy;
+ }
+
+ public GenerationType getSpecifiedStrategy() {
+ return this.specifiedStrategy;
+ }
+
+ public void setSpecifiedStrategy(GenerationType strategy) {
+ this.generatedValueAnnotation.setStrategy(GenerationType.toJavaResourceModel(strategy));
+ this.setSpecifiedStrategy_(strategy);
+ }
+
+ protected void setSpecifiedStrategy_(GenerationType strategy) {
+ GenerationType old = this.specifiedStrategy;
+ this.specifiedStrategy = strategy;
+ this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected GenerationType buildSpecifiedStrategy() {
+ return GenerationType.fromJavaResourceModel(this.generatedValueAnnotation.getStrategy());
+ }
+
+ public GenerationType getDefaultStrategy() {
+ return this.defaultStrategy;
+ }
+
+ protected void setDefaultStrategy(GenerationType strategy) {
+ GenerationType old = this.defaultStrategy;
+ this.defaultStrategy = strategy;
+ this.firePropertyChanged(DEFAULT_STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected GenerationType buildDefaultStrategy() {
+ return DEFAULT_STRATEGY;
+ }
+
+
+ // ********** generator **********
+
+ public String getGenerator() {
+ return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator;
+ }
+
+ public String getSpecifiedGenerator() {
+ return this.specifiedGenerator;
+ }
+
+ public void setSpecifiedGenerator(String generator) {
+ this.generatedValueAnnotation.setGenerator(generator);
+ this.setSpecifiedGenerator_(generator);
+ }
+
+ protected void setSpecifiedGenerator_(String generator) {
+ String old = this.specifiedGenerator;
+ this.specifiedGenerator = generator;
+ this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
+ }
+
+ public String getDefaultGenerator() {
+ return this.defaultGenerator;
+ }
+
+ protected void setDefaultGenerator(String generator) {
+ String old = this.defaultGenerator;
+ this.defaultGenerator = generator;
+ this.firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, old, generator);
+ }
+
+ protected String buildDefaultGenerator() {
+ return null;
+ }
+
+ public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
+ return this.generatedValueAnnotation.getGeneratorTextRange(astRoot);
+ }
+
+
+ // ********** misc **********
+
+ public GeneratedValueAnnotation getGeneratedValueAnnotation() {
+ return this.generatedValueAnnotation;
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.generatorTouches(pos, astRoot)) {
+ return this.javaCandidateGeneratorNames(filter);
+ }
+ return null;
+ }
+
+ protected boolean generatorTouches(int pos, CompilationUnit astRoot) {
+ return this.generatedValueAnnotation.generatorTouches(pos, astRoot);
+ }
+
+ protected Iterator<String> javaCandidateGeneratorNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.candidateGeneratorNames(filter));
+ }
+
+ protected Iterator<String> candidateGeneratorNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateGeneratorNames(), filter);
+ }
+
+ protected Iterator<String> candidateGeneratorNames() {
+ return this.getPersistenceUnit().getUniqueGeneratorNames().iterator();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+
+ String generator = this.getGenerator();
+ if (generator == null) {
+ return;
+ }
+
+ for (Iterator<Generator> stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) {
+ if (generator.equals(stream.next().getName())) {
+ return;
+ }
+ }
+
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME,
+ new String[] {generator},
+ this.getParent(),
+ this.getGeneratorTextRange(astRoot)
+ )
+ );
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.generatedValueAnnotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
new file mode 100644
index 0000000000..65d1ab157d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.java.JavaGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaGeneratorContainer
+ extends AbstractJavaJpaContextNode
+ implements JavaGeneratorContainer
+{
+ protected final Owner owner;
+
+ protected JavaSequenceGenerator sequenceGenerator;
+
+ protected JavaTableGenerator tableGenerator;
+
+
+ public GenericJavaGeneratorContainer(JavaJpaContextNode parent, Owner owner) {
+ super(parent);
+ this.owner = owner;
+ this.sequenceGenerator = this.buildSequenceGenerator();
+ this.tableGenerator = this.buildTableGenerator();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSequenceGenerator();
+ this.syncTableGenerator();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ if (this.sequenceGenerator != null) {
+ this.sequenceGenerator.update();
+ }
+ if (this.tableGenerator != null) {
+ this.tableGenerator.update();
+ }
+ }
+
+
+ // ********** sequence generator **********
+
+ public JavaSequenceGenerator getSequenceGenerator() {
+ return this.sequenceGenerator;
+ }
+
+ public JavaSequenceGenerator addSequenceGenerator() {
+ if (this.sequenceGenerator != null) {
+ throw new IllegalStateException("sequence generator already exists: " + this.sequenceGenerator); //$NON-NLS-1$
+ }
+ SequenceGeneratorAnnotation annotation = this.buildSequenceGeneratorAnnotation();
+ JavaSequenceGenerator generator = this.buildSequenceGenerator(annotation);
+ this.setSequenceGenerator(generator);
+ return generator;
+ }
+
+ protected SequenceGeneratorAnnotation buildSequenceGeneratorAnnotation() {
+ return (SequenceGeneratorAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeSequenceGenerator() {
+ if (this.sequenceGenerator == null) {
+ throw new IllegalStateException("sequence generator does not exist"); //$NON-NLS-1$
+ }
+ this.owner.getResourceAnnotatedElement().removeAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
+ this.setSequenceGenerator(null);
+ }
+
+ protected JavaSequenceGenerator buildSequenceGenerator() {
+ SequenceGeneratorAnnotation annotation = this.getSequenceGeneratorAnnotation();
+ return (annotation == null) ? null : this.buildSequenceGenerator(annotation);
+ }
+
+ protected SequenceGeneratorAnnotation getSequenceGeneratorAnnotation() {
+ return (SequenceGeneratorAnnotation) this.owner.getResourceAnnotatedElement().getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
+ }
+
+ protected JavaSequenceGenerator buildSequenceGenerator(SequenceGeneratorAnnotation sequenceGeneratorAnnotation) {
+ return this.getJpaFactory().buildJavaSequenceGenerator(this, sequenceGeneratorAnnotation);
+ }
+
+ protected void syncSequenceGenerator() {
+ SequenceGeneratorAnnotation annotation = this.getSequenceGeneratorAnnotation();
+ if (annotation == null) {
+ if (this.sequenceGenerator != null) {
+ this.setSequenceGenerator(null);
+ }
+ } else {
+ if ((this.sequenceGenerator != null) && (this.sequenceGenerator.getGeneratorAnnotation() == annotation)) {
+ this.sequenceGenerator.synchronizeWithResourceModel();
+ } else {
+ this.setSequenceGenerator(this.buildSequenceGenerator(annotation));
+ }
+ }
+ }
+
+ protected void setSequenceGenerator(JavaSequenceGenerator sequenceGenerator) {
+ JavaSequenceGenerator old = this.sequenceGenerator;
+ this.sequenceGenerator = sequenceGenerator;
+ this.firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, old, sequenceGenerator);
+ }
+
+
+ // ********** table generator **********
+
+ public JavaTableGenerator getTableGenerator() {
+ return this.tableGenerator;
+ }
+
+ public JavaTableGenerator addTableGenerator() {
+ if (this.tableGenerator != null) {
+ throw new IllegalStateException("table generator already exists: " + this.tableGenerator); //$NON-NLS-1$
+ }
+ TableGeneratorAnnotation annotation = this.buildTableGeneratorAnnotation();
+ JavaTableGenerator generator = this.buildTableGenerator(annotation);
+ this.setTableGenerator(generator);
+ return generator;
+ }
+
+ protected TableGeneratorAnnotation buildTableGeneratorAnnotation() {
+ return (TableGeneratorAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeTableGenerator() {
+ if (this.tableGenerator == null) {
+ throw new IllegalStateException("table generator does not exist"); //$NON-NLS-1$
+ }
+ this.owner.getResourceAnnotatedElement().removeAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
+ this.setTableGenerator(null);
+ }
+
+ protected JavaTableGenerator buildTableGenerator() {
+ TableGeneratorAnnotation annotation = this.getTableGeneratorAnnotation();
+ return (annotation == null) ? null : this.buildTableGenerator(annotation);
+ }
+
+ protected TableGeneratorAnnotation getTableGeneratorAnnotation() {
+ return (TableGeneratorAnnotation) this.owner.getResourceAnnotatedElement().getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME);
+ }
+
+ protected JavaTableGenerator buildTableGenerator(TableGeneratorAnnotation tableGeneratorAnnotation) {
+ return this.getJpaFactory().buildJavaTableGenerator(this, tableGeneratorAnnotation);
+ }
+
+ protected void syncTableGenerator() {
+ TableGeneratorAnnotation annotation = this.getTableGeneratorAnnotation();
+ if (annotation == null) {
+ if (this.tableGenerator != null) {
+ this.setTableGenerator(null);
+ }
+ } else {
+ if ((this.tableGenerator != null) && (this.tableGenerator.getGeneratorAnnotation() == annotation)) {
+ this.tableGenerator.synchronizeWithResourceModel();
+ } else {
+ this.setTableGenerator(this.buildTableGenerator(annotation));
+ }
+ }
+ }
+
+ protected void setTableGenerator(JavaTableGenerator tableGenerator) {
+ JavaTableGenerator old = this.tableGenerator;
+ this.tableGenerator = tableGenerator;
+ this.firePropertyChanged(TABLE_GENERATOR_PROPERTY, old, tableGenerator);
+ }
+
+
+ // ********** code completion **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.tableGenerator != null) {
+ result = this.tableGenerator.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ if (this.sequenceGenerator != null) {
+ result = this.sequenceGenerator.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateGenerators(messages, astRoot);
+ }
+
+ protected void validateGenerators(List<IMessage> messages, CompilationUnit astRoot) {
+ for (JavaGenerator localGenerator : this.getGenerators()) {
+ String name = localGenerator.getName();
+ if (StringTools.stringIsEmpty(name)){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.GENERATOR_NAME_UNDEFINED,
+ new String[] {},
+ localGenerator,
+ localGenerator.getNameTextRange(astRoot)
+ )
+ );
+ } else {
+ List<String> reportedNames = new ArrayList<String>();
+ for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) {
+ if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.GENERATOR_DUPLICATE_NAME,
+ new String[] {name},
+ localGenerator,
+ localGenerator.getNameTextRange(astRoot)
+ )
+ );
+ reportedNames.add(name);
+ }
+ }
+ }
+ }
+ }
+
+ protected Iterable<JavaGenerator> getGenerators() {
+ ArrayList<JavaGenerator> generators = new ArrayList<JavaGenerator>();
+ this.addGeneratorsTo(generators);
+ return generators;
+ }
+
+ protected void addGeneratorsTo(ArrayList<JavaGenerator> generators) {
+ if (this.sequenceGenerator != null) {
+ generators.add(this.sequenceGenerator);
+ }
+ if (this.tableGenerator != null) {
+ generators.add(this.tableGenerator);
+ }
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.owner.getResourceAnnotatedElement().getTextRange(astRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java
new file mode 100644
index 0000000000..7f1aca7b89
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaIdMapping;
+
+
+public class GenericJavaIdMapping
+ extends AbstractJavaIdMapping
+{
+ public GenericJavaIdMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
new file mode 100644
index 0000000000..de4e5b0c85
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseColumn;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Java join column
+ */
+public class GenericJavaJoinColumn
+ extends AbstractJavaBaseColumn<JoinColumnAnnotation, JavaJoinColumn.Owner>
+ implements JavaJoinColumn
+{
+ /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */
+ protected /* final */ JoinColumnAnnotation columnAnnotation; // never null
+
+ protected String specifiedReferencedColumnName;
+ protected String defaultReferencedColumnName;
+
+
+ public GenericJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner) {
+ this(parent, owner, null);
+ }
+
+ public GenericJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner, JoinColumnAnnotation columnAnnotation) {
+ super(parent, owner, columnAnnotation);
+ this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
+ }
+
+
+ // ********** column annotation **********
+
+ @Override
+ public JoinColumnAnnotation getColumnAnnotation() {
+ return this.columnAnnotation;
+ }
+
+ @Override
+ protected void setColumnAnnotation(JoinColumnAnnotation columnAnnotation) {
+ this.columnAnnotation = columnAnnotation;
+ }
+
+ @Override
+ protected void removeColumnAnnotation() {
+ // we don't remove a join column annotation when it is empty
+ }
+
+
+ // ********** referenced column name **********
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ public void setSpecifiedReferencedColumnName(String name) {
+ if (this.valuesAreDifferent(this.specifiedReferencedColumnName, name)) {
+ this.getColumnAnnotation().setReferencedColumnName(name);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedReferencedColumnName_(name);
+ }
+ }
+
+ protected void setSpecifiedReferencedColumnName_(String name) {
+ String old = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = name;
+ this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedReferencedColumnName() {
+ return this.getColumnAnnotation().getReferencedColumnName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String name) {
+ String old = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = name;
+ this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultReferencedColumnName() {
+ return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner);
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.getColumnAnnotation().getReferencedColumnNameTextRange(astRoot);
+ return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot);
+ }
+
+
+ // ********** database stuff **********
+
+ public Table getReferencedColumnDbTable() {
+ return this.owner.getReferencedColumnDbTable();
+ }
+
+ protected Column getReferencedDbColumn() {
+ Table table = this.getReferencedColumnDbTable();
+ return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
+ }
+
+ public boolean referencedColumnIsResolved() {
+ return this.getReferencedDbColumn() != null;
+ }
+
+
+ // ********** misc **********
+
+ public void initializeFrom(ReadOnlyJoinColumn oldColumn) {
+ super.initializeFrom(oldColumn);
+ this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName());
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinColumn virtualColumn) {
+ super.initializeFromVirtual(virtualColumn);
+ this.setSpecifiedReferencedColumnName(virtualColumn.getReferencedColumnName());
+ }
+
+ public boolean isDefault() {
+ return this.owner.joinColumnIsDefault(this);
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return MappingTools.buildJoinColumnDefaultName(this, this.owner);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.referencedColumnNameTouches(pos, astRoot)) {
+ return this.getJavaCandidateReferencedColumnNames(filter).iterator();
+ }
+ return null;
+ }
+
+ protected boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.getColumnAnnotation().referencedColumnNameTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateReferencedColumnNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateReferencedColumnNames(filter));
+ }
+
+ protected Iterable<String> getCandidateReferencedColumnNames(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateReferencedColumnNames(), filter);
+ }
+
+ protected Iterable<String> getCandidateReferencedColumnNames() {
+ Table table = this.owner.getReferencedColumnDbTable();
+ return (table != null) ? table.getSortedColumnIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaJoinColumnTextRangeResolver(this, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java
new file mode 100644
index 0000000000..cc6254661b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java
@@ -0,0 +1,496 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java join table
+ * <p>
+ * Note: The <code>JoinTable</code> annotation is one of only 2 annotations that
+ * can be nested outside of an array (i.e. in an <code>AssociationOverride</code>
+ * annotation); the other is {@link GenericJavaColumn Column}.
+ */
+public class GenericJavaJoinTable
+ extends GenericJavaReferenceTable<JoinTableAnnotation>
+ implements JavaJoinTable
+{
+ protected final Vector<JavaJoinColumn> specifiedInverseJoinColumns = new Vector<JavaJoinColumn>();
+ protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final JavaJoinColumn.Owner inverseJoinColumnOwner;
+
+ protected JavaJoinColumn defaultInverseJoinColumn;
+
+
+ public GenericJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Owner owner) {
+ super(parent, owner);
+ this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
+ this.initializeSpecifiedInverseJoinColumns();
+ }
+
+ @Override
+ protected JavaJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedInverseJoinColumns();
+ if (this.defaultInverseJoinColumn != null) {
+ this.defaultInverseJoinColumn.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedInverseJoinColumns());
+ this.updateDefaultInverseJoinColumn();
+ }
+
+
+ // ********** table annotation **********
+
+ @Override
+ public JoinTableAnnotation getTableAnnotation() {
+ return this.getRelationshipStrategy().getJoinTableAnnotation();
+ }
+
+ @Override
+ protected void removeTableAnnotation() {
+ // we don't remove a join table annotation when it is empty
+ }
+
+
+ // ********** inverse join columns **********
+
+ public ListIterator<JavaJoinColumn> inverseJoinColumns() {
+ return this.getInverseJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaJoinColumn> getInverseJoinColumns() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
+ }
+
+ public int inverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.defaultInverseJoinColumnsSize();
+ }
+
+ public void convertDefaultToSpecifiedInverseJoinColumn() {
+ MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this);
+ }
+
+
+ // ********** specified inverse join columns **********
+
+ public ListIterator<JavaJoinColumn> specifiedInverseJoinColumns() {
+ return this.getSpecifiedInverseJoinColumns().iterator();
+ }
+
+ public ListIterable<JavaJoinColumn> getSpecifiedInverseJoinColumns() {
+ return new LiveCloneListIterable<JavaJoinColumn>(this.specifiedInverseJoinColumns);
+ }
+
+ public int specifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedInverseJoinColumns() {
+ return this.specifiedInverseJoinColumns.size() != 0;
+ }
+
+ public JavaJoinColumn getSpecifiedInverseJoinColumn(int index) {
+ return this.specifiedInverseJoinColumns.get(index);
+ }
+
+ public JavaJoinColumn addSpecifiedInverseJoinColumn() {
+ return this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size());
+ }
+
+ public JavaJoinColumn addSpecifiedInverseJoinColumn(int index) {
+ JoinColumnAnnotation annotation = this.getTableAnnotation().addInverseJoinColumn(index);
+ return this.addSpecifiedInverseJoinColumn_(index, annotation);
+ }
+
+ public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
+ this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedInverseJoinColumn(int index) {
+ this.getTableAnnotation().removeInverseJoinColumn(index);
+ this.removeTableAnnotationIfUnset();
+ this.removeSpecifiedInverseJoinColumn_(index);
+ }
+
+ protected void removeSpecifiedInverseJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
+ this.getTableAnnotation().moveInverseJoinColumn(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void clearSpecifiedInverseJoinColumns() {
+ // for now, we have to remove annotations one at a time...
+ for (int i = this.specifiedInverseJoinColumns.size(); i-- > 0; ) {
+ this.removeSpecifiedInverseJoinColumn(i);
+ }
+ }
+
+ protected void initializeSpecifiedInverseJoinColumns() {
+ for (JoinColumnAnnotation joinColumnAnnotation : this.getInverseJoinColumnAnnotations()) {
+ this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(joinColumnAnnotation));
+ }
+ }
+
+ protected void syncSpecifiedInverseJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedInverseJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumnAnnotation> getInverseJoinColumnAnnotations() {
+ return CollectionTools.iterable(this.getTableAnnotation().inverseJoinColumns());
+ }
+
+ protected void moveSpecifiedInverseJoinColumn_(int index, JavaJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaJoinColumn addSpecifiedInverseJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) {
+ JavaJoinColumn joinColumn = this.buildInverseJoinColumn(joinColumnAnnotation);
+ this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedInverseJoinColumn_(JavaJoinColumn joinColumn) {
+ this.removeSpecifiedInverseJoinColumn_(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ }
+
+ /**
+ * specified inverse join column container adapter
+ */
+ protected class SpecifiedInverseJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaJoinColumn, JoinColumnAnnotation>
+ {
+ public Iterable<JavaJoinColumn> getContextElements() {
+ return GenericJavaJoinTable.this.getSpecifiedInverseJoinColumns();
+ }
+ public Iterable<JoinColumnAnnotation> getResourceElements() {
+ return GenericJavaJoinTable.this.getInverseJoinColumnAnnotations();
+ }
+ public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
+ return contextElement.getColumnAnnotation();
+ }
+ public void moveContextElement(int index, JavaJoinColumn element) {
+ GenericJavaJoinTable.this.moveSpecifiedInverseJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, JoinColumnAnnotation resourceElement) {
+ GenericJavaJoinTable.this.addSpecifiedInverseJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(JavaJoinColumn element) {
+ GenericJavaJoinTable.this.removeSpecifiedInverseJoinColumn_(element);
+ }
+ }
+
+ protected JavaJoinColumn.Owner buildInverseJoinColumnOwner() {
+ return new InverseJoinColumnOwner();
+ }
+
+
+ // ********** default inverse join column **********
+
+ public JavaJoinColumn getDefaultInverseJoinColumn() {
+ return this.defaultInverseJoinColumn;
+ }
+
+ protected void setDefaultInverseJoinColumn(JavaJoinColumn joinColumn) {
+ JavaJoinColumn old = this.defaultInverseJoinColumn;
+ this.defaultInverseJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn);
+ }
+
+ protected ListIterable<JavaJoinColumn> getDefaultInverseJoinColumns() {
+ return (this.defaultInverseJoinColumn != null) ?
+ new SingleElementListIterable<JavaJoinColumn>(this.defaultInverseJoinColumn) :
+ EmptyListIterable.<JavaJoinColumn>instance();
+ }
+
+ protected int defaultInverseJoinColumnsSize() {
+ return (this.defaultInverseJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultInverseJoinColumn() {
+ if (this.buildsDefaultInverseJoinColumn()) {
+ if (this.defaultInverseJoinColumn == null) {
+ this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(new NullJoinColumnAnnotation(this.getTableAnnotation())));
+ } else {
+ this.defaultInverseJoinColumn.update();
+ }
+ } else {
+ this.setDefaultInverseJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultInverseJoinColumn() {
+ return ! this.hasSpecifiedInverseJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaJoinTableRelationshipStrategy getParent() {
+ return (JavaJoinTableRelationshipStrategy) super.getParent();
+ }
+
+ protected JavaJoinTableRelationshipStrategy getRelationshipStrategy() {
+ return this.getParent();
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return this.getRelationshipStrategy().getJoinTableDefaultName();
+ }
+
+ public void initializeFrom(ReadOnlyJoinTable oldTable) {
+ super.initializeFrom(oldTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedInverseJoinColumns())) {
+ this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn);
+ }
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) {
+ super.initializeFromVirtual(virtualTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.inverseJoinColumns())) {
+ this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn);
+ }
+ }
+
+ protected JavaJoinColumn buildInverseJoinColumn(JoinColumnAnnotation joinColumnAnnotation) {
+ return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumnAnnotation);
+ }
+
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getRelationshipStrategy().getRelationship().getMapping();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaJoinColumn column : CollectionTools.iterable(this.inverseJoinColumns())) {
+ result = column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected void validateJoinColumns(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validateJoinColumns(messages, reporter, astRoot);
+ this.validateJoinColumns(this.inverseJoinColumns(), messages, reporter, astRoot);
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.getRelationshipStrategy().validatesAgainstDatabase();
+ }
+
+
+ // ********** join column owners **********
+
+ /**
+ * just a little common behavior
+ */
+ protected abstract class AbstractJoinColumnOwner
+ implements JavaJoinColumn.Owner
+ {
+ protected AbstractJoinColumnOwner() {
+ super();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaJoinTable.this.getRelationshipStrategy().getRelationship().getTypeMapping();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return GenericJavaJoinTable.this.getPersistentAttribute();
+ }
+
+ /**
+ * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
+ */
+ public String getDefaultColumnName() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * If there is a specified table name it needs to be the same
+ * the default table name. the table is always the join table
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
+ }
+
+ /**
+ * the join column can only be on the join table itself
+ */
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return Tools.valuesAreEqual(GenericJavaJoinTable.this.getName(), tableName) ?
+ GenericJavaJoinTable.this.getDbTable() :
+ null;
+ }
+
+ /**
+ * by default, the join column is, obviously, in the join table;
+ * not sure whether it can be anywhere else...
+ */
+ public String getDefaultTableName() {
+ return GenericJavaJoinTable.this.getName();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaJoinTable.this.getValidationTextRange(astRoot);
+ }
+ }
+
+
+ /**
+ * owner for "back-pointer" join columns;
+ * these point at the source/owning entity
+ */
+ protected class JoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericJavaJoinTable.this.getRelationshipStrategy().getRelationship().getEntity();
+ }
+
+ public String getAttributeName() {
+ return MappingTools.getTargetAttributeName(GenericJavaJoinTable.this.getRelationshipMapping());
+ }
+
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ return this.getTypeMapping().getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericJavaJoinTable.this.defaultJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaJoinTable.this.joinColumnsSize();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return GenericJavaJoinTable.this.getParent().buildJoinTableJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+
+
+ /**
+ * owner for "forward-pointer" join columns;
+ * these point at the target/inverse entity
+ */
+ protected class InverseJoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected InverseJoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ RelationshipMapping relationshipMapping = GenericJavaJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
+ }
+
+ public String getAttributeName() {
+ RelationshipMapping relationshipMapping = GenericJavaJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getName();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ Entity relationshipTarget = this.getRelationshipTarget();
+ return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericJavaJoinTable.this.defaultInverseJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaJoinTable.this.inverseJoinColumnsSize();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return GenericJavaJoinTable.this.getParent().buildJoinTableInverseJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java
new file mode 100644
index 0000000000..9ccb2d3b51
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.LobConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+
+public class GenericJavaLobConverter
+ extends AbstractJavaConverter
+ implements JavaLobConverter
+{
+ protected final LobAnnotation lobAnnotation;
+
+ public GenericJavaLobConverter(JavaAttributeMapping parent, LobAnnotation lobAnnotation) {
+ super(parent);
+ this.lobAnnotation = lobAnnotation;
+ }
+
+
+ // ********** misc **********
+
+ public Class<? extends Converter> getType() {
+ return LobConverter.class;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return LobAnnotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.lobAnnotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java
new file mode 100644
index 0000000000..935834c6d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMapping;
+
+public class GenericJavaManyToManyMapping
+ extends AbstractJavaManyToManyMapping
+{
+ public GenericJavaManyToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java
new file mode 100644
index 0000000000..4cdc288501
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMapping;
+
+public class GenericJavaManyToOneMapping
+ extends AbstractJavaManyToOneMapping
+{
+ public GenericJavaManyToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java
new file mode 100644
index 0000000000..36d734b5b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaMappedSuperclass;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+
+/**
+ * Java mapped superclass
+ */
+public class GenericJavaMappedSuperclass
+ extends AbstractJavaMappedSuperclass
+{
+ public GenericJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..f411dfbf43
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.InverseJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+public class GenericJavaMappingJoinTableRelationshipStrategy
+ extends AbstractJavaJoinTableRelationshipStrategy
+{
+ public GenericJavaMappingJoinTableRelationshipStrategy(JavaMappingJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** join table annotation **********
+
+ public JoinTableAnnotation getJoinTableAnnotation() {
+ return (JoinTableAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected JoinTableAnnotation addJoinTableAnnotation() {
+ return (JoinTableAnnotation) this.getResourcePersistentAttribute().addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected void removeJoinTableAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** misc **********
+
+ protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getRelationship().getMapping().getResourcePersistentAttribute();
+ }
+
+ @Override
+ public JavaMappingJoinTableRelationship getParent() {
+ return (JavaMappingJoinTableRelationship) super.getParent();
+ }
+
+ @Override
+ public JavaMappingJoinTableRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ public boolean isOverridable() {
+ return this.getJpaPlatformVariation().isJoinTableOverridable();
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.getRelationshipMapping().validatesAgainstDatabase();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getRelationship().getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return new JoinTableValidator((JoinTable) table, textRangeResolver);
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator(column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new InverseJoinColumnValidator(column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
new file mode 100644
index 0000000000..feaee86f38
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+
+/**
+ * <code>orm.xml</code> named native query
+ */
+public class GenericJavaNamedNativeQuery
+ extends AbstractJavaQuery<NamedNativeQueryAnnotation>
+ implements JavaNamedNativeQuery
+{
+ protected String resultClass;
+
+ protected String resultSetMapping;
+
+
+ public GenericJavaNamedNativeQuery(JavaJpaContextNode parent, NamedNativeQueryAnnotation queryAnnotation) {
+ super(parent, queryAnnotation);
+ this.resultClass = queryAnnotation.getResultClass();
+ this.resultSetMapping = queryAnnotation.getResultSetMapping();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setResultClass_(this.queryAnnotation.getResultClass());
+ this.setResultSetMapping_(this.queryAnnotation.getResultSetMapping());
+ }
+
+
+ // ********** result class **********
+
+ public String getResultClass() {
+ return this.resultClass;
+ }
+
+ public void setResultClass(String resultClass) {
+ this.queryAnnotation.setResultClass(resultClass);
+ this.setResultClass_(resultClass);
+ }
+
+ protected void setResultClass_(String resultClass) {
+ String old = this.resultClass;
+ this.resultClass = resultClass;
+ this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
+ }
+
+ public char getResultClassEnclosingTypeSeparator() {
+ return '.';
+ }
+
+
+ // ********** result set mapping **********
+
+ public String getResultSetMapping() {
+ return this.resultSetMapping;
+ }
+
+ public void setResultSetMapping(String resultSetMapping) {
+ this.queryAnnotation.setResultSetMapping(resultSetMapping);
+ this.setResultSetMapping_(resultSetMapping);
+ }
+
+ protected void setResultSetMapping_(String resultSetMapping) {
+ String old = this.resultSetMapping;
+ this.resultSetMapping = resultSetMapping;
+ this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
new file mode 100644
index 0000000000..8c22d994ed
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+
+/**
+ * Java named query
+ */
+public class GenericJavaNamedQuery
+ extends AbstractJavaQuery<NamedQueryAnnotation>
+ implements JavaNamedQuery
+{
+ public GenericJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation queryAnnotation) {
+ super(parent, queryAnnotation);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
new file mode 100644
index 0000000000..864603a34e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * null mapping used when an attribute's default mapping cannot be determined
+ */
+public class GenericJavaNullAttributeMapping
+ extends AbstractJavaAttributeMapping<Annotation>
+{
+ public GenericJavaNullAttributeMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return null;
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ public MetamodelField getMetamodelField() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java
new file mode 100644
index 0000000000..bf84573cf3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMapping;
+
+public class GenericJavaOneToManyMapping
+ extends AbstractJavaOneToManyMapping
+{
+ public GenericJavaOneToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java
new file mode 100644
index 0000000000..c2f6397a6c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMapping;
+
+public class GenericJavaOneToOneMapping
+ extends AbstractJavaOneToOneMapping
+{
+ public GenericJavaOneToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
new file mode 100644
index 0000000000..653657946e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
@@ -0,0 +1,486 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.OrderColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java ordering
+ * <p>
+ * <strong>NB:</strong> Setting any flag to <code>false</code> (or setting the
+ * specified "order by" to <code>null</code>) can be a bit unpredictable. The
+ * intent is to set a flag to <code>true</code> (or set the specified "order by"
+ * to a non-<code>null</code> value).
+ * <p>
+ * <strong>(JPA 2.0 only) NB:</strong> If both the "order by" and the "order
+ * column" annotations are present (which is prohibited by the JPA spec),
+ * both are ignored.
+ */
+public class GenericJavaOrderable
+ extends AbstractJavaJpaContextNode
+ implements JavaOrderable2_0
+{
+ protected String specifiedOrderBy;
+ protected boolean noOrdering = false;
+ protected boolean pkOrdering = false;
+ protected boolean customOrdering = false;
+
+ // JPA 2.0
+ protected final Owner owner; // this is null for JPA 1.0 mappings
+ protected boolean orderColumnOrdering = false;
+ protected final JavaOrderColumn2_0 orderColumn;
+
+
+ /**
+ * JPA 1.0
+ */
+ public GenericJavaOrderable(JavaAttributeMapping parent) {
+ this(parent, null);
+ }
+
+ /**
+ * JPA 2.0
+ */
+ public GenericJavaOrderable(JavaAttributeMapping parent, Owner owner) {
+ super(parent);
+ this.specifiedOrderBy = this.buildSpecifiedOrderBy();
+ this.noOrdering = this.buildNoOrdering();
+ this.pkOrdering = this.buildPkOrdering();
+ this.customOrdering = this.buildCustomOrdering();
+
+ this.owner = owner;
+ this.orderColumnOrdering = this.buildOrderColumnOrdering();
+ this.orderColumn = this.buildOrderColumn();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+
+ this.setSpecifiedOrderBy_(this.buildSpecifiedOrderBy());
+ this.setNoOrdering_(this.buildNoOrdering());
+ this.setPkOrdering_(this.buildPkOrdering());
+ this.setCustomOrdering_(this.buildCustomOrdering());
+
+ this.setOrderColumnOrdering_(this.buildOrderColumnOrdering());
+ this.orderColumn.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.orderColumn.update();
+ }
+
+
+ // ********** specified order by **********
+
+ public String getSpecifiedOrderBy() {
+ return this.specifiedOrderBy;
+ }
+
+ public void setSpecifiedOrderBy(String orderBy) {
+ if (orderBy != null) {
+ this.removeOrderColumnAnnotation();
+ this.getOrderByAnnotationForUpdate().setValue(orderBy);
+
+ this.setSpecifiedOrderBy_(orderBy);
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(true);
+ this.setOrderColumnOrdering_(false);
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setSpecifiedOrderBy_(String orderBy) {
+ String old = this.specifiedOrderBy;
+ this.specifiedOrderBy = orderBy;
+ this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
+ }
+
+ protected String buildSpecifiedOrderBy() {
+ if (this.orderColumnAnnotationIsPresent()) {
+ return null;
+ }
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ return (orderByAnnotation == null) ? null : orderByAnnotation.getValue();
+ }
+
+
+ // ********** no ordering **********
+
+ public boolean isNoOrdering() {
+ return this.noOrdering;
+ }
+
+ public void setNoOrdering(boolean noOrdering) {
+ if (noOrdering) {
+ this.removeOrderColumnAnnotation();
+ if (this.getOrderByAnnotation() != null) {
+ this.removeOrderByAnnotation();
+ }
+
+ this.setSpecifiedOrderBy_(null);
+ this.setNoOrdering_(true);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(false);
+ } else {
+ this.setPkOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setNoOrdering_(boolean noOrdering) {
+ boolean old = this.noOrdering;
+ this.noOrdering = noOrdering;
+ this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
+ }
+
+ protected boolean buildNoOrdering() {
+ return this.isJpa2_0Compatible() ? this.buildNoOrdering2_0() : this.buildNoOrdering1_0();
+ }
+
+ /**
+ * both annotations are missing <em>or</em> both are present
+ */
+ protected boolean buildNoOrdering2_0() {
+ boolean orderByMissing = (this.getOrderByAnnotation() == null);
+ boolean orderByPresent = ! orderByMissing;
+ boolean orderColumnMissing = (this.getOrderColumnAnnotation() == null);
+ boolean orderColumnPresent = ! orderColumnMissing;
+ return (orderByMissing && orderColumnMissing) || (orderByPresent && orderColumnPresent);
+ }
+
+ /**
+ * the order-by annotation is missing
+ */
+ protected boolean buildNoOrdering1_0() {
+ return this.getOrderByAnnotation() == null;
+ }
+
+
+ // ********** pk ordering **********
+
+ public boolean isPkOrdering() {
+ return this.pkOrdering;
+ }
+
+ public void setPkOrdering(boolean pkOrdering) {
+ if (pkOrdering) {
+ this.removeOrderColumnAnnotation();
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ if (orderByAnnotation == null) {
+ this.addOrderByAnnotation();
+ } else {
+ orderByAnnotation.setValue(null);
+ }
+
+ this.setSpecifiedOrderBy_(null);
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(true);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(false);
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setPkOrdering_(boolean pkOrdering) {
+ boolean old = this.pkOrdering;
+ this.pkOrdering = pkOrdering;
+ this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
+ }
+
+ /**
+ * the order-by annotation is present but no value specified
+ */
+ protected boolean buildPkOrdering() {
+ if (this.orderColumnAnnotationIsPresent()) {
+ return false;
+ }
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ return (orderByAnnotation != null) && (orderByAnnotation.getValue() == null);
+ }
+
+
+ // ********** custom ordering **********
+
+ public boolean isCustomOrdering() {
+ return this.customOrdering;
+ }
+
+ public void setCustomOrdering(boolean customOrdering) {
+ if (customOrdering) {
+ this.setSpecifiedOrderBy(""); //$NON-NLS-1$
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setCustomOrdering_(boolean customOrdering) {
+ boolean old = this.customOrdering;
+ this.customOrdering = customOrdering;
+ this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ }
+
+ /**
+ * the order-by annotation is present and it has a specified value
+ */
+ protected boolean buildCustomOrdering() {
+ if (this.orderColumnAnnotationIsPresent()) {
+ return false;
+ }
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ return (orderByAnnotation != null) && (orderByAnnotation.getValue() != null);
+ }
+
+
+ // ********** order column ordering **********
+
+ public boolean isOrderColumnOrdering() {
+ return this.orderColumnOrdering;
+ }
+
+ public void setOrderColumnOrdering(boolean orderColumnOrdering) {
+ if (orderColumnOrdering) {
+ this.removeOrderByAnnotation();
+ if (this.getOrderColumnAnnotation() == null) {
+ this.addOrderColumnAnnotation();
+ }
+
+ this.setSpecifiedOrderBy_(null);
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(true);
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
+ boolean old = this.orderColumnOrdering;
+ this.orderColumnOrdering = orderColumnOrdering;
+ this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
+ }
+
+ /**
+ * JPA 2.0 only;
+ * the order column annotation is present <em>and</em>
+ * the order-by annotation is missing
+ */
+ protected boolean buildOrderColumnOrdering() {
+ return this.orderColumnAnnotationIsPresent() &&
+ (this.getOrderByAnnotation() == null);
+ }
+
+
+ // ********** order column **********
+
+ public JavaOrderColumn2_0 getOrderColumn() {
+ return this.orderColumn;
+ }
+
+ protected JavaOrderColumn2_0 buildOrderColumn() {
+ JavaNamedColumn.Owner columnOwner = new OrderColumnOwner();
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildJavaOrderColumn(this, columnOwner) :
+ new GenericJavaOrderColumn2_0(this, columnOwner);
+ }
+
+
+ // ********** order by annotation **********
+
+ protected OrderByAnnotation getOrderByAnnotation() {
+ return (OrderByAnnotation) this.getResourcePersistentAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ }
+
+ protected OrderByAnnotation getOrderByAnnotationForUpdate() {
+ OrderByAnnotation annotation = this.getOrderByAnnotation();
+ return (annotation != null) ? annotation : this.addOrderByAnnotation();
+ }
+
+ protected OrderByAnnotation addOrderByAnnotation() {
+ return (OrderByAnnotation) this.getResourcePersistentAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removeOrderByAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** order column annotation **********
+
+ protected OrderColumn2_0Annotation getOrderColumnAnnotation() {
+ return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+ /**
+ * NB: Only return <code>true</code> for JPA 2.0 mappings.
+ */
+ protected boolean orderColumnAnnotationIsPresent() {
+ return this.isJpa2_0Compatible() && (this.getOrderColumnAnnotation() != null);
+ }
+
+ protected OrderColumn2_0Annotation addOrderColumnAnnotation() {
+ return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected void removeOrderColumnAnnotation() {
+ if (this.orderColumnAnnotationIsPresent()) {
+ this.removeOrderColumnAnnotation_();
+ }
+ }
+
+ protected void removeOrderColumnAnnotation_() {
+ this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ protected JavaAttributeMapping getAttributeMapping() {
+ return this.getParent();
+ }
+
+ protected JavaPersistentAttribute getPersistentAttribute() {
+ return this.getAttributeMapping().getPersistentAttribute();
+ }
+
+ public JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getPersistentAttribute().getResourcePersistentAttribute();
+ }
+
+ // JPA 2.0 only
+ public String getDefaultTableName() {
+ return this.owner.getTableName();
+ }
+
+ // JPA 2.0 only
+ protected Table resolveDbTable(String tableName) {
+ return this.owner.resolveDbTable(tableName);
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return this.orderColumn.javaCompletionProposals(pos, filter, astRoot);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.getOrderByAnnotationTextRange(astRoot);
+ return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot);
+ }
+
+ protected TextRange getOrderByAnnotationTextRange(CompilationUnit astRoot) {
+ OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
+ return (orderByAnnotation == null) ? null : orderByAnnotation.getTextRange(astRoot);
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ if (this.orderColumnAnnotationIsPresent() && (this.getOrderByAnnotation() != null)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED,
+ new String[] {this.getPersistentAttribute().getName()},
+ this.getAttributeMapping(),
+ this.getOrderByAnnotationTextRange(astRoot)
+ )
+ );
+ }
+ if (this.orderColumnOrdering) {
+ //TODO validation message if type is not List
+ this.orderColumn.validate(messages, reporter, astRoot);
+ }
+ }
+
+
+ // ********** order column owner (JPA 2.0) **********
+
+ protected class OrderColumnOwner
+ implements JavaNamedColumn.Owner
+ {
+ public String getDefaultTableName() {
+ return GenericJavaOrderable.this.getDefaultTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericJavaOrderable.this.resolveDbTable(tableName);
+ }
+
+ public String getDefaultColumnName() {
+ return this.getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getPersistentAttribute().getOwningTypeMapping();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaOrderable.this.getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new OrderColumnValidator((OrderColumn2_0) column, textRangeResolver);
+ }
+
+ protected JavaPersistentAttribute getPersistentAttribute() {
+ return GenericJavaOrderable.this.getPersistentAttribute();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
new file mode 100644
index 0000000000..e6804dbb4f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaOverrideJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOverrideJoinTableRelationshipStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideRelationship2_0;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaOverrideRelationship
+ extends AbstractJavaJpaContextNode
+ implements JavaOverrideRelationship2_0
+{
+ protected JavaRelationshipStrategy strategy;
+
+ protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy;
+
+ // JPA 2.0
+ protected final JavaJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericJavaOverrideRelationship(JavaAssociationOverride parent) {
+ super(parent);
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setStrategy(this.buildStrategy());
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ public JavaRelationshipStrategy getStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(JavaRelationshipStrategy strategy) {
+ JavaRelationshipStrategy old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected JavaRelationshipStrategy buildStrategy() {
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
+ return this.joinColumnStrategy;
+ }
+ return this.joinTableStrategy;
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** join column strategy **********
+
+ public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ this.joinColumnStrategy.addStrategy();
+ this.joinTableStrategy.removeStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return false;
+ }
+
+ protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericJavaOverrideJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public JavaJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public void setStrategyToJoinTable() {
+ this.joinTableStrategy.addStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return this.isVirtual() && this.strategyIsJoinTable();
+ }
+
+ protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return this.isJpa2_0Compatible() ?
+ new GenericJavaOverrideJoinTableRelationshipStrategy2_0(this) :
+ new NullJavaJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeFrom(ReadOnlyRelationship oldRelationship) {
+ oldRelationship.initializeOn(this);
+ }
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ }
+
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ // NOP
+ }
+
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+ public void initializeFromVirtual(ReadOnlyOverrideRelationship virtualRelationship) {
+ virtualRelationship.initializeOnSpecified(this);
+ }
+
+ public void initializeOnSpecified(OverrideRelationship specifiedRelationship) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void initializeFromVirtualJoinTableRelationship(ReadOnlyJoinTableRelationship virtualRelationship) {
+ this.joinTableStrategy.initializeFromVirtual(virtualRelationship.getJoinTableStrategy());
+ }
+
+ public void initializeFromVirtualJoinColumnRelationship(ReadOnlyJoinColumnRelationship virtualRelationship) {
+ this.joinColumnStrategy.initializeFromVirtual(virtualRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaAssociationOverride getParent() {
+ return (JavaAssociationOverride) super.getParent();
+ }
+
+ public JavaAssociationOverride getAssociationOverride() {
+ return this.getParent();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getAssociationOverride().getContainer().getTypeMapping();
+ }
+
+ public Entity getEntity() {
+ TypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ public RelationshipMapping getMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ result = this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+
+ return this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getAssociationOverride().getValidationTextRange(astRoot);
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.joinColumnStrategy.validate(messages, reporter, astRoot);
+ this.joinTableStrategy.validate(messages, reporter, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
new file mode 100644
index 0000000000..21dd9cd90e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * Generic Java persistent attribute
+ */
+public class GenericJavaPersistentAttribute
+ extends AbstractJavaPersistentAttribute
+{
+
+ public GenericJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
+ super(parent, jrpa);
+ }
+
+
+ // ********** access **********
+
+ /**
+ * JPA 1.0 does not support specified access, so we return <code>null</code>.
+ */
+ @Override
+ public AccessType getSpecifiedAccess() {
+ return null;
+ }
+
+ public void setSpecifiedAccess(AccessType access) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ********** validation **********
+
+ @Override
+ protected JptValidator buildAttibuteValidator(CompilationUnit astRoot) {
+ return new GenericPersistentAttributeValidator(this, this, buildTextRangeResolver(astRoot));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java
new file mode 100644
index 0000000000..b66d1aecf2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * JPA 1.0 Java persistent type.
+ * The specified access is always null.
+ */
+public class GenericJavaPersistentType
+ extends AbstractJavaPersistentType
+{
+ public GenericJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
+ super(parent, jrpt);
+ }
+
+
+ // ********** access **********
+
+ /**
+ * Return <code>null</code> - JPA 1.0 does not support a specified access.
+ */
+ @Override
+ protected AccessType buildSpecifiedAccess() {
+ return null;
+ }
+
+ /**
+ * JPA 1.0 does not support a specified access.
+ */
+ public void setSpecifiedAccess(AccessType specifiedAccess) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..8e5c92d5c4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaPrimaryKeyJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Java primary key join column
+ */
+public class GenericJavaPrimaryKeyJoinColumn
+ extends AbstractJavaNamedColumn<PrimaryKeyJoinColumnAnnotation, JavaBaseJoinColumn.Owner>
+ implements JavaPrimaryKeyJoinColumn
+{
+ /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */
+ protected /* final */ PrimaryKeyJoinColumnAnnotation columnAnnotation; // never null
+
+ protected String specifiedReferencedColumnName;
+ protected String defaultReferencedColumnName;
+
+
+ public GenericJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner, PrimaryKeyJoinColumnAnnotation columnAnnotation) {
+ super(parent, owner, columnAnnotation);
+ this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
+ }
+
+
+ // ********** column annotation **********
+
+ @Override
+ public PrimaryKeyJoinColumnAnnotation getColumnAnnotation() {
+ return this.columnAnnotation;
+ }
+
+ @Override
+ protected void setColumnAnnotation(PrimaryKeyJoinColumnAnnotation columnAnnotation) {
+ this.columnAnnotation = columnAnnotation;
+ }
+
+ @Override
+ protected void removeColumnAnnotation() {
+ // we don't remove a pk join column annotation when it is empty
+ }
+
+
+ // ********** referenced column name **********
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ public void setSpecifiedReferencedColumnName(String name) {
+ if (this.valuesAreDifferent(this.specifiedReferencedColumnName, name)) {
+ this.columnAnnotation.setReferencedColumnName(name);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedReferencedColumnName_(name);
+ }
+ }
+
+ protected void setSpecifiedReferencedColumnName_(String name) {
+ String old = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = name;
+ this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedReferencedColumnName() {
+ return this.columnAnnotation.getReferencedColumnName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String name) {
+ String old = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = name;
+ this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ // TODO not correct when we start supporting
+ // primary key join columns in 1-1 mappings
+ protected String buildDefaultReferencedColumnName() {
+ return this.buildDefaultName();
+ }
+
+
+ // ********** database stuff **********
+
+ public Table getReferencedColumnDbTable() {
+ return this.owner.getReferencedColumnDbTable();
+ }
+
+ protected Column getReferencedDbColumn() {
+ Table table = this.getReferencedColumnDbTable();
+ return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
+ }
+
+ public boolean referencedColumnIsResolved() {
+ return this.getReferencedDbColumn() != null;
+ }
+
+
+ // ********** misc **********
+
+ public boolean isDefault() {
+ return this.owner.joinColumnIsDefault(this);
+ }
+
+ @Override
+ public String getTable() {
+ return this.owner.getDefaultTableName();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.referencedColumnNameTouches(pos, astRoot)) {
+ return this.getJavaCandidateReferencedColumnNames(filter).iterator();
+ }
+ return null;
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.columnAnnotation.referencedColumnNameTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateReferencedColumnNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateReferencedColumnNames(filter));
+ }
+
+ protected Iterable<String> getCandidateReferencedColumnNames(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateReferencedColumnNames(), filter);
+ }
+
+ protected Iterable<String> getCandidateReferencedColumnNames() {
+ Table table = this.owner.getReferencedColumnDbTable();
+ return (table != null) ? table.getSortedColumnIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaPrimaryKeyJoinColumnTextRangeResolver(this, astRoot);
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ TextRange textRange = this.columnAnnotation.getReferencedColumnNameTextRange(astRoot);
+ return textRange != null ? textRange : this.getValidationTextRange(astRoot);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append("=>"); //$NON-NLS-1$
+ sb.append(this.getReferencedColumnName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
new file mode 100644
index 0000000000..220db7e932
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java query container
+ */
+public class GenericJavaQueryContainer
+ extends AbstractJavaJpaContextNode
+ implements JavaQueryContainer
+{
+ protected final Owner owner;
+
+ protected final Vector<JavaNamedQuery> namedQueries = new Vector<JavaNamedQuery>();
+ protected NamedQueryContainerAdapter namedQueryContainerAdapter = new NamedQueryContainerAdapter();
+
+ protected final Vector<JavaNamedNativeQuery> namedNativeQueries = new Vector<JavaNamedNativeQuery>();
+ protected NamedNativeQueryContainerAdapter namedNativeQueryContainerAdapter = new NamedNativeQueryContainerAdapter();
+
+
+ public GenericJavaQueryContainer(JavaJpaContextNode parent, Owner owner) {
+ super(parent);
+ this.owner = owner;
+ this.initializeNamedQueries();
+ this.initializeNamedNativeQueries();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncNamedQueries();
+ this.syncNamedNativeQueries();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getNamedQueries());
+ this.updateNodes(this.getNamedNativeQueries());
+ }
+
+
+ // ********** named queries **********
+
+ public ListIterator<JavaNamedQuery> namedQueries() {
+ return this.getNamedQueries().iterator();
+ }
+
+ protected ListIterable<JavaNamedQuery> getNamedQueries() {
+ return new LiveCloneListIterable<JavaNamedQuery>(this.namedQueries);
+ }
+
+ public int namedQueriesSize() {
+ return this.namedQueries.size();
+ }
+
+ public JavaNamedQuery addNamedQuery() {
+ return this.addNamedQuery(this.namedQueries.size());
+ }
+
+ public JavaNamedQuery addNamedQuery(int index) {
+ NamedQueryAnnotation annotation = this.buildNamedQueryAnnotation(index);
+ return this.addNamedQuery_(index, annotation);
+ }
+
+ protected NamedQueryAnnotation buildNamedQueryAnnotation(int index) {
+ return (NamedQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeNamedQuery(NamedQuery namedQuery) {
+ this.removeNamedQuery(this.namedQueries.indexOf(namedQuery));
+ }
+
+ public void removeNamedQuery(int index) {
+ this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ this.removeNamedQuery_(index);
+ }
+
+ protected void removeNamedQuery_(int index) {
+ this.removeItemFromList(index, this.namedQueries, NAMED_QUERIES_LIST);
+ }
+
+ public void moveNamedQuery(int targetIndex, int sourceIndex) {
+ this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedQueriesAnnotation.ANNOTATION_NAME);
+ this.moveItemInList(targetIndex, sourceIndex, this.namedQueries, NAMED_QUERIES_LIST);
+ }
+
+ protected void initializeNamedQueries() {
+ for (NamedQueryAnnotation annotation : this.getNamedQueryAnnotations()) {
+ this.namedQueries.add(this.buildNamedQuery(annotation));
+ }
+ }
+
+ protected JavaNamedQuery buildNamedQuery(NamedQueryAnnotation namedQueryAnnotation) {
+ return this.getJpaFactory().buildJavaNamedQuery(this, namedQueryAnnotation);
+ }
+
+ protected void syncNamedQueries() {
+ ContextContainerTools.synchronizeWithResourceModel(this.namedQueryContainerAdapter);
+ }
+
+ protected Iterable<NamedQueryAnnotation> getNamedQueryAnnotations() {
+ return new SubIterableWrapper<NestableAnnotation, NamedQueryAnnotation>(
+ CollectionTools.iterable(this.namedQueryAnnotations())
+ );
+ }
+
+ protected Iterator<NestableAnnotation> namedQueryAnnotations() {
+ return this.owner.getResourceAnnotatedElement().annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void moveNamedQuery_(int index, JavaNamedQuery namedQuery) {
+ this.moveItemInList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
+ }
+
+ protected JavaNamedQuery addNamedQuery_(int index, NamedQueryAnnotation namedQueryAnnotation) {
+ JavaNamedQuery query = this.buildNamedQuery(namedQueryAnnotation);
+ this.addItemToList(index, query, this.namedQueries, NAMED_QUERIES_LIST);
+ return query;
+ }
+
+ protected void removeNamedQuery_(JavaNamedQuery namedQuery) {
+ this.removeNamedQuery_(this.namedQueries.indexOf(namedQuery));
+ }
+
+ /**
+ * named query container adapter
+ */
+ protected class NamedQueryContainerAdapter
+ implements ContextContainerTools.Adapter<JavaNamedQuery, NamedQueryAnnotation>
+ {
+ public Iterable<JavaNamedQuery> getContextElements() {
+ return GenericJavaQueryContainer.this.getNamedQueries();
+ }
+ public Iterable<NamedQueryAnnotation> getResourceElements() {
+ return GenericJavaQueryContainer.this.getNamedQueryAnnotations();
+ }
+ public NamedQueryAnnotation getResourceElement(JavaNamedQuery contextElement) {
+ return contextElement.getQueryAnnotation();
+ }
+ public void moveContextElement(int index, JavaNamedQuery element) {
+ GenericJavaQueryContainer.this.moveNamedQuery_(index, element);
+ }
+ public void addContextElement(int index, NamedQueryAnnotation resourceElement) {
+ GenericJavaQueryContainer.this.addNamedQuery_(index, resourceElement);
+ }
+ public void removeContextElement(JavaNamedQuery element) {
+ GenericJavaQueryContainer.this.removeNamedQuery_(element);
+ }
+ }
+
+
+ // ********** named native queries **********
+
+ public ListIterator<JavaNamedNativeQuery> namedNativeQueries() {
+ return this.getNamedNativeQueries().iterator();
+ }
+
+ protected ListIterable<JavaNamedNativeQuery> getNamedNativeQueries() {
+ return new LiveCloneListIterable<JavaNamedNativeQuery>(this.namedNativeQueries);
+ }
+
+ public int namedNativeQueriesSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ public JavaNamedNativeQuery addNamedNativeQuery() {
+ return this.addNamedNativeQuery(this.namedNativeQueries.size());
+ }
+
+ public JavaNamedNativeQuery addNamedNativeQuery(int index) {
+ NamedNativeQueryAnnotation annotation = this.buildNamedNativeQueryAnnotation(index);
+ return this.addNamedNativeQuery_(index, annotation);
+ }
+
+ protected NamedNativeQueryAnnotation buildNamedNativeQueryAnnotation(int index) {
+ return (NamedNativeQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
+ this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery));
+ }
+
+ public void removeNamedNativeQuery(int index) {
+ this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ this.removeNamedNativeQuery_(index);
+ }
+
+ protected void removeNamedNativeQuery_(int index) {
+ this.removeItemFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
+ this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ this.moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ protected void initializeNamedNativeQueries() {
+ for (NamedNativeQueryAnnotation annotation : this.getNamedNativeQueryAnnotations()) {
+ this.namedNativeQueries.add(this.buildNamedNativeQuery(annotation));
+ }
+ }
+
+ protected JavaNamedNativeQuery buildNamedNativeQuery(NamedNativeQueryAnnotation namedNativeQueryAnnotation) {
+ return this.getJpaFactory().buildJavaNamedNativeQuery(this, namedNativeQueryAnnotation);
+ }
+
+ protected void syncNamedNativeQueries() {
+ ContextContainerTools.synchronizeWithResourceModel(this.namedNativeQueryContainerAdapter);
+ }
+
+ protected Iterable<NamedNativeQueryAnnotation> getNamedNativeQueryAnnotations() {
+ return new SubIterableWrapper<NestableAnnotation, NamedNativeQueryAnnotation>(
+ CollectionTools.iterable(this.namedNativeQueryAnnotations())
+ );
+ }
+
+ protected Iterator<NestableAnnotation> namedNativeQueryAnnotations() {
+ return this.owner.getResourceAnnotatedElement().annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void moveNamedNativeQuery_(int index, JavaNamedNativeQuery namedNativeQuery) {
+ this.moveItemInList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ protected JavaNamedNativeQuery addNamedNativeQuery_(int index, NamedNativeQueryAnnotation namedNativeQueryAnnotation) {
+ JavaNamedNativeQuery query = this.buildNamedNativeQuery(namedNativeQueryAnnotation);
+ this.addItemToList(index, query, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ return query;
+ }
+
+ protected void removeNamedNativeQuery_(JavaNamedNativeQuery namedNativeQuery) {
+ this.removeNamedNativeQuery_(this.namedNativeQueries.indexOf(namedNativeQuery));
+ }
+
+ /**
+ * named native query container adapter
+ */
+ protected class NamedNativeQueryContainerAdapter
+ implements ContextContainerTools.Adapter<JavaNamedNativeQuery, NamedNativeQueryAnnotation>
+ {
+ public Iterable<JavaNamedNativeQuery> getContextElements() {
+ return GenericJavaQueryContainer.this.getNamedNativeQueries();
+ }
+ public Iterable<NamedNativeQueryAnnotation> getResourceElements() {
+ return GenericJavaQueryContainer.this.getNamedNativeQueryAnnotations();
+ }
+ public NamedNativeQueryAnnotation getResourceElement(JavaNamedNativeQuery contextElement) {
+ return contextElement.getQueryAnnotation();
+ }
+ public void moveContextElement(int index, JavaNamedNativeQuery element) {
+ GenericJavaQueryContainer.this.moveNamedNativeQuery_(index, element);
+ }
+ public void addContextElement(int index, NamedNativeQueryAnnotation resourceElement) {
+ GenericJavaQueryContainer.this.addNamedNativeQuery_(index, resourceElement);
+ }
+ public void removeContextElement(JavaNamedNativeQuery element) {
+ GenericJavaQueryContainer.this.removeNamedNativeQuery_(element);
+ }
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateQueries(messages, astRoot);
+ }
+
+ protected void validateQueries(List<IMessage> messages, CompilationUnit astRoot) {
+ for (Iterator<JavaQuery> localQueries = this.queries(); localQueries.hasNext(); ) {
+ JavaQuery localQuery = localQueries.next();
+ String name = localQuery.getName();
+ if (StringTools.stringIsEmpty(name)){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.QUERY_NAME_UNDEFINED,
+ new String[] {},
+ localQuery,
+ localQuery.getNameTextRange(astRoot)
+ )
+ );
+ } else {
+ List<String> reportedNames = new ArrayList<String>();
+ for (Iterator<Query> globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) {
+ if (localQuery.duplicates(globalQueries.next()) && !reportedNames.contains(name)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.QUERY_DUPLICATE_NAME,
+ new String[] {name},
+ localQuery,
+ localQuery.getNameTextRange(astRoot)
+ )
+ );
+ reportedNames.add(name);
+ }
+ }
+ }
+ String query = localQuery.getQuery();
+ if (StringTools.stringIsEmpty(query)){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.QUERY_STATEMENT_UNDEFINED,
+ new String[] {name},
+ localQuery,
+ localQuery.getNameTextRange(astRoot)
+ )
+ );
+ }
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public Iterator<JavaQuery> queries() {
+ return new CompositeIterator<JavaQuery>(this.namedNativeQueries(), this.namedQueries());
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.owner.getResourceAnnotatedElement().getTextRange(astRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java
new file mode 100644
index 0000000000..ee05688b83
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+
+/**
+ * Java query hing
+ */
+public class GenericJavaQueryHint
+ extends AbstractJavaJpaContextNode
+ implements JavaQueryHint
+{
+ protected final QueryHintAnnotation queryHintAnnotation;
+
+ protected String name;
+ protected String value;
+
+
+ public GenericJavaQueryHint(JavaQuery parent, QueryHintAnnotation queryHintAnnotation) {
+ super(parent);
+ this.queryHintAnnotation = queryHintAnnotation;
+ this.name = queryHintAnnotation.getName();
+ this.value = queryHintAnnotation.getValue();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.queryHintAnnotation.getName());
+ this.setValue_(this.queryHintAnnotation.getValue());
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.queryHintAnnotation.setName(name);
+ this.setName_(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** value **********
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.queryHintAnnotation.setValue(value);
+ this.setValue_(value);
+ }
+
+ protected void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.queryHintAnnotation.getTextRange(astRoot);
+ }
+
+
+ // ********** miscelleneous **********
+
+ public QueryHintAnnotation getQueryHintAnnotation() {
+ return this.queryHintAnnotation;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
new file mode 100644
index 0000000000..5f8c567183
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
@@ -0,0 +1,317 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaReferenceTable;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ReferenceTableAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java join table or collection table
+ */
+public abstract class GenericJavaReferenceTable<A extends ReferenceTableAnnotation>
+ extends AbstractJavaTable<A>
+ implements JavaReferenceTable
+{
+ protected final Vector<JavaJoinColumn> specifiedJoinColumns = new Vector<JavaJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final JavaJoinColumn.Owner joinColumnOwner;
+
+ protected JavaJoinColumn defaultJoinColumn;
+
+
+ protected GenericJavaReferenceTable(JavaJpaContextNode parent, Owner owner) {
+ super(parent, owner);
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ this.initializeSpecifiedJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedJoinColumns();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedJoinColumns());
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<JavaJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+ public void convertDefaultToSpecifiedJoinColumn() {
+ MappingTools.convertReferenceTableDefaultToSpecifiedJoinColumn(this);
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<JavaJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public JavaJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ public JavaJoinColumn addSpecifiedJoinColumn() {
+ return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ }
+
+ public JavaJoinColumn addSpecifiedJoinColumn(int index) {
+ JoinColumnAnnotation annotation = this.getTableAnnotation().addJoinColumn(index);
+ return this.addSpecifiedJoinColumn_(index, annotation);
+ }
+
+ public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ this.getTableAnnotation().removeJoinColumn(index);
+ this.removeTableAnnotationIfUnset();
+ this.removeSpecifiedJoinColumn_(index);
+ }
+
+ protected void removeSpecifiedJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ this.getTableAnnotation().moveJoinColumn(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected void initializeSpecifiedJoinColumns() {
+ for (JoinColumnAnnotation joinColumnAnnotation : this.getJoinColumnAnnotations()) {
+ this.specifiedJoinColumns.add(this.buildJoinColumn(joinColumnAnnotation));
+ }
+ }
+
+ protected void syncSpecifiedJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
+ return CollectionTools.iterable(this.getTableAnnotation().joinColumns());
+ }
+
+ protected void moveSpecifiedJoinColumn_(int index, JavaJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaJoinColumn addSpecifiedJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) {
+ JavaJoinColumn joinColumn = this.buildJoinColumn(joinColumnAnnotation);
+ this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaJoinColumn, JoinColumnAnnotation>
+ {
+ public Iterable<JavaJoinColumn> getContextElements() {
+ return GenericJavaReferenceTable.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<JoinColumnAnnotation> getResourceElements() {
+ return GenericJavaReferenceTable.this.getJoinColumnAnnotations();
+ }
+ public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
+ return contextElement.getColumnAnnotation();
+ }
+ public void moveContextElement(int index, JavaJoinColumn element) {
+ GenericJavaReferenceTable.this.moveSpecifiedJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, JoinColumnAnnotation resourceElement) {
+ GenericJavaReferenceTable.this.addSpecifiedJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(JavaJoinColumn element) {
+ GenericJavaReferenceTable.this.removeSpecifiedJoinColumn_(element);
+ }
+ }
+
+ protected abstract JavaJoinColumn.Owner buildJoinColumnOwner();
+
+
+ // ********** default join column **********
+
+ public JavaJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(JavaJoinColumn joinColumn) {
+ JavaJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<JavaJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<JavaJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<JavaJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ if (this.buildsDefaultJoinColumn()) {
+ if (this.defaultJoinColumn == null) {
+ this.setDefaultJoinColumn(this.buildJoinColumn(new NullJoinColumnAnnotation(this.getTableAnnotation())));
+ } else {
+ this.defaultJoinColumn.update();
+ }
+ } else {
+ this.setDefaultJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultJoinColumn() {
+ return ! this.hasSpecifiedJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ protected void initializeFrom(ReadOnlyReferenceTable oldTable) {
+ super.initializeFrom(oldTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedJoinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
+ }
+ }
+
+ protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) {
+ super.initializeFromVirtual(virtualTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.joinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
+ }
+ }
+
+ protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnAnnotation) {
+ return this.buildJoinColumn(this.joinColumnOwner, joinColumnAnnotation);
+ }
+
+ protected JavaJoinColumn buildJoinColumn(JavaJoinColumn.Owner jcOwner, JoinColumnAnnotation joinColumnAnnotation) {
+ return this.getJpaFactory().buildJavaJoinColumn(this, jcOwner, joinColumnAnnotation);
+ }
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaJoinColumn column : CollectionTools.iterable(this.joinColumns())) {
+ result = column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ boolean continueValidating = this.buildTableValidator(astRoot).validate(messages, reporter);
+
+ //join column validation will handle the check for whether to validate against the database
+ //some validation messages are not database specific. If the database validation for the
+ //table fails we will stop there and not validate the join columns at all
+ if (continueValidating) {
+ this.validateJoinColumns(messages, reporter, astRoot);
+ }
+ }
+
+ protected void validateJoinColumns(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.validateJoinColumns(this.joinColumns(), messages, reporter, astRoot);
+ }
+
+ protected void validateJoinColumns(Iterator<JavaJoinColumn> joinColumns, List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ while (joinColumns.hasNext()) {
+ joinColumns.next().validate(messages, reporter, astRoot);
+ }
+ }
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
new file mode 100644
index 0000000000..d65b862cc4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
@@ -0,0 +1,400 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java secondary table
+ */
+public class GenericJavaSecondaryTable
+ extends AbstractJavaTable<SecondaryTableAnnotation>
+ implements JavaSecondaryTable
+{
+ /** @see AbstractJavaTable#AbstractJavaTable(org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation) */
+ protected /* final */ SecondaryTableAnnotation tableAnnotation;
+
+ protected final Vector<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<JavaPrimaryKeyJoinColumn>();
+ protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final JavaBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
+
+ protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
+
+
+ public GenericJavaSecondaryTable(JavaEntity parent, Owner owner, SecondaryTableAnnotation tableAnnotation) {
+ super(parent, owner, tableAnnotation);
+ this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ this.initializeSpecifiedPrimaryKeyJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedPrimaryKeyJoinColumns();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedPrimaryKeyJoinColumns());
+ this.updateDefaultPrimaryKeyJoinColumn();
+ }
+
+
+ // ********** table annotation **********
+
+ @Override
+ public SecondaryTableAnnotation getTableAnnotation() {
+ return this.tableAnnotation;
+ }
+
+ /**
+ * @see AbstractJavaTable
+ */
+ @Override
+ protected void setTableAnnotation(SecondaryTableAnnotation tableAnnotation) {
+ this.tableAnnotation = tableAnnotation;
+ }
+
+ @Override
+ protected void removeTableAnnotation() {
+ // even though its name is required, we don't remove a secondary table'
+ // annotation when it is empty since it is part of a list and it's not
+ // obvious whether this would be very user-helpful...
+ }
+
+ protected String getAnnotationName() {
+ return SecondaryTableAnnotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** primary key join columns **********
+
+ public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.getPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
+ }
+
+
+ // ********** specified primary key join columns **********
+
+ public ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
+ }
+
+ public ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<JavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ }
+
+ public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ }
+
+ public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ PrimaryKeyJoinColumnAnnotation annotation = this.tableAnnotation.addPkJoinColumn(index);
+ return this.addSpecifiedPrimaryKeyJoinColumn_(index, annotation);
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ this.tableAnnotation.removePkJoinColumn(index);
+ this.removeTableAnnotationIfUnset();
+ this.removeSpecifiedPrimaryKeyJoinColumn_(index);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ this.tableAnnotation.movePkJoinColumn(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected void initializeSpecifiedPrimaryKeyJoinColumns() {
+ for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) {
+ this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation));
+ }
+ }
+
+ protected void syncSpecifiedPrimaryKeyJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
+ return CollectionTools.iterable(this.tableAnnotation.pkJoinColumns());
+ }
+
+ protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) {
+ JavaPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(pkJoinColumnAnnotation);
+ this.addItemToList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn joinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ /**
+ * specified primary key join column container adapter
+ */
+ protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
+ {
+ public Iterable<JavaPrimaryKeyJoinColumn> getContextElements() {
+ return GenericJavaSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns();
+ }
+ public Iterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
+ return GenericJavaSecondaryTable.this.getPrimaryKeyJoinColumnAnnotations();
+ }
+ public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getColumnAnnotation();
+ }
+ public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) {
+ GenericJavaSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) {
+ GenericJavaSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(JavaPrimaryKeyJoinColumn element) {
+ GenericJavaSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
+ }
+ }
+
+ protected JavaBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+
+ // ********** default primary key join column **********
+
+ public JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
+ return this.defaultPrimaryKeyJoinColumn;
+ }
+
+ protected void setDefaultPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn joinColumn) {
+ JavaPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn;
+ this.defaultPrimaryKeyJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, old, joinColumn);
+ }
+
+ protected ListIterable<JavaPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
+ return (this.defaultPrimaryKeyJoinColumn != null) ?
+ new SingleElementListIterable<JavaPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
+ EmptyListIterable.<JavaPrimaryKeyJoinColumn>instance();
+ }
+
+ protected int getDefaultPrimaryKeyJoinColumnsSize() {
+ return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultPrimaryKeyJoinColumn() {
+ if (this.buildsDefaultPrimaryKeyJoinColumn()) {
+ if (this.defaultPrimaryKeyJoinColumn == null) {
+ this.setDefaultPrimaryKeyJoinColumn(this.buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.tableAnnotation)));
+ } else {
+ this.defaultPrimaryKeyJoinColumn.update();
+ }
+ } else {
+ this.setDefaultPrimaryKeyJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultPrimaryKeyJoinColumn() {
+ return ! this.hasSpecifiedPrimaryKeyJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaEntity getParent() {
+ return (JavaEntity) super.getParent();
+ }
+
+ protected JavaEntity getEntity() {
+ return this.getParent();
+ }
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) {
+ return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, pkJoinColumnAnnotation);
+ }
+
+
+ // ********** defaults **********
+
+ /**
+ * a secondary table doesn't have a default name
+ */
+ @Override
+ protected String buildDefaultName() {
+ return null;
+ }
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** code completion **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
+ result = column.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ boolean continueValidating = this.buildTableValidator(astRoot).validate(messages, reporter);
+
+ //join column validation will handle the check for whether to validate against the database
+ //some validation messages are not database specific. If the database validation for the
+ //table fails we will stop there and not validate the join columns at all
+ if (continueValidating) {
+ for (Iterator<JavaPrimaryKeyJoinColumn> stream = this.primaryKeyJoinColumns(); stream.hasNext(); ) {
+ stream.next().validate(messages, reporter, astRoot);
+ }
+ }
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.connectionProfileIsActive();
+ }
+
+
+ // ********** primary key join column owner adapter **********
+
+ protected class PrimaryKeyJoinColumnOwner
+ implements JavaBaseJoinColumn.Owner
+ {
+ protected JavaEntity getEntity() {
+ return GenericJavaSecondaryTable.this.getEntity();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getEntity();
+ }
+
+ public String getDefaultTableName() {
+ return GenericJavaSecondaryTable.this.getName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericJavaSecondaryTable.this.getDbTable();
+ }
+
+ public Table getReferencedColumnDbTable() {
+ return this.getTypeMapping().getPrimaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaSecondaryTable.this.primaryKeyJoinColumnsSize();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericJavaSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public String getDefaultColumnName() {
+ if (this.joinColumnsSize() != 1) {
+ return null;
+ }
+ return this.getEntity().getPrimaryKeyColumnName();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaSecondaryTable.this.getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericJavaSecondaryTable.this, (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java
new file mode 100644
index 0000000000..88c717be27
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+
+/**
+ * Java sequence generator
+ */
+public class GenericJavaSequenceGenerator
+ extends AbstractJavaSequenceGenerator<SequenceGeneratorAnnotation>
+{
+ public GenericJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation generatorAnnotation) {
+ super(parent, generatorAnnotation);
+ }
+
+
+ // ********** database stuff **********
+
+ /**
+ * The JPA 1.0 spec does not allow a sequence to specify a catalog.
+ */
+ @Override
+ protected String getCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+ /**
+ * The JPA 1.0 spec does not allow a sequence to specify a schema.
+ */
+ @Override
+ protected String getSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java
new file mode 100644
index 0000000000..5b2a3ab0a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
+
+/**
+ * Java table
+ */
+public class GenericJavaTable
+ extends AbstractJavaTable<TableAnnotation>
+{
+ public GenericJavaTable(JavaEntity parent, Owner owner) {
+ super(parent, owner);
+ }
+
+
+ // ********** table annotation **********
+
+ @Override
+ public TableAnnotation getTableAnnotation() {
+ // TODO get the NullTableAnnotation from the resource model or build it here in the context model??
+ return (TableAnnotation) this.getResourcePersistentType().getNonNullAnnotation(this.getAnnotationName());
+ }
+
+ @Override
+ protected void removeTableAnnotation() {
+ this.getResourcePersistentType().removeAnnotation(this.getAnnotationName());
+ }
+
+ protected String getAnnotationName() {
+ return TableAnnotation.ANNOTATION_NAME;
+ }
+
+ protected JavaResourcePersistentType getResourcePersistentType() {
+ return this.getEntity().getPersistentType().getResourcePersistentType();
+ }
+
+
+ // ********** defaults **********
+
+ @Override
+ protected String buildDefaultName() {
+ return this.getEntity().getDefaultTableName();
+ }
+
+ /**
+ * Just to remember:<ol>
+ * <li>{@link org.eclipse.jpt.jpa.core.context.Entity#getDefaultSchema()}<br>
+ * check inheritance; get default schema from root
+ * <li>{@link org.eclipse.jpt.jpa.core.context.orm.EntityMappings#getSchema()}<br>
+ * check for specified schema
+ * <li>{@link org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit#getDefaultSchema()}<br>
+ * {@link org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults#getSchema()}
+ * <li>{@link org.eclipse.jpt.jpa.core.JpaProject#getDefaultSchema()}<br>
+ * check for user override project setting
+ * <li>{@link org.eclipse.jpt.jpa.db.Catalog#getDefaultSchema()}<br>
+ * or {@link org.eclipse.jpt.jpa.db.Database#getDefaultSchema()}
+ * </ol>
+ */
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getEntity().getDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getEntity().getDefaultCatalog();
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.connectionProfileIsActive();
+ }
+
+
+ // ********** misc **********
+
+ /**
+ * covariant override
+ */
+ @Override
+ public JavaEntity getParent() {
+ return (JavaEntity) super.getParent();
+ }
+
+ protected JavaEntity getEntity() {
+ return this.getParent();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
new file mode 100644
index 0000000000..f553c9b717
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
@@ -0,0 +1,567 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
+import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaGenerator;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.db.Database;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Java table generator
+ */
+public class GenericJavaTableGenerator
+ extends AbstractJavaGenerator<TableGeneratorAnnotation>
+ implements JavaTableGenerator, UniqueConstraint.Owner
+{
+ protected String specifiedTable;
+ protected String defaultTable;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedPkColumnName;
+ protected String defaultPkColumnName;
+
+ protected String specifiedValueColumnName;
+ protected String defaultValueColumnName;
+
+ protected String specifiedPkColumnValue;
+ protected String defaultPkColumnValue;
+
+ protected final Vector<JavaUniqueConstraint> uniqueConstraints = new Vector<JavaUniqueConstraint>();
+ protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+
+
+ // ********** constructor **********
+
+ public GenericJavaTableGenerator(JavaJpaContextNode parent, TableGeneratorAnnotation generatorAnnotation) {
+ super(parent, generatorAnnotation);
+ this.specifiedTable = generatorAnnotation.getTable();
+ this.specifiedSchema = generatorAnnotation.getSchema();
+ this.specifiedCatalog = generatorAnnotation.getCatalog();
+ this.specifiedPkColumnName = generatorAnnotation.getPkColumnName();
+ this.specifiedValueColumnName = generatorAnnotation.getValueColumnName();
+ this.specifiedPkColumnValue = generatorAnnotation.getPkColumnValue();
+ this.initializeUniqueConstraints();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTable_(this.generatorAnnotation.getTable());
+ this.setSpecifiedSchema_(this.generatorAnnotation.getSchema());
+ this.setSpecifiedCatalog_(this.generatorAnnotation.getCatalog());
+ this.setSpecifiedPkColumnName_(this.generatorAnnotation.getPkColumnName());
+ this.setSpecifiedValueColumnName_(this.generatorAnnotation.getValueColumnName());
+ this.setSpecifiedPkColumnValue_(this.generatorAnnotation.getPkColumnValue());
+ this.syncUniqueConstraints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultTable(this.buildDefaultTable());
+ this.setDefaultSchema(this.buildDefaultSchema());
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.setDefaultPkColumnName(this.buildDefaultPkColumnName());
+ this.setDefaultValueColumnName(this.buildDefaultValueColumnName());
+ this.setDefaultPkColumnValue(this.buildDefaultPkColumnValue());
+ this.updateNodes(this.getUniqueConstraints());
+ }
+
+
+ // ********** initial value **********
+
+ @Override
+ protected int buildDefaultInitialValue() {
+ return DEFAULT_INITIAL_VALUE;
+ }
+
+
+ // ********** table **********
+
+ public String getTable() {
+ return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ public void setSpecifiedTable(String table) {
+ this.generatorAnnotation.setTable(table);
+ this.setSpecifiedTable_(table);
+ }
+
+ protected void setSpecifiedTable_(String table) {
+ String old = this.specifiedTable;
+ this.specifiedTable = table;
+ this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String table) {
+ String old = this.defaultTable;
+ this.defaultTable = table;
+ this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildDefaultTable() {
+ return null; // TODO the default table is determined by the runtime provider...
+ }
+
+ public Table getDbTable() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getTable());
+ }
+
+
+ // ********** schema **********
+
+ @Override
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ this.generatorAnnotation.setSchema(schema);
+ this.setSpecifiedSchema_(schema);
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+
+ // ********** catalog **********
+
+ @Override
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ this.generatorAnnotation.setCatalog(catalog);
+ this.setSpecifiedCatalog_(catalog);
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** primary key column name **********
+
+ public String getPkColumnName() {
+ return (this.specifiedPkColumnName != null) ? this.specifiedPkColumnName : this.defaultPkColumnName;
+ }
+
+ public String getSpecifiedPkColumnName() {
+ return this.specifiedPkColumnName;
+ }
+
+ public void setSpecifiedPkColumnName(String name) {
+ this.generatorAnnotation.setPkColumnName(name);
+ this.setSpecifiedPkColumnName_(name);
+ }
+
+ protected void setSpecifiedPkColumnName_(String name) {
+ String old = this.specifiedPkColumnName;
+ this.specifiedPkColumnName = name;
+ this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ public String getDefaultPkColumnName() {
+ return this.defaultPkColumnName;
+ }
+
+ protected void setDefaultPkColumnName(String name) {
+ String old = this.defaultPkColumnName;
+ this.defaultPkColumnName = name;
+ this.firePropertyChanged(DEFAULT_PK_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultPkColumnName() {
+ return null; // TODO the default pk column name is determined by the runtime provider...
+ }
+
+
+ // ********** value column name **********
+
+ public String getValueColumnName() {
+ return (this.specifiedValueColumnName != null) ? this.specifiedValueColumnName : this.defaultValueColumnName;
+ }
+
+ public String getSpecifiedValueColumnName() {
+ return this.specifiedValueColumnName;
+ }
+
+ public void setSpecifiedValueColumnName(String name) {
+ this.generatorAnnotation.setValueColumnName(name);
+ this.setSpecifiedValueColumnName_(name);
+ }
+
+ protected void setSpecifiedValueColumnName_(String name) {
+ String old = this.specifiedValueColumnName;
+ this.specifiedValueColumnName = name;
+ this.firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ public String getDefaultValueColumnName() {
+ return this.defaultValueColumnName;
+ }
+
+ protected void setDefaultValueColumnName(String name) {
+ String old = this.defaultValueColumnName;
+ this.defaultValueColumnName = name;
+ this.firePropertyChanged(DEFAULT_VALUE_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultValueColumnName() {
+ return null; // TODO the default value column name is determined by the runtime provider...
+ }
+
+
+ // ********** primary key column value **********
+
+ public String getPkColumnValue() {
+ return (this.specifiedPkColumnValue != null) ? this.specifiedPkColumnValue : this.defaultPkColumnValue;
+ }
+
+ public String getSpecifiedPkColumnValue() {
+ return this.specifiedPkColumnValue;
+ }
+
+ public void setSpecifiedPkColumnValue(String value) {
+ this.generatorAnnotation.setPkColumnValue(value);
+ this.setSpecifiedPkColumnValue_(value);
+ }
+
+ protected void setSpecifiedPkColumnValue_(String value) {
+ String old = this.specifiedPkColumnValue;
+ this.specifiedPkColumnValue = value;
+ this.firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, old, value);
+ }
+
+ public String getDefaultPkColumnValue() {
+ return this.defaultPkColumnValue;
+ }
+
+ protected void setDefaultPkColumnValue(String value) {
+ String old = this.defaultPkColumnValue;
+ this.defaultPkColumnValue = value;
+ this.firePropertyChanged(DEFAULT_PK_COLUMN_VALUE_PROPERTY, old, value);
+ }
+
+ protected String buildDefaultPkColumnValue() {
+ return null; // TODO the default pk column value is determined by the runtime provider...
+ }
+
+
+ // ********** unique constraints **********
+
+ public Iterable<JavaUniqueConstraint> getUniqueConstraints() {
+ return new LiveCloneIterable<JavaUniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public JavaUniqueConstraint addUniqueConstraint() {
+ return this.addUniqueConstraint(this.uniqueConstraints.size());
+ }
+
+ public JavaUniqueConstraint addUniqueConstraint(int index) {
+ UniqueConstraintAnnotation constraintAnnotation = this.generatorAnnotation.addUniqueConstraint(index);
+ return this.addUniqueConstraint_(index, constraintAnnotation);
+ }
+
+ public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
+ }
+
+ public void removeUniqueConstraint(int index) {
+ this.generatorAnnotation.removeUniqueConstraint(index);
+ this.removeUniqueConstraint_(index);
+ }
+
+ protected void removeUniqueConstraint_(int index) {
+ this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ this.generatorAnnotation.moveUniqueConstraint(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected void initializeUniqueConstraints() {
+ for (Iterator<UniqueConstraintAnnotation> stream = this.generatorAnnotation.uniqueConstraints(); stream.hasNext(); ) {
+ this.uniqueConstraints.add(this.buildUniqueConstraint(stream.next()));
+ }
+ }
+
+ protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
+ return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
+ }
+
+ protected void syncUniqueConstraints() {
+ ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
+ }
+
+ protected Iterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
+ return CollectionTools.iterable(this.generatorAnnotation.uniqueConstraints());
+ }
+
+ protected void moveUniqueConstraint_(int index, JavaUniqueConstraint uniqueConstraint) {
+ this.moveItemInList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected JavaUniqueConstraint addUniqueConstraint_(int index, UniqueConstraintAnnotation constraintAnnotation) {
+ JavaUniqueConstraint constraint = this.buildUniqueConstraint(constraintAnnotation);
+ this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ return constraint;
+ }
+
+ protected void removeUniqueConstraint_(JavaUniqueConstraint uniqueConstraint) {
+ this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(uniqueConstraint));
+ }
+
+ /**
+ * unique constraint container adapter
+ */
+ protected class UniqueConstraintContainerAdapter
+ implements ContextContainerTools.Adapter<JavaUniqueConstraint, UniqueConstraintAnnotation>
+ {
+ public Iterable<JavaUniqueConstraint> getContextElements() {
+ return GenericJavaTableGenerator.this.getUniqueConstraints();
+ }
+ public Iterable<UniqueConstraintAnnotation> getResourceElements() {
+ return GenericJavaTableGenerator.this.getUniqueConstraintAnnotations();
+ }
+ public UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
+ return contextElement.getUniqueConstraintAnnotation();
+ }
+ public void moveContextElement(int index, JavaUniqueConstraint element) {
+ GenericJavaTableGenerator.this.moveUniqueConstraint_(index, element);
+ }
+ public void addContextElement(int index, UniqueConstraintAnnotation resourceElement) {
+ GenericJavaTableGenerator.this.addUniqueConstraint_(index, resourceElement);
+ }
+ public void removeContextElement(JavaUniqueConstraint element) {
+ GenericJavaTableGenerator.this.removeUniqueConstraint_(element);
+ }
+ }
+
+
+ // ********** UniqueConstraint.Owner implementation **********
+
+ public Iterator<String> candidateUniqueConstraintColumnNames() {
+ org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
+ return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.<String>instance();
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (JavaUniqueConstraint constraint : this.getUniqueConstraints()) {
+ result = constraint.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * called if the database is connected:
+ * table, schema, catalog, pkColumnName, valueColumnName
+ */
+ @Override
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.tableTouches(pos, astRoot)) {
+ return this.getJavaCandidateTables(filter).iterator();
+ }
+ if (this.schemaTouches(pos, astRoot)) {
+ return this.getJavaCandidateSchemata(filter).iterator();
+ }
+ if (this.catalogTouches(pos, astRoot)) {
+ return this.getJavaCandidateCatalogs(filter).iterator();
+ }
+ if (this.pkColumnNameTouches(pos, astRoot)) {
+ return this.getJavaCandidateColumnNames(filter).iterator();
+ }
+ if (this.valueColumnNameTouches(pos, astRoot)) {
+ return this.getJavaCandidateColumnNames(filter).iterator();
+ }
+ return null;
+ }
+
+ // ********** code assist: table
+
+ protected boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return this.generatorAnnotation.tableTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateTables(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateTables(filter));
+ }
+
+ protected Iterable<String> getCandidateTables(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateTables(), filter);
+ }
+
+ protected Iterable<String> getCandidateTables() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema != null) ? dbSchema.getSortedTableIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+ // ********** code assist: schema
+
+ protected boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return this.generatorAnnotation.schemaTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateSchemata(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateSchemata(filter));
+ }
+
+ protected Iterable<String> getCandidateSchemata(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateSchemata(), filter);
+ }
+
+ protected Iterable<String> getCandidateSchemata() {
+ SchemaContainer schemaContainer = this.getDbSchemaContainer();
+ return (schemaContainer != null) ? schemaContainer.getSortedSchemaIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+ // ********** code assist: catalog
+
+ protected boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return this.generatorAnnotation.catalogTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateCatalogs(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateCatalogs(filter));
+ }
+
+ protected Iterable<String> getCandidateCatalogs(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateCatalogs(), filter);
+ }
+
+ protected Iterable<String> getCandidateCatalogs() {
+ Database db = this.getDatabase();
+ return (db != null) ? db.getSortedCatalogIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+ // ********** code assist: pkColumnName
+
+ protected boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.generatorAnnotation.pkColumnNameTouches(pos, astRoot);
+ }
+
+ protected Iterable<String> getJavaCandidateColumnNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.getCandidateColumnNames(filter));
+ }
+
+ protected Iterable<String> getCandidateColumnNames(Filter<String> filter) {
+ return new FilteringIterable<String>(this.getCandidateColumnNames(), filter);
+ }
+
+ protected Iterable<String> getCandidateColumnNames() {
+ Table table = this.getDbTable();
+ return (table != null) ? table.getSortedColumnIdentifiers() : EmptyIterable.<String> instance();
+ }
+
+ // ********** code assist: valueColumnName
+
+ protected boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.generatorAnnotation.valueColumnNameTouches(pos, astRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
new file mode 100644
index 0000000000..a48e67aeb5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.TemporalConverter;
+import org.eclipse.jpt.jpa.core.context.TemporalType;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+public class GenericJavaTemporalConverter
+ extends AbstractJavaConverter
+ implements JavaTemporalConverter
+{
+ protected final TemporalAnnotation temporalAnnotation;
+
+ protected TemporalType temporalType;
+
+
+ public GenericJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation temporalAnnotation) {
+ super(parent);
+ this.temporalAnnotation = temporalAnnotation;
+ this.temporalType = this.buildTemporalType();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setTemporalType_(this.buildTemporalType());
+ }
+
+
+ // ********** temporal type **********
+
+ public TemporalType getTemporalType() {
+ return this.temporalType;
+ }
+
+ public void setTemporalType(TemporalType temporalType) {
+ if (this.valuesAreDifferent(this.temporalType, temporalType)) {
+ this.temporalAnnotation.setValue(TemporalType.toJavaResourceModel(temporalType));
+ this.removeTemporalAnnotationIfUnset();
+ this.setTemporalType_(temporalType);
+ }
+ }
+
+ protected void setTemporalType_(TemporalType temporalType) {
+ TemporalType old = this.temporalType;
+ this.temporalType = temporalType;
+ this.firePropertyChanged(TEMPORAL_TYPE_PROPERTY, old, temporalType);
+ }
+
+ protected TemporalType buildTemporalType() {
+ return TemporalType.fromJavaResourceModel(this.temporalAnnotation.getValue());
+ }
+
+
+ // ********** misc **********
+
+ public Class<? extends Converter> getType() {
+ return TemporalConverter.class;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return TemporalAnnotation.ANNOTATION_NAME;
+ }
+
+ protected void removeTemporalAnnotationIfUnset() {
+ if (this.temporalAnnotation.isUnset()) {
+ this.temporalAnnotation.removeAnnotation();
+ }
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.temporalAnnotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java
new file mode 100644
index 0000000000..37e46c1c56
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
+
+/**
+ * Java transient mapping
+ */
+public class GenericJavaTransientMapping
+ extends AbstractJavaAttributeMapping<TransientAnnotation>
+ implements JavaTransientMapping
+{
+ public GenericJavaTransientMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return TransientAnnotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ public MetamodelField getMetamodelField() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
new file mode 100644
index 0000000000..43eef86ff7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaReadOnlyUniqueConstraint;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+public class GenericJavaUniqueConstraint
+ extends AbstractJavaReadOnlyUniqueConstraint
+ implements JavaUniqueConstraint
+{
+ protected Owner owner;
+ protected final UniqueConstraintAnnotation uniqueConstraintAnnotation;
+
+
+ public GenericJavaUniqueConstraint(JavaJpaContextNode parent, Owner owner, UniqueConstraintAnnotation uniqueConstraintAnnotation) {
+ super(parent);
+ this.owner = owner;
+ this.uniqueConstraintAnnotation = uniqueConstraintAnnotation;
+ this.initializeColumnNames();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncColumnNames();
+ }
+
+
+ // ********** column names **********
+
+ public void addColumnName(String columnName) {
+ this.addColumnName(this.columnNames.size(), columnName);
+ }
+
+ public void addColumnName(int index, String columnName) {
+ this.uniqueConstraintAnnotation.addColumnName(index, columnName);
+ this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
+ }
+
+ public void removeColumnName(String columnName) {
+ this.removeColumnName(this.columnNames.indexOf(columnName));
+ }
+
+ public void removeColumnName(int index) {
+ this.uniqueConstraintAnnotation.removeColumnName(index);
+ this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST);
+ }
+
+ public void moveColumnName(int targetIndex, int sourceIndex) {
+ this.uniqueConstraintAnnotation.moveColumnName(targetIndex, sourceIndex);
+ this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST);
+ }
+
+ protected void initializeColumnNames() {
+ for (Iterator<String> stream = this.uniqueConstraintAnnotation.columnNames(); stream.hasNext(); ) {
+ this.columnNames.add(stream.next());
+ }
+ }
+
+ @Override
+ protected Iterable<String> getResourceColumnNames() {
+ return CollectionTools.iterable(this.uniqueConstraintAnnotation.columnNames());
+ }
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> connectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedJavaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.columnNamesTouches(pos, astRoot)) {
+ return this.javaCandidateColumnNames(filter);
+ }
+ return null;
+ }
+
+ protected boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
+ return this.uniqueConstraintAnnotation.columnNamesTouches(pos, astRoot);
+ }
+
+ protected Iterator<String> javaCandidateColumnNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.candidateColumnNames(filter));
+ }
+
+ protected Iterator<String> candidateColumnNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateColumnNames(), filter);
+ }
+
+ protected Iterator<String> candidateColumnNames() {
+ return this.owner.candidateUniqueConstraintColumnNames();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.uniqueConstraintAnnotation.getTextRange(astRoot);
+ }
+
+
+ // ********** misc **********
+
+ public UniqueConstraintAnnotation getUniqueConstraintAnnotation() {
+ return this.uniqueConstraintAnnotation;
+ }
+
+ public void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint) {
+ for (String columnName : oldUniqueConstraint.getColumnNames()) {
+ this.addColumnName(columnName);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java
new file mode 100644
index 0000000000..9d66e365f5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVersionMapping;
+
+public class GenericJavaVersionMapping
+ extends AbstractJavaVersionMapping
+{
+ public GenericJavaVersionMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java
new file mode 100644
index 0000000000..2333e0c4d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualOverride;
+
+/**
+ * Virtual Java association override
+ */
+public class GenericJavaVirtualAssociationOverride
+ extends AbstractJavaVirtualOverride<JavaAssociationOverrideContainer>
+ implements JavaVirtualAssociationOverride
+{
+ protected final JavaVirtualOverrideRelationship relationship;
+
+
+ public GenericJavaVirtualAssociationOverride(JavaAssociationOverrideContainer parent, String name) {
+ super(parent, name);
+ this.relationship = this.buildRelationship();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.relationship.update();
+ }
+
+ @Override
+ public JavaAssociationOverride convertToSpecified() {
+ return (JavaAssociationOverride) super.convertToSpecified();
+ }
+
+ public RelationshipMapping getMapping() {
+ return this.getContainer().getRelationshipMapping(this.name);
+ }
+
+
+ // ********** relationship **********
+
+ public JavaVirtualOverrideRelationship getRelationship() {
+ return this.relationship;
+ }
+
+ /**
+ * The relationship should be available (since its presence precipitated the
+ * creation of the virtual override).
+ */
+ protected JavaVirtualOverrideRelationship buildRelationship() {
+ return this.getJpaFactory().buildJavaVirtualOverrideRelationship(this);
+ }
+
+ public Relationship resolveOverriddenRelationship() {
+ return this.getContainer().resolveOverriddenRelationship(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java
new file mode 100644
index 0000000000..9049ad974d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualOverride;
+
+/**
+ * Virtual Java attribute override
+ */
+public class GenericJavaVirtualAttributeOverride
+ extends AbstractJavaVirtualOverride<JavaAttributeOverrideContainer>
+ implements JavaVirtualAttributeOverride, JavaVirtualColumn.Owner
+{
+ protected final JavaVirtualColumn column;
+
+
+ public GenericJavaVirtualAttributeOverride(JavaAttributeOverrideContainer parent, String name) {
+ super(parent, name);
+ this.column = this.buildColumn();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ }
+
+ @Override
+ public JavaAttributeOverride convertToSpecified() {
+ return (JavaAttributeOverride) super.convertToSpecified();
+ }
+
+
+ // ********** column **********
+
+ public JavaVirtualColumn getColumn() {
+ return this.column;
+ }
+
+ /**
+ * The original column should be available (since the presence of its
+ * attribute is what precipitated the creation of the virtual override).
+ */
+ protected JavaVirtualColumn buildColumn() {
+ return this.getJpaFactory().buildJavaVirtualColumn(this, this);
+ }
+
+
+ // ********** column owner implementation **********
+
+ public TypeMapping getTypeMapping() {
+ return this.getContainer().getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ String overriddenColumnTable = this.getOverriddenColumnTable();
+ return (overriddenColumnTable != null) ? overriddenColumnTable : this.getContainer().getDefaultTableName();
+ }
+
+ protected String getOverriddenColumnTable() {
+ ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn();
+ // pretty sure this is the *specified* table...
+ return (overriddenColumn == null) ? null : overriddenColumn.getSpecifiedTable();
+ }
+
+ public String getDefaultColumnName() {
+ String overriddenColumnName = this.getOverriddenColumnName();
+ return (overriddenColumnName != null) ? overriddenColumnName : this.name;
+ }
+
+ protected String getOverriddenColumnName() {
+ ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn();
+ return (overriddenColumn == null) ? null : overriddenColumn.getName();
+ }
+
+ public Column resolveOverriddenColumn() {
+ return this.getContainer().resolveOverriddenColumn(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java
new file mode 100644
index 0000000000..0429f71344
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualBaseColumn;
+
+/**
+ * Java virtual column
+ */
+public class GenericJavaVirtualColumn
+ extends AbstractJavaVirtualBaseColumn<JavaVirtualColumn.Owner, Column>
+ implements JavaVirtualColumn
+{
+ protected Integer specifiedLength;
+ protected int defaultLength;
+
+ protected Integer specifiedPrecision;
+ protected int defaultPrecision;
+
+ protected Integer specifiedScale;
+ protected int defaultScale;
+
+
+ public GenericJavaVirtualColumn(JavaJpaContextNode parent, JavaVirtualColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedLength(this.buildSpecifiedLength());
+ this.setDefaultLength(this.buildDefaultLength());
+
+ this.setSpecifiedPrecision(this.buildSpecifiedPrecision());
+ this.setDefaultPrecision(this.buildDefaultPrecision());
+
+ this.setSpecifiedScale(this.buildSpecifiedScale());
+ this.setDefaultScale(this.buildDefaultScale());
+ }
+
+
+ // ********** column **********
+
+ @Override
+ public Column getOverriddenColumn() {
+ return this.owner.resolveOverriddenColumn();
+ }
+
+
+ // ********** length **********
+
+ public int getLength() {
+ return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ protected void setSpecifiedLength(Integer length) {
+ Integer old = this.specifiedLength;
+ this.specifiedLength = length;
+ this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
+ }
+
+ protected Integer buildSpecifiedLength() {
+ return this.getOverriddenColumn().getSpecifiedLength();
+ }
+
+ public int getDefaultLength() {
+ return this.defaultLength;
+ }
+
+ protected void setDefaultLength(int length) {
+ int old = this.defaultLength;
+ this.defaultLength = length;
+ this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
+ }
+
+ protected int buildDefaultLength() {
+ return DEFAULT_LENGTH;
+ }
+
+
+ // ********** precision **********
+
+ public int getPrecision() {
+ return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision;
+ }
+
+ public Integer getSpecifiedPrecision() {
+ return this.specifiedPrecision;
+ }
+
+ protected void setSpecifiedPrecision(Integer precision) {
+ Integer old = this.specifiedPrecision;
+ this.specifiedPrecision = precision;
+ this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
+ }
+
+ protected Integer buildSpecifiedPrecision() {
+ return this.getOverriddenColumn().getSpecifiedPrecision();
+ }
+
+ public int getDefaultPrecision() {
+ return this.defaultPrecision;
+ }
+
+ protected void setDefaultPrecision(int precision) {
+ int old = this.defaultPrecision;
+ this.defaultPrecision = precision;
+ this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision);
+ }
+
+ protected int buildDefaultPrecision() {
+ return DEFAULT_PRECISION;
+ }
+
+
+ // ********** scale **********
+
+ public int getScale() {
+ return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale;
+ }
+
+ public Integer getSpecifiedScale() {
+ return this.specifiedScale;
+ }
+
+ protected void setSpecifiedScale(Integer scale) {
+ Integer old = this.specifiedScale;
+ this.specifiedScale = scale;
+ this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
+ }
+
+ protected Integer buildSpecifiedScale() {
+ return this.getOverriddenColumn().getSpecifiedScale();
+ }
+
+ public int getDefaultScale() {
+ return this.defaultScale;
+ }
+
+ protected void setDefaultScale(int scale) {
+ int old = this.defaultScale;
+ this.defaultScale = scale;
+ this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale);
+ }
+
+ protected int buildDefaultScale() {
+ return DEFAULT_SCALE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java
new file mode 100644
index 0000000000..6848cb9c65
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualBaseColumn;
+
+/**
+ * Java virtual join column
+ */
+public class GenericJavaVirtualJoinColumn
+ extends AbstractJavaVirtualBaseColumn<ReadOnlyJoinColumn.Owner, JoinColumn>
+ implements JavaVirtualJoinColumn
+{
+ protected final JoinColumn overriddenColumn;
+
+ protected String specifiedReferencedColumnName;
+ protected String defaultReferencedColumnName;
+
+
+ public GenericJavaVirtualJoinColumn(JavaJpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn overriddenColumn) {
+ super(parent, owner);
+ this.overriddenColumn = overriddenColumn;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName());
+ this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
+ }
+
+
+ // ********** column **********
+
+ @Override
+ public JoinColumn getOverriddenColumn() {
+ return this.overriddenColumn;
+ }
+
+ public boolean isDefault() {
+ return this.owner.joinColumnIsDefault(this);
+ }
+
+
+ // ********** referenced column name **********
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ protected void setSpecifiedReferencedColumnName(String name) {
+ String old = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = name;
+ this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedReferencedColumnName() {
+ return this.getOverriddenColumn().getSpecifiedReferencedColumnName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String name) {
+ String old = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = name;
+ this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultReferencedColumnName() {
+ return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected String buildDefaultName() {
+ return MappingTools.buildJoinColumnDefaultName(this, this.owner);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..aeb114470b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+
+public class GenericJavaVirtualOverrideJoinColumnRelationshipStrategy
+ extends AbstractJavaJpaContextNode
+ implements JavaVirtualJoinColumnRelationshipStrategy
+{
+ protected final Vector<JavaVirtualJoinColumn> specifiedJoinColumns = new Vector<JavaVirtualJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final ReadOnlyJoinColumn.Owner joinColumnOwner;
+
+ protected JavaVirtualJoinColumn defaultJoinColumn;
+
+
+ public GenericJavaVirtualOverrideJoinColumnRelationshipStrategy(JavaVirtualJoinColumnRelationship parent) {
+ super(parent);
+ this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSpecifiedJoinColumns();
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<JavaVirtualJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<JavaVirtualJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ protected void updateSpecifiedJoinColumns() {
+ ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<JoinColumn> getOverriddenSpecifiedJoinColumns() {
+ JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
+ return (overriddenStrategy == null) ?
+ EmptyIterable.<JoinColumn>instance() :
+ CollectionTools.iterable(overriddenStrategy.specifiedJoinColumns());
+ }
+
+ protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) {
+ JavaVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
+ this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return virtualJoinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) {
+ this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
+ return new SpecifiedJoinColumnContainerAdapter();
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<JavaVirtualJoinColumn, JoinColumn>
+ {
+ public Iterable<JavaVirtualJoinColumn> getContextElements() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<JoinColumn> getResourceElements() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns();
+ }
+ public JoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
+ return contextElement.getOverriddenColumn();
+ }
+ public void moveContextElement(int index, JavaVirtualJoinColumn element) {
+ GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn(index, element);
+ }
+ public void addContextElement(int index, JoinColumn resourceElement) {
+ GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn(index, resourceElement);
+ }
+ public void removeContextElement(JavaVirtualJoinColumn element) {
+ GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn(element);
+ }
+ }
+
+ protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+
+ // ********** default join column **********
+
+ public JavaVirtualJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(JavaVirtualJoinColumn joinColumn) {
+ JavaVirtualJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<JavaVirtualJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<JavaVirtualJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<JavaVirtualJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ JoinColumn overriddenDefaultJoinColumn = this.getOverriddenDefaultJoinColumn();
+ if (overriddenDefaultJoinColumn == null) {
+ if (this.defaultJoinColumn != null) {
+ this.setDefaultJoinColumn(null);
+ }
+ } else {
+ if ((this.defaultJoinColumn != null) && (this.defaultJoinColumn.getOverriddenColumn() == overriddenDefaultJoinColumn)) {
+ this.defaultJoinColumn.update();
+ } else {
+ this.setDefaultJoinColumn(this.buildJoinColumn(overriddenDefaultJoinColumn));
+ }
+ }
+ }
+
+ protected JoinColumn getOverriddenDefaultJoinColumn() {
+ JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
+ return (overriddenStrategy == null) ? null : overriddenStrategy.getDefaultJoinColumn();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaVirtualJoinColumnRelationship getParent() {
+ return (JavaVirtualJoinColumnRelationship) super.getParent();
+ }
+
+ public JavaVirtualJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected JoinColumnRelationshipStrategy getOverriddenStrategy() {
+ JoinColumnRelationship relationship = this.getOverriddenJoinColumnRelationship();
+ return (relationship == null) ? null : relationship.getJoinColumnStrategy();
+ }
+
+ protected JoinColumnRelationship getOverriddenJoinColumnRelationship() {
+ Relationship relationship = this.resolveOverriddenRelationship();
+ return (relationship instanceof JoinColumnRelationship) ? (JoinColumnRelationship) relationship : null;
+ }
+
+ protected Relationship resolveOverriddenRelationship() {
+ return this.getRelationship().resolveOverriddenRelationship();
+ }
+
+ public boolean isTargetForeignKey() {
+ RelationshipMapping relationshipMapping = this.getRelationshipMapping();
+ return (relationshipMapping != null) &&
+ relationshipMapping.getRelationship().isTargetForeignKey();
+ }
+
+ public TypeMapping getRelationshipSource() {
+ return this.isTargetForeignKey() ?
+ this.getRelationshipMapping().getResolvedTargetEntity() :
+ this.getAssociationOverrideContainer().getTypeMapping();
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ return this.isTargetForeignKey() ?
+ this.getAssociationOverrideContainer().getTypeMapping() :
+ this.getRelationshipMappingTargetEntity();
+ }
+
+ protected TypeMapping getRelationshipMappingTargetEntity() {
+ RelationshipMapping mapping = this.getRelationshipMapping();
+ return (mapping == null) ? null : mapping.getResolvedTargetEntity();
+ }
+
+ protected Entity getRelationshipTargetEntity() {
+ TypeMapping target = this.getRelationshipTarget();
+ return (target instanceof Entity) ? (Entity) target : null;
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+ protected JavaReadOnlyAssociationOverride getAssociationOverride() {
+ return ((JavaVirtualOverrideRelationship) this.getRelationship()).getAssociationOverride();
+ }
+
+ protected JavaAssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.getAssociationOverride().getContainer();
+ }
+
+ public String getTableName() {
+ return this.isTargetForeignKey() ?
+ this.getSourceTableName() :
+ this.getAssociationOverrideContainer().getDefaultTableName();
+ }
+
+ protected String getSourceTableName() {
+ TypeMapping typeMapping = this.getRelationshipSource();
+ return (typeMapping == null) ? null : typeMapping.getPrimaryTableName();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ protected String getAttributeName() {
+ return this.getAssociationOverride().getName();
+ }
+
+ protected JavaVirtualJoinColumn buildJoinColumn(JoinColumn overriddenJoinColumn) {
+ return this.getJpaFactory().buildJavaVirtualJoinColumn(this, this.joinColumnOwner, overriddenJoinColumn);
+ }
+
+
+ // ********** join column owner **********
+
+ protected class JoinColumnOwner
+ implements ReadOnlyJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public String getDefaultTableName() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getTableName();
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ public String getAttributeName() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getAttributeName();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return false;
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
new file mode 100644
index 0000000000..b75f1d81a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaVirtualOverrideRelationship2_0;
+
+public class GenericJavaVirtualOverrideRelationship
+ extends AbstractJavaJpaContextNode
+ implements JavaVirtualOverrideRelationship2_0
+{
+ protected JavaVirtualRelationshipStrategy strategy;
+
+ protected final JavaVirtualJoinColumnRelationshipStrategy joinColumnStrategy;
+
+ // JPA 2.0
+ protected final JavaVirtualJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericJavaVirtualOverrideRelationship(JavaVirtualAssociationOverride parent) {
+ super(parent);
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.setStrategy(this.buildStrategy());
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ public JavaVirtualRelationshipStrategy getStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(JavaVirtualRelationshipStrategy strategy) {
+ JavaVirtualRelationshipStrategy old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected JavaVirtualRelationshipStrategy buildStrategy() {
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
+ return this.joinColumnStrategy;
+ }
+ return this.joinTableStrategy;
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** join column strategy **********
+
+ public JavaVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return false;
+ }
+
+ protected JavaVirtualJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericJavaVirtualOverrideJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public JavaVirtualJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return this.isVirtual();
+ }
+
+ protected JavaVirtualJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return new GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ }
+
+ public void initializeOnSpecified(OverrideRelationship specifiedRelationship) {
+ specifiedRelationship.initializeFromVirtualJoinColumnRelationship(this);
+ specifiedRelationship.initializeFromVirtualJoinTableRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaVirtualAssociationOverride getParent() {
+ return (JavaVirtualAssociationOverride) super.getParent();
+ }
+
+ public JavaVirtualAssociationOverride getAssociationOverride() {
+ return this.getParent();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getAssociationOverride().getContainer().getTypeMapping();
+ }
+
+ public Entity getEntity() {
+ TypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ public RelationshipMapping getMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+ public Relationship resolveOverriddenRelationship() {
+ return this.getAssociationOverride().resolveOverriddenRelationship();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java
new file mode 100644
index 0000000000..388f871257
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaReadOnlyUniqueConstraint;
+
+public class GenericJavaVirtualUniqueConstraint
+ extends AbstractJavaReadOnlyUniqueConstraint
+ implements JavaVirtualUniqueConstraint
+{
+ protected final UniqueConstraint overriddenUniqueConstraint;
+
+
+ public GenericJavaVirtualUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint overriddenUniqueConstraint) {
+ super(parent);
+ this.overriddenUniqueConstraint = overriddenUniqueConstraint;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.syncColumnNames();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ public UniqueConstraint getOverriddenUniqueConstraint() {
+ return this.overriddenUniqueConstraint;
+ }
+
+ @Override
+ protected Iterable<String> getResourceColumnNames() {
+ return this.overriddenUniqueConstraint.getColumnNames();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java
new file mode 100644
index 0000000000..3908130b3c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+public class NullJavaConverter
+ extends AbstractJavaJpaContextNode
+ implements JavaConverter
+{
+ public NullJavaConverter(JavaAttributeMapping parent) {
+ super(parent);
+ }
+
+ @Override
+ public JavaAttributeMapping getParent() {
+ return (JavaAttributeMapping) super.getParent();
+ }
+
+ public Class<? extends Converter> getType() {
+ return null;
+ }
+
+ public Annotation getConverterAnnotation() {
+ return null;
+ }
+
+ public void dispose() {
+ // NOP
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..61ba4bc7bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Used by
+ * {@link org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaOneToManyRelationship#buildJoinColumnStrategy()}
+ * in a JPA 1.0 project.
+ */
+public class NullJavaJoinColumnRelationshipStrategy
+ extends AbstractJavaJpaContextNode
+ implements JavaJoinColumnRelationshipStrategy
+{
+ public NullJavaJoinColumnRelationshipStrategy(JavaJoinColumnRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<JavaJoinColumn> joinColumns() {
+ return EmptyListIterator.<JavaJoinColumn>instance();
+ }
+
+ public int joinColumnsSize() {
+ return 0;
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
+ return EmptyListIterator.<JavaJoinColumn>instance();
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return 0;
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return false;
+ }
+
+ public JavaJoinColumn getSpecifiedJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JavaJoinColumn addSpecifiedJoinColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ public JavaJoinColumn addSpecifiedJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** default join column **********
+
+ public JavaJoinColumn getDefaultJoinColumn() {
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaJoinColumnRelationship getParent() {
+ return (JavaJoinColumnRelationship) super.getParent();
+ }
+
+ public JavaJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+
+ public String getTableName() {
+ return null;
+ }
+
+ public TypeMapping getRelationshipSource() {
+ return this.getRelationshipMapping().getTypeMapping();
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ return null;
+ }
+
+ public boolean isTargetForeignKey() {
+ return false;
+ }
+
+ public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
+ // NOP
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
+ // NOP
+ }
+
+ public void addStrategy() {
+ // NOP
+ }
+
+ public void removeStrategy() {
+ // NOP
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return true;
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java
new file mode 100644
index 0000000000..b5df2972f5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+
+public class NullJavaJoinTableRelationshipStrategy
+ extends AbstractJavaJpaContextNode
+ implements JavaJoinTableRelationshipStrategy
+{
+ public NullJavaJoinTableRelationshipStrategy(JavaJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** join table **********
+
+ public JavaJoinTable getJoinTable() {
+ return null;
+ }
+
+ public JoinTableAnnotation getJoinTableAnnotation() {
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaJoinTableRelationship getParent() {
+ return (JavaJoinTableRelationship) super.getParent();
+ }
+
+ public JavaJoinTableRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) {
+ // NOP
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) {
+ // NOP
+ }
+
+ public String getTableName() {
+ return null;
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return null;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return true;
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return null;
+ }
+
+ public String getJoinTableDefaultName() {
+ return null;
+ }
+
+ public void addStrategy() {
+ // NOP
+ }
+
+ public void removeStrategy() {
+ // NOP
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return false;
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java
new file mode 100644
index 0000000000..1c73603b0a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
+
+public abstract class AbstractOrmConverter
+ extends AbstractOrmXmlContextNode
+ implements OrmConverter
+{
+ protected AbstractOrmConverter(OrmAttributeMapping parent) {
+ super(parent);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmAttributeMapping getParent() {
+ return (OrmAttributeMapping) super.getParent();
+ }
+
+ protected OrmAttributeMapping getAttributeMapping() {
+ return this.getParent();
+ }
+
+ protected XmlAttributeMapping getXmlAttributeMapping() {
+ return this.getAttributeMapping().getXmlAttributeMapping();
+ }
+
+ protected XmlConvertibleMapping getXmlConvertibleMapping() {
+ return (XmlConvertibleMapping) this.getXmlAttributeMapping();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java
new file mode 100644
index 0000000000..4494cddecc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Specified <code>orm.xml</code> override
+ */
+public abstract class AbstractOrmOverride<C extends OrmOverrideContainer, X extends XmlOverride>
+ extends AbstractOrmXmlContextNode
+ implements OrmOverride
+{
+ protected final X xmlOverride;
+
+ protected String name;
+
+
+ protected AbstractOrmOverride(C parent, X xmlOverride) {
+ super(parent);
+ this.xmlOverride = xmlOverride;
+ this.name = xmlOverride.getName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.xmlOverride.getName());
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.setName_(name);
+ this.xmlOverride.setName(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** specified/virtual **********
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ public OrmVirtualOverride convertToVirtual() {
+ return this.getContainer().convertOverrideToVirtual(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public C getParent() {
+ return (C) super.getParent();
+ }
+
+ public C getContainer() {
+ return this.getParent();
+ }
+
+ public X getXmlOverride() {
+ return this.xmlOverride;
+ }
+
+ protected void initializeFrom(ReadOnlyOverride oldOverride) {
+ this.setName(oldOverride.getName());
+ }
+
+ protected void initializeFromVirtual(ReadOnlyOverride virtualOverride) {
+ this.setName(virtualOverride.getName());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.buildValidator().validate(messages, reporter);
+ }
+
+ protected JptValidator buildValidator() {
+ return this.getContainer().buildValidator(this, this.buildTextRangeResolver());
+ }
+
+ protected OverrideTextRangeResolver buildTextRangeResolver() {
+ return new OrmOverrideTextRangeResolver(this);
+ }
+
+ public TextRange getValidationTextRange() {
+ TextRange textRange = this.xmlOverride.getValidationTextRange();
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
+ }
+
+ public TextRange getNameTextRange() {
+ TextRange textRange = this.xmlOverride.getNameTextRange();
+ return (textRange != null) ? textRange : this.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
new file mode 100644
index 0000000000..b2d3ad9903
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
@@ -0,0 +1,472 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.VirtualOverride;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> override container
+ */
+public abstract class AbstractOrmOverrideContainer<
+ O extends OrmOverrideContainer.Owner,
+ R extends OrmReadOnlyOverride,
+ S extends OrmOverride,
+ V extends OrmVirtualOverride,
+ X extends XmlOverride
+ >
+ extends AbstractOrmXmlContextNode
+ implements OrmOverrideContainer
+{
+ // this can be null if the container is "read-only" (i.e. a "null" container)
+ protected final O owner;
+
+ protected final Vector<S> specifiedOverrides = new Vector<S>();
+ protected final SpecifiedOverrideContainerAdapter specifiedOverrideContainerAdapter = new SpecifiedOverrideContainerAdapter();
+
+ protected final Vector<V> virtualOverrides = new Vector<V>();
+ protected final VirtualOverrideContainerAdapter virtualOverrideContainerAdapter = new VirtualOverrideContainerAdapter();
+
+
+ protected AbstractOrmOverrideContainer(XmlContextNode parent, O owner) {
+ super(parent);
+ this.owner = owner;
+ this.initializeSpecifiedOverrides();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedOverrides();
+ // the virtual overrides do not need a sync
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedOverrides());
+ this.updateVirtualOverrides();
+ }
+
+
+ // ********** overrides **********
+
+ public ListIterator<R> overrides() {
+ return this.getOverrides().iterator();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ListIterable<R> getOverrides() {
+ return new CompositeListIterable<R>(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides());
+ }
+
+ public int overridesSize() {
+ return this.specifiedOverrides.size() + this.virtualOverrides.size();
+ }
+
+ public R getOverrideNamed(String name) {
+ return this.selectOverrideNamed(this.getOverrides(), name);
+ }
+
+
+ // ********** override conversions **********
+
+ /**
+ * <em>Silently</em> add the new virtual override before removing the
+ * specified override, or the <em>update</em> will discover the missing
+ * virtual override and add it preemptively.
+ */
+ public V convertOverrideToVirtual(Override_ override) {
+ if (override.isVirtual()) {
+ throw new IllegalArgumentException("Override is already virtual: " + override); //$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unchecked")
+ S specifiedOverride = (S) override;
+ int virtualIndex = this.virtualOverrides.size();
+ String overrideName = specifiedOverride.getName();
+ V virtualOverride = null;
+ // make sure the specified override actually overrides something before building the virtual override
+ if (this.overrideWillBeVirtual(overrideName, specifiedOverride)) {
+ virtualOverride = this.buildVirtualOverride(overrideName);
+ this.virtualOverrides.add(virtualIndex, virtualOverride);
+ }
+
+ this.removeSpecifiedOverride(specifiedOverride); // trigger update
+
+ if (virtualOverride != null) {
+ this.fireItemAdded(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride);
+ }
+ return virtualOverride;
+ }
+
+ /**
+ * Return whether the specified override name will be a
+ * <em>virtual</em> override when the specified specified override is
+ * removed from the container. The override name must be among the
+ * valid override names and it must not correspond to any of the
+ * remaining specified overrides.
+ */
+ protected boolean overrideWillBeVirtual(String overrideName, S specifiedOverrideToBeRemoved) {
+ return CollectionTools.contains(this.allOverridableNames(), overrideName) &&
+ (this.getSpecifiedOverrideNamed(overrideName, specifiedOverrideToBeRemoved) == null);
+ }
+
+ /**
+ * <em>Silently</em> remove the virtual override and add the new specified
+ * override before naming the specified override, or the <em>update</em>
+ * will discover the dangling virtual override and remove it preemptively.
+ */
+ public S convertOverrideToSpecified(VirtualOverride override) {
+ if ( ! override.isVirtual()) {
+ throw new IllegalArgumentException("Override is already specified: " + override); //$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unchecked")
+ V virtualOverride = (V) override;
+ int virtualIndex = this.virtualOverrides.indexOf(virtualOverride);
+ this.virtualOverrides.remove(virtualIndex);
+
+ int specifiedIndex = this.specifiedOverrides.size();
+ X xmlOverride = this.buildXmlOverride();
+ S specifiedOverride = this.buildSpecifiedOverride(xmlOverride);
+ this.specifiedOverrides.add(specifiedIndex, specifiedOverride);
+ this.owner.getXmlOverrides().add(specifiedIndex, xmlOverride);
+
+ this.initializeSpecifiedOverride(specifiedOverride, virtualOverride); // trigger update
+
+ this.fireItemRemoved(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride);
+ this.fireItemAdded(SPECIFIED_OVERRIDES_LIST, specifiedIndex, specifiedOverride);
+ return specifiedOverride;
+ }
+
+ protected abstract void initializeSpecifiedOverride(S specifiedOverride, V virtualOverride);
+
+
+ // ********** specified overrides **********
+
+ public ListIterator<S> specifiedOverrides() {
+ return this.getSpecifiedOverrides().iterator();
+ }
+
+ protected ListIterable<S> getSpecifiedOverrides() {
+ return new LiveCloneListIterable<S>(this.specifiedOverrides);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ListIterable<R> getReadOnlySpecifiedOverrides() {
+ // S should always be a subtype of R, but we can't enforce that in the
+ // class declaration...
+ return (ListIterable<R>) this.getSpecifiedOverrides();
+ }
+
+ public int specifiedOverridesSize() {
+ return this.specifiedOverrides.size();
+ }
+
+ public S getSpecifiedOverride(int index) {
+ return this.specifiedOverrides.get(index);
+ }
+
+ public S getSpecifiedOverrideNamed(String name) {
+ return this.getSpecifiedOverrideNamed(name, null);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected S getSpecifiedOverrideNamed(String name, S exclude) {
+ return (S) this.selectOverrideNamed(this.getReadOnlySpecifiedOverrides(), name, exclude);
+ }
+
+ protected S addSpecifiedOverride() {
+ return this.addSpecifiedOverride(this.specifiedOverrides.size());
+ }
+
+ protected S addSpecifiedOverride(int index) {
+ X xmlOverride = this.buildXmlOverride();
+ S override = this.addSpecifiedOverride_(index, xmlOverride);
+ this.owner.getXmlOverrides().add(index, xmlOverride);
+ return override;
+ }
+
+ protected abstract X buildXmlOverride();
+
+ protected void removeSpecifiedOverride(S override) {
+ this.removeSpecifiedOverride(this.specifiedOverrides.indexOf(override));
+ }
+
+ protected void removeSpecifiedOverride(int index) {
+ this.removeSpecifiedOverride_(index);
+ this.owner.getXmlOverrides().remove(index);
+ }
+
+ protected void removeSpecifiedOverride_(int index) {
+ this.removeItemFromList(index, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedOverride(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ this.owner.getXmlOverrides().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeSpecifiedOverrides() {
+ for (X xmlOverride : this.getXmlOverrides()) {
+ this.specifiedOverrides.add(this.buildSpecifiedOverride(xmlOverride));
+ }
+ }
+
+ protected abstract S buildSpecifiedOverride(X xmlOverride);
+
+ protected void syncSpecifiedOverrides() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedOverrideContainerAdapter);
+ }
+
+ protected Iterable<X> getXmlOverrides() {
+ return (this.owner == null) ? EmptyIterable.<X>instance() : this.getXmlOverrides_();
+ }
+
+ /**
+ * pre-condition: {@link #owner} is not <code>null</code>
+ */
+ protected abstract Iterable<X> getXmlOverrides_();
+
+ protected void moveSpecifiedOverride_(int index, S override) {
+ this.moveItemInList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ }
+
+ protected S addSpecifiedOverride_(int index, X xmlOverride) {
+ S override = this.buildSpecifiedOverride(xmlOverride);
+ this.addItemToList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST);
+ return override;
+ }
+
+ protected void removeSpecifiedOverride_(S override) {
+ this.removeSpecifiedOverride_(this.specifiedOverrides.indexOf(override));
+ }
+
+ /**
+ * specified override container adapter
+ */
+ protected class SpecifiedOverrideContainerAdapter
+ implements ContextContainerTools.Adapter<S, X>
+ {
+ public Iterable<S> getContextElements() {
+ return AbstractOrmOverrideContainer.this.getSpecifiedOverrides();
+ }
+ public Iterable<X> getResourceElements() {
+ return AbstractOrmOverrideContainer.this.getXmlOverrides();
+ }
+ @SuppressWarnings("unchecked")
+ public X getResourceElement(S contextElement) {
+ return (X) contextElement.getXmlOverride();
+ }
+ public void moveContextElement(int index, S element) {
+ AbstractOrmOverrideContainer.this.moveSpecifiedOverride_(index, element);
+ }
+ public void addContextElement(int index, X resourceElement) {
+ AbstractOrmOverrideContainer.this.addSpecifiedOverride_(index, resourceElement);
+ }
+ public void removeContextElement(S element) {
+ AbstractOrmOverrideContainer.this.removeSpecifiedOverride_(element);
+ }
+ }
+
+
+ // ********** virtual overrides **********
+
+ public ListIterator<V> virtualOverrides() {
+ return this.getVirtualOverrides().iterator();
+ }
+
+ protected ListIterable<V> getVirtualOverrides() {
+ return new LiveCloneListIterable<V>(this.virtualOverrides);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ListIterable<R> getReadOnlyVirtualOverrides() {
+ // V should always be a subtype of R, but we can't enforce that in the
+ // class declaration...
+ return (ListIterable<R>) this.getVirtualOverrides();
+ }
+
+ public int virtualOverridesSize() {
+ return this.virtualOverrides.size();
+ }
+
+ protected void updateVirtualOverrides() {
+ ContextContainerTools.update(this.virtualOverrideContainerAdapter);
+ }
+
+ /**
+ * Return the overridable names that are not already in the list of
+ * specified overrides.
+ */
+ protected Iterable<String> getVirtualOverrideNames() {
+ return CollectionTools.iterable(this.virtualOverrideNames());
+ }
+
+ protected Iterator<String> virtualOverrideNames() {
+ return new FilteringIterator<String>(this.allOverridableNames()) {
+ @Override
+ protected boolean accept(String name) {
+ return AbstractOrmOverrideContainer.this.overrideIsVirtual(name);
+ }
+ };
+ }
+
+ protected boolean overrideIsVirtual(String name) {
+ return this.getSpecifiedOverrideNamed(name) == null;
+ }
+
+ protected void moveVirtualOverride(int index, V override) {
+ this.moveItemInList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
+ }
+
+ protected V addVirtualOverride(int index, String name) {
+ V override = this.buildVirtualOverride(name);
+ this.addItemToList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
+ return override;
+ }
+
+ protected abstract V buildVirtualOverride(String name);
+
+ protected void removeVirtualOverride(V override) {
+ this.removeItemFromList(override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST);
+ }
+
+ /**
+ * virtual override container adapter
+ * NB: the context override is matched with a resource override by name
+ */
+ protected class VirtualOverrideContainerAdapter
+ implements ContextContainerTools.Adapter<V, String>
+ {
+ public Iterable<V> getContextElements() {
+ return AbstractOrmOverrideContainer.this.getVirtualOverrides();
+ }
+ public Iterable<String> getResourceElements() {
+ return AbstractOrmOverrideContainer.this.getVirtualOverrideNames();
+ }
+ public String getResourceElement(V contextElement) {
+ return contextElement.getName();
+ }
+ public void moveContextElement(int index, V element) {
+ AbstractOrmOverrideContainer.this.moveVirtualOverride(index, element);
+ }
+ public void addContextElement(int index, String resourceElement) {
+ AbstractOrmOverrideContainer.this.addVirtualOverride(index, resourceElement);
+ }
+ public void removeContextElement(V element) {
+ AbstractOrmOverrideContainer.this.removeVirtualOverride(element);
+ }
+ }
+
+
+ // ********** misc **********
+
+ public TypeMapping getOverridableTypeMapping() {
+ return this.owner.getOverridableTypeMapping();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.owner.getTypeMapping();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ return (this.owner != null) ? this.owner.allOverridableNames() : EmptyIterator.<String>instance();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.owner.tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.owner.candidateTableNames();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return this.owner.resolveDbTable(tableName);
+ }
+
+ public String getDefaultTableName() {
+ return this.owner.getDefaultTableName();
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideTextRangeResolver textRangeResolver) {
+ return this.owner.buildValidator(override, this, textRangeResolver);
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return this.owner.buildColumnValidator(override, column, columnOwner, textRangeResolver);
+ }
+
+ protected R selectOverrideNamed(Iterable<R> overrides, String name) {
+ return this.selectOverrideNamed(overrides, name, null);
+ }
+
+ protected R selectOverrideNamed(Iterable<R> overrides, String name, S exclude) {
+ for (R override : overrides) {
+ if (override == exclude) {
+ continue; // skip
+ }
+ if (this.valuesAreEqual(override.getName(), name)) {
+ return override;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ for (R override : this.getOverrides()) {
+ override.validate(messages, reporter);
+ }
+ }
+
+ public TextRange getValidationTextRange() {
+ return (this.specifiedOverrides.size() > 0) ?
+ this.specifiedOverrides.get(0).getValidationTextRange() :
+ this.owner.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
new file mode 100644
index 0000000000..2a4dd9cd02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+
+/**
+ * Virtual <code>orm.xml</code> override
+ */
+public abstract class AbstractOrmVirtualOverride<C extends OrmOverrideContainer>
+ extends AbstractOrmXmlContextNode
+ implements OrmVirtualOverride
+{
+ protected final String name; // never null
+
+
+ protected AbstractOrmVirtualOverride(C parent, String name) {
+ super(parent);
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ public OrmOverride convertToSpecified() {
+ return this.getContainer().convertOverrideToSpecified(this);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public C getParent() {
+ return (C) super.getParent();
+ }
+
+ public C getContainer() {
+ return this.getParent();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getParent().getValidationTextRange();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java
new file mode 100644
index 0000000000..a6ae9ee62b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+
+/**
+ * <code>orm.xml</code> file
+ * <br>
+ * <code>entity-mappings</code> element
+ */
+public class GenericEntityMappings
+ extends AbstractEntityMappings
+{
+ public GenericEntityMappings(OrmXml parent, XmlEntityMappings resource) {
+ super(parent, resource);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
new file mode 100644
index 0000000000..25b6eb44c7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Specified <code>orm.xml</code> association override
+ */
+public class GenericOrmAssociationOverride
+ extends AbstractOrmOverride<OrmAssociationOverrideContainer, XmlAssociationOverride>
+ implements OrmAssociationOverride
+{
+ protected final OrmOverrideRelationship relationship;
+
+
+ public GenericOrmAssociationOverride(OrmAssociationOverrideContainer parent, XmlAssociationOverride xmlOverride) {
+ super(parent, xmlOverride);
+ this.relationship = this.buildRelationship();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.relationship.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.relationship.update();
+ }
+
+
+ // ********** specified/virtual **********
+
+ @Override
+ public OrmVirtualAssociationOverride convertToVirtual() {
+ return (OrmVirtualAssociationOverride) super.convertToVirtual();
+ }
+
+
+ // ********** relationship **********
+
+ public OrmOverrideRelationship getRelationship() {
+ return this.relationship;
+ }
+
+ protected OrmOverrideRelationship buildRelationship() {
+ return this.getContextNodeFactory().buildOrmOverrideRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ public RelationshipMapping getMapping() {
+ return this.getContainer().getRelationshipMapping(this.name);
+ }
+
+ public void initializeFrom(ReadOnlyAssociationOverride oldOverride) {
+ super.initializeFrom(oldOverride);
+ this.relationship.initializeFrom(oldOverride.getRelationship());
+ }
+
+ public void initializeFromVirtual(ReadOnlyAssociationOverride virtualOverride) {
+ super.initializeFromVirtual(virtualOverride);
+ this.relationship.initializeFromVirtual(virtualOverride.getRelationship());
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.relationship.validate(messages, reporter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
new file mode 100644
index 0000000000..6b34106360
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+
+/**
+ * <code>orm.xml</code> association override container
+ */
+public class GenericOrmAssociationOverrideContainer
+ extends AbstractOrmOverrideContainer<
+ OrmAssociationOverrideContainer.Owner,
+ OrmReadOnlyAssociationOverride,
+ OrmAssociationOverride,
+ OrmVirtualAssociationOverride,
+ XmlAssociationOverride
+ >
+ implements OrmAssociationOverrideContainer
+{
+ public GenericOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) {
+ super(parent, owner);
+ }
+
+
+ public RelationshipMapping getRelationshipMapping(String attributeName) {
+ return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping());
+ }
+
+ public Relationship resolveOverriddenRelationship(String associationOverrideName) {
+ return this.owner.resolveOverriddenRelationship(associationOverrideName);
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.owner.buildJoinTableJoinColumnValidator(override, column, columnOwner, textRangeResolver);
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.owner.buildJoinTableInverseJoinColumnValidator(override, column, columnOwner, textRangeResolver);
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
+ return this.owner.buildTableValidator(override, table, textRangeResolver);
+ }
+
+ @Override
+ protected Iterable<XmlAssociationOverride> getXmlOverrides_() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlAssociationOverride>(this.owner.getXmlOverrides());
+ }
+
+ @Override
+ protected XmlAssociationOverride buildXmlOverride() {
+ return OrmFactory.eINSTANCE.createXmlAssociationOverride();
+ }
+
+ @Override
+ protected OrmAssociationOverride buildSpecifiedOverride(XmlAssociationOverride xmlOverride) {
+ return this.getContextNodeFactory().buildOrmAssociationOverride(this, xmlOverride);
+ }
+
+ @Override
+ protected void initializeSpecifiedOverride(OrmAssociationOverride specifiedOverride, OrmVirtualAssociationOverride virtualOverride) {
+ specifiedOverride.initializeFromVirtual(virtualOverride);
+ }
+
+ @Override
+ protected OrmVirtualAssociationOverride buildVirtualOverride(String name) {
+ return this.getContextNodeFactory().buildOrmVirtualAssociationOverride(this, name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
new file mode 100644
index 0000000000..9e6b30c0dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Specified <code>orm.xml</code> attribute override
+ */
+public class GenericOrmAttributeOverride
+ extends AbstractOrmOverride<OrmAttributeOverrideContainer, XmlAttributeOverride>
+ implements OrmAttributeOverride, OrmColumn.Owner
+{
+ protected final OrmColumn column;
+
+
+ public GenericOrmAttributeOverride(OrmAttributeOverrideContainer parent, XmlAttributeOverride xmlOverride) {
+ super(parent, xmlOverride);
+ this.column = this.buildColumn();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.column.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ }
+
+
+ // ********** specified/virtual **********
+
+ @Override
+ public OrmVirtualAttributeOverride convertToVirtual() {
+ return (OrmVirtualAttributeOverride) super.convertToVirtual();
+ }
+
+
+ // ********** column **********
+
+ public OrmColumn getColumn() {
+ return this.column;
+ }
+
+ protected OrmColumn buildColumn() {
+ return this.getContextNodeFactory().buildOrmColumn(this, this);
+ }
+
+
+ // ********** misc **********
+
+ public void initializeFrom(ReadOnlyAttributeOverride oldOverride) {
+ super.initializeFrom(oldOverride);
+ this.column.initializeFrom(oldOverride.getColumn());
+ }
+
+ public void initializeFromVirtual(ReadOnlyAttributeOverride oldOverride) {
+ super.initializeFromVirtual(oldOverride);
+ this.column.initializeFromVirtual(oldOverride.getColumn());
+ }
+
+
+ // ********** column owner implementation **********
+
+ public TypeMapping getTypeMapping() {
+ return this.getContainer().getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ return this.getContainer().getDefaultTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return this.getContainer().resolveDbTable(tableName);
+ }
+
+ public String getDefaultColumnName() {
+ return this.name;
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
+ return this.getContainer().buildColumnValidator(this, (BaseColumn) col, this, (BaseColumnTextRangeResolver) textRangeResolver);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getContainer().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getContainer().candidateTableNames();
+ }
+
+ public XmlColumn getXmlColumn() {
+ return this.getXmlOverride().getColumn();
+ }
+
+ public XmlColumn buildXmlColumn() {
+ XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
+ this.getXmlOverride().setColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ public void removeXmlColumn() {
+ this.getXmlOverride().setColumn(null);
+ }
+
+
+ // ********** mapped by relationship **********
+
+ protected boolean isMappedByRelationship() {
+ return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.buildQualifier());
+ }
+
+ protected Iterable<String> getMappedByRelationshipAttributeNames() {
+ return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
+ }
+
+ /**
+ * overridable names are (usually?) qualified with a container mapping,
+ * which may also be the one mapped by a relationship
+ */
+ protected String buildQualifier() {
+ if (this.name == null) {
+ return null;
+ }
+ int index = this.name.indexOf('.');
+ return (index == -1) ? this.name : this.name.substring(0, index);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ // [JPA 2.0] if the column is specified, or if the override is not mapped by a relationship,
+ // then the column is validated.
+ // (In JPA 1.0, the column will always be validated, since the override is never mapped by a
+ // relationship)
+ if (this.xmlColumnIsSpecified() || ! this.isMappedByRelationship()) {
+ this.column.validate(messages, reporter);
+ }
+
+ // [JPA 2.0] if the override is mapped by a relationship, then that actually is in itself
+ // a validation error
+ // (We prevent implied overrides that are mapped by a relationship ... hopefully)
+ // (In JPA 1.0, this will never occur)
+ if (this.isMappedByRelationship()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ }
+
+ protected boolean xmlColumnIsSpecified() {
+ return this.getXmlColumn() != null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
new file mode 100644
index 0000000000..7501968550
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+
+/**
+ * <code>orm.xml</code> attribute override container
+ */
+public class GenericOrmAttributeOverrideContainer
+ extends AbstractOrmOverrideContainer<
+ OrmAttributeOverrideContainer.Owner,
+ OrmReadOnlyAttributeOverride,
+ OrmAttributeOverride,
+ OrmVirtualAttributeOverride,
+ XmlAttributeOverride
+ >
+ implements OrmAttributeOverrideContainer
+{
+ public GenericOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner) {
+ super(parent, owner);
+ }
+
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ return (attributeName == null) ? null : this.owner.resolveOverriddenColumn(attributeName);
+ }
+
+ @Override
+ protected Iterable<XmlAttributeOverride> getXmlOverrides_() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlAttributeOverride>(this.owner.getXmlOverrides());
+ }
+
+ @Override
+ protected XmlAttributeOverride buildXmlOverride() {
+ return OrmFactory.eINSTANCE.createXmlAttributeOverride();
+ }
+
+ @Override
+ protected OrmAttributeOverride buildSpecifiedOverride(XmlAttributeOverride xmlOverride) {
+ return this.getContextNodeFactory().buildOrmAttributeOverride(this, xmlOverride);
+ }
+
+ public void initializeFrom(OrmAttributeOverrideContainer oldContainer) {
+ for (OrmAttributeOverride oldOverride : CollectionTools.iterable(oldContainer.specifiedOverrides())) {
+ this.addSpecifiedOverride().initializeFrom(oldOverride);
+ }
+ }
+
+ @Override
+ protected void initializeSpecifiedOverride(OrmAttributeOverride specifiedOverride, OrmVirtualAttributeOverride virtualOverride) {
+ specifiedOverride.initializeFromVirtual(virtualOverride);
+ }
+
+ @Override
+ protected OrmVirtualAttributeOverride buildVirtualOverride(String name) {
+ return this.getContextNodeFactory().buildOrmVirtualAttributeOverride(this, name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
new file mode 100644
index 0000000000..99f763d272
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBasicMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
+
+/**
+ * <code>orm.xml</code> basic mapping
+ */
+public class GenericOrmBasicMapping
+ extends AbstractOrmBasicMapping<XmlBasic>
+{
+ public GenericOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic xmlMapping) {
+ super(parent, xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java
new file mode 100644
index 0000000000..f27fde2d17
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Cascade;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCascade2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.CascadeType;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+
+public class GenericOrmCascade
+ extends AbstractOrmXmlContextNode
+ implements OrmCascade2_0
+{
+ protected boolean all;
+
+ protected boolean persist;
+
+ protected boolean merge;
+
+ protected boolean remove;
+
+ protected boolean refresh;
+
+ /* JPA 2.0 */
+ protected boolean detach;
+
+
+ /**
+ * This is built directly by the mapping implementation; as opposed to via
+ * a platform-specific factory.
+ * @see AbstractOrmRelationshipMapping#buildCascade()
+ */
+ public GenericOrmCascade(OrmRelationshipMapping parent) {
+ super(parent);
+ this.all = this.buildAll();
+ this.persist = this.buildPersist();
+ this.merge = this.buildMerge();
+ this.remove = this.buildRemove();
+ this.refresh = this.buildRefresh();
+ this.detach = this.buildDetach();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setAll_(this.buildAll());
+ this.setPersist_(this.buildPersist());
+ this.setMerge_(this.buildMerge());
+ this.setRemove_(this.buildRemove());
+ this.setRefresh_(this.buildRefresh());
+ this.setDetach_(this.buildDetach());
+ }
+
+
+ // ********** all **********
+
+ public boolean isAll() {
+ return this.all;
+ }
+
+ public void setAll(boolean all) {
+ if (this.all != all) {
+ CascadeType xmlCascade = this.getXmlCascadeForUpdate();
+ this.setAll_(all);
+ xmlCascade.setCascadeAll(all);
+ this.removeXmlCascadeIfUnset();
+ }
+ }
+
+ protected void setAll_(boolean all) {
+ boolean old = this.all;
+ this.all = all;
+ this.firePropertyChanged(ALL_PROPERTY, old, all);
+ }
+
+ protected boolean buildAll() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) && xmlCascade.isCascadeAll();
+ }
+
+
+ // ********** persist **********
+
+ public boolean isPersist() {
+ return this.persist;
+ }
+
+ public void setPersist(boolean persist) {
+ if (this.persist != persist) {
+ CascadeType xmlCascade = this.getXmlCascadeForUpdate();
+ this.setPersist_(persist);
+ xmlCascade.setCascadePersist(persist);
+ this.removeXmlCascadeIfUnset();
+ }
+ }
+
+ protected boolean setPersist_(boolean persist) {
+ boolean old = this.persist;
+ this.persist = persist;
+ return this.firePropertyChanged(PERSIST_PROPERTY, old, persist);
+ }
+
+ protected boolean buildPersist() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) && xmlCascade.isCascadePersist();
+ }
+
+
+ // ********** merge **********
+
+ public boolean isMerge() {
+ return this.merge;
+ }
+
+ public void setMerge(boolean merge) {
+ if (this.merge != merge) {
+ CascadeType xmlCascade = this.getXmlCascadeForUpdate();
+ this.setMerge_(merge);
+ xmlCascade.setCascadeMerge(merge);
+ this.removeXmlCascadeIfUnset();
+ }
+ }
+
+ protected boolean setMerge_(boolean merge) {
+ boolean old = this.merge;
+ this.merge = merge;
+ return this.firePropertyChanged(MERGE_PROPERTY, old, merge);
+ }
+
+ protected boolean buildMerge() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) && xmlCascade.isCascadeMerge();
+ }
+
+
+ // ********** remove **********
+
+ public boolean isRemove() {
+ return this.remove;
+ }
+
+ public void setRemove(boolean remove) {
+ if (this.remove != remove) {
+ CascadeType xmlCascade = this.getXmlCascadeForUpdate();
+ this.setRemove_(remove);
+ xmlCascade.setCascadeRemove(remove);
+ this.removeXmlCascadeIfUnset();
+ }
+ }
+
+ protected boolean setRemove_(boolean remove) {
+ boolean old = this.remove;
+ this.remove = remove;
+ return this.firePropertyChanged(REMOVE_PROPERTY, old, remove);
+ }
+
+ protected boolean buildRemove() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) && xmlCascade.isCascadeRemove();
+ }
+
+
+ // ********** refresh **********
+
+ public boolean isRefresh() {
+ return this.refresh;
+ }
+
+ public void setRefresh(boolean refresh) {
+ if (this.refresh != refresh) {
+ CascadeType xmlCascade = this.getXmlCascadeForUpdate();
+ this.setRefresh_(refresh);
+ xmlCascade.setCascadeRefresh(refresh);
+ this.removeXmlCascadeIfUnset();
+ }
+ }
+
+ protected boolean setRefresh_(boolean refresh) {
+ boolean old = this.refresh;
+ this.refresh = refresh;
+ return this.firePropertyChanged(REFRESH_PROPERTY, old, refresh);
+ }
+
+ protected boolean buildRefresh() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) && xmlCascade.isCascadeRefresh();
+ }
+
+
+ // ********** detach **********
+
+ public boolean isDetach() {
+ return this.detach;
+ }
+
+ public void setDetach(boolean detach) {
+ if (this.detach != detach) {
+ CascadeType xmlCascade = this.getXmlCascadeForUpdate();
+ this.setDetach_(detach);
+ xmlCascade.setCascadeDetach(detach);
+ this.removeXmlCascadeIfUnset();
+ }
+ }
+
+ protected boolean setDetach_(boolean detach) {
+ boolean old = this.detach;
+ this.detach = detach;
+ return this.firePropertyChanged(DETACH_PROPERTY, old, detach);
+ }
+
+ protected boolean buildDetach() {
+ return this.isJpa2_0Compatible() && this.buildDetach_();
+ }
+
+ protected boolean buildDetach_() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) && xmlCascade.isCascadeDetach();
+ }
+
+
+ // ********** XML cascade **********
+
+ /**
+ * Return <code>null</code> if XML cascade does not exists.
+ */
+ protected CascadeType getXmlCascade() {
+ return this.getXmlRelationshipMapping().getCascade();
+ }
+
+ /**
+ * Build the XML cascade if it does not exist.
+ */
+ protected CascadeType getXmlCascadeForUpdate() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) ? xmlCascade : this.buildXmlCascade();
+ }
+
+ protected CascadeType buildXmlCascade() {
+ CascadeType xmlCascade = OrmFactory.eINSTANCE.createCascadeType();
+ this.getXmlRelationshipMapping().setCascade(xmlCascade);
+ return xmlCascade;
+ }
+
+ protected void removeXmlCascadeIfUnset() {
+ if (this.getXmlCascade().isUnset()) {
+ this.removeXmlCascade();
+ }
+ }
+
+ protected void removeXmlCascade() {
+ this.getXmlRelationshipMapping().setCascade(null);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmRelationshipMapping getParent() {
+ return (OrmRelationshipMapping) super.getParent();
+ }
+
+ protected OrmRelationshipMapping getRelationshipMapping() {
+ return this.getParent();
+ }
+
+ protected AbstractXmlRelationshipMapping getXmlRelationshipMapping() {
+ return this.getRelationshipMapping().getXmlAttributeMapping();
+ }
+
+ public void initializeFrom(Cascade oldCascade) {
+ this.setAll(oldCascade.isAll());
+ this.setPersist(oldCascade.isPersist());
+ this.setMerge(oldCascade.isMerge());
+ this.setRemove(oldCascade.isRemove());
+ this.setRefresh(oldCascade.isRefresh());
+ if (this.isJpa2_0Compatible()) {
+ this.setDetach(((Cascade2_0) oldCascade).isDetach());
+ }
+ }
+
+ public TextRange getValidationTextRange() {
+ CascadeType xmlCascade = this.getXmlCascade();
+ return (xmlCascade != null) ?
+ xmlCascade.getValidationTextRange() :
+ this.getRelationshipMapping().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java
new file mode 100644
index 0000000000..6e254476eb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0, which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+
+/**
+ * <code>orm.xml</code> column
+ */
+public class GenericOrmColumn
+ extends AbstractOrmBaseColumn<XmlColumn, OrmColumn.Owner>
+ implements OrmColumn
+{
+ // TODO defaults from java for all of these settings
+ protected Integer specifiedLength;
+
+ protected Integer specifiedPrecision;
+
+ protected Integer specifiedScale;
+
+
+ public GenericOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) {
+ super(parent, owner);
+ this.specifiedLength = this.buildSpecifiedLength();
+ this.specifiedPrecision = this.buildSpecifiedPrecision();
+ this.specifiedScale = this.buildSpecifiedScale();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedLength_(this.buildSpecifiedLength());
+ this.setSpecifiedPrecision_(this.buildSpecifiedPrecision());
+ this.setSpecifiedScale_(this.buildSpecifiedScale());
+ }
+
+
+ // ********** XML column **********
+
+ @Override
+ public XmlColumn getXmlColumn() {
+ return this.owner.getXmlColumn();
+ }
+
+ @Override
+ protected XmlColumn buildXmlColumn() {
+ return this.owner.buildXmlColumn();
+ }
+
+ @Override
+ protected void removeXmlColumn() {
+ this.owner.removeXmlColumn();
+ }
+
+
+ // ********** length **********
+
+ public int getLength() {
+ return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.getDefaultLength();
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer length) {
+ if (this.valuesAreDifferent(this.specifiedLength, length)) {
+ XmlColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedLength_(length);
+ xmlColumn.setLength(length);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedLength_(Integer length) {
+ Integer old = this.specifiedLength;
+ this.specifiedLength = length;
+ this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
+ }
+
+ protected Integer buildSpecifiedLength() {
+ XmlColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getLength();
+ }
+
+ public int getDefaultLength() {
+ return DEFAULT_LENGTH;
+ }
+
+
+ // ********** precision **********
+
+ public int getPrecision() {
+ return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.getDefaultPrecision();
+ }
+
+ public Integer getSpecifiedPrecision() {
+ return this.specifiedPrecision;
+ }
+
+ public void setSpecifiedPrecision(Integer precision) {
+ if (this.valuesAreDifferent(this.specifiedPrecision, precision)) {
+ XmlColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedPrecision_(precision);
+ xmlColumn.setPrecision(precision);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedPrecision_(Integer precision) {
+ Integer old = this.specifiedPrecision;
+ this.specifiedPrecision = precision;
+ this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
+ }
+
+ protected Integer buildSpecifiedPrecision() {
+ XmlColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getPrecision();
+ }
+
+ public int getDefaultPrecision() {
+ return DEFAULT_PRECISION;
+ }
+
+
+ // ********** scale **********
+
+ public int getScale() {
+ return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.getDefaultScale();
+ }
+
+ public Integer getSpecifiedScale() {
+ return this.specifiedScale;
+ }
+
+ public void setSpecifiedScale(Integer scale) {
+ if (this.valuesAreDifferent(this.specifiedScale, scale)) {
+ XmlColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedScale_(scale);
+ xmlColumn.setScale(scale);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedScale_(Integer scale) {
+ Integer old = this.specifiedScale;
+ this.specifiedScale = scale;
+ this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
+ }
+
+ protected Integer buildSpecifiedScale() {
+ XmlColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getScale();
+ }
+
+ public int getDefaultScale() {
+ return DEFAULT_SCALE;
+ }
+
+
+ // ********** misc **********
+
+ public void initializeFrom(ReadOnlyColumn oldColumn) {
+ super.initializeFrom(oldColumn);
+ this.setSpecifiedLength(oldColumn.getSpecifiedLength());
+ this.setSpecifiedPrecision(oldColumn.getSpecifiedPrecision());
+ this.setSpecifiedScale(oldColumn.getSpecifiedScale());
+ }
+
+ public void initializeFromVirtual(ReadOnlyColumn virtualColumn) {
+ super.initializeFromVirtual(virtualColumn);
+ // ignore other settings?
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
new file mode 100644
index 0000000000..be90386975
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0, which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn;
+
+/**
+ * <code>orm.xml</code> discriminator column
+ */
+public class GenericOrmDiscriminatorColumn
+ extends AbstractOrmNamedColumn<XmlDiscriminatorColumn, OrmDiscriminatorColumn.Owner>
+ implements OrmDiscriminatorColumn
+{
+ protected DiscriminatorType specifiedDiscriminatorType;
+ protected DiscriminatorType defaultDiscriminatorType;
+
+ protected Integer specifiedLength;
+ protected int defaultLength;
+
+
+ public GenericOrmDiscriminatorColumn(XmlContextNode parent, OrmDiscriminatorColumn.Owner owner) {
+ super(parent, owner);
+ this.specifiedDiscriminatorType = this.buildSpecifiedDiscriminatorType();
+ this.specifiedLength = this.buildSpecifiedLength();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedDiscriminatorType_(this.buildSpecifiedDiscriminatorType());
+ this.setSpecifiedLength_(this.buildSpecifiedLength());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType());
+ this.setDefaultLength(this.buildDefaultLength());
+ }
+
+
+ // ********** XML column **********
+
+ @Override
+ public XmlDiscriminatorColumn getXmlColumn() {
+ return this.owner.getXmlColumn();
+ }
+
+ @Override
+ protected XmlDiscriminatorColumn buildXmlColumn() {
+ return this.owner.buildXmlColumn();
+ }
+
+ @Override
+ protected void removeXmlColumn() {
+ this.owner.removeXmlColumn();
+ }
+
+
+ // ********** discriminator type **********
+
+ public DiscriminatorType getDiscriminatorType() {
+ return (this.specifiedDiscriminatorType != null) ? this.specifiedDiscriminatorType : this.defaultDiscriminatorType;
+ }
+
+ public DiscriminatorType getSpecifiedDiscriminatorType() {
+ return this.specifiedDiscriminatorType;
+ }
+
+ public void setSpecifiedDiscriminatorType(DiscriminatorType discriminatorType) {
+ if (this.valuesAreDifferent(this.specifiedDiscriminatorType, discriminatorType)) {
+ XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedDiscriminatorType_(discriminatorType);
+ xmlColumn.setDiscriminatorType(DiscriminatorType.toOrmResourceModel(discriminatorType));
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedDiscriminatorType_(DiscriminatorType discriminatorType) {
+ DiscriminatorType old = this.specifiedDiscriminatorType;
+ this.specifiedDiscriminatorType = discriminatorType;
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
+ }
+
+ protected DiscriminatorType buildSpecifiedDiscriminatorType() {
+ XmlDiscriminatorColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : DiscriminatorType.fromOrmResourceModel(xmlColumn.getDiscriminatorType());
+ }
+
+ public DiscriminatorType getDefaultDiscriminatorType() {
+ return this.defaultDiscriminatorType;
+ }
+
+ protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) {
+ DiscriminatorType old = this.defaultDiscriminatorType;
+ this.defaultDiscriminatorType = discriminatorType;
+ this.firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
+ }
+
+ protected DiscriminatorType buildDefaultDiscriminatorType() {
+ return this.owner.getDefaultDiscriminatorType();
+ }
+
+
+ // ********** length **********
+
+ public int getLength() {
+ return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer length) {
+ if (this.valuesAreDifferent(this.specifiedLength, length)) {
+ XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedLength_(length);
+ xmlColumn.setLength(length);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedLength_(Integer length) {
+ Integer old = this.specifiedLength;
+ this.specifiedLength = length;
+ this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
+ }
+
+ protected Integer buildSpecifiedLength() {
+ XmlDiscriminatorColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getLength();
+ }
+
+ public int getDefaultLength() {
+ return this.defaultLength;
+ }
+
+ protected void setDefaultLength(int defaultLength) {
+ int old = this.defaultLength;
+ this.defaultLength = defaultLength;
+ this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, defaultLength);
+ }
+
+ protected int buildDefaultLength() {
+ return this.owner.getDefaultLength();
+ }
+
+
+ // ********** validation **********
+
+ public boolean isResourceSpecified() {
+ return this.getXmlColumn() != null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
new file mode 100644
index 0000000000..9ecf827277
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Oracle. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+
+/**
+ * <code>orm.xml</code> embeddable type mapping
+ */
+public class GenericOrmEmbeddable
+ extends AbstractOrmEmbeddable<XmlEmbeddable>
+{
+ public GenericOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
+ super(parent, resourceMapping);
+ }
+
+ @Override
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return ArrayTools.contains(GenericJavaEmbeddable.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
new file mode 100644
index 0000000000..b8fad23d1c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedIdMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> embedded ID mapping
+ */
+public class GenericOrmEmbeddedIdMapping
+ extends AbstractOrmBaseEmbeddedMapping<XmlEmbeddedId>
+ implements EmbeddedIdMapping2_0, OrmEmbeddedIdMapping
+{
+ /* JPA 2.0 feature - a relationship may map this embedded ID */
+ protected boolean mappedByRelationship;
+
+
+ public GenericOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId xmlMapping) {
+ super(parent, xmlMapping);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.setMappedByRelationship(this.buildMappedByRelationship());
+ }
+
+
+ // ********** mapped by relationship **********
+
+ public boolean isMappedByRelationship() {
+ return this.mappedByRelationship;
+ }
+
+ protected void setMappedByRelationship(boolean value) {
+ boolean old = this.mappedByRelationship;
+ this.mappedByRelationship = value;
+ this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, value);
+ }
+
+ protected boolean buildMappedByRelationship() {
+ return this.isJpa2_0Compatible() && this.buildMappedByRelationship_();
+ }
+
+ protected boolean buildMappedByRelationship_() {
+ return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.name);
+ }
+
+ protected Iterable<String> getMappedByRelationshipAttributeNames() {
+ return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping());
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 10;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmEmbeddedIdMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
+ xmlAttributes.getEmbeddedIds().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
+ xmlAttributes.getEmbeddedIds().remove(this.xmlAttributeMapping);
+ }
+
+ @Override
+ protected Iterator<String> embeddableOverridableAttributeMappingNames() {
+ return this.mappedByRelationship ?
+ EmptyIterator.<String>instance() :
+ super.embeddableOverridableAttributeMappingNames();
+ }
+
+ @Override
+ protected OrmAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() {
+ return new AttributeOverrideContainerOwner();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ // [JPA 2.0] if the embedded id is mapped by a relationship, then any specified
+ // attribute overrides are in error
+ // (in JPA 1.0, this will obviously never be reached)
+ if (this.mappedByRelationship
+ && (this.attributeOverrideContainer.specifiedOverridesSize() > 0)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED,
+ EMPTY_STRING_ARRAY,
+ this.attributeOverrideContainer,
+ this.attributeOverrideContainer.getValidationTextRange()
+ )
+ );
+ }
+ }
+
+
+ // ********** attribute override container owner *********
+
+ protected class AttributeOverrideContainerOwner
+ extends AbstractOrmBaseEmbeddedMapping<XmlEmbeddedId>.AttributeOverrideContainerOwner
+ {
+ @Override
+ public Iterator<String> allOverridableNames() {
+ return GenericOrmEmbeddedIdMapping.this.isMappedByRelationship() ?
+ EmptyIterator.<String>instance() :
+ super.allOverridableNames();
+ }
+
+ /**
+ * pre-condition: type mapping is not <code>null</code>
+ */
+ @Override
+ protected Iterator<String> allOverridableAttributeNames_(TypeMapping typeMapping) {
+ final Set<String> mappedByRelationshipAttributeNames = this.buildMappedByRelationshipAttributeNames();
+ if (mappedByRelationshipAttributeNames.isEmpty()) {
+ return super.allOverridableAttributeNames_(typeMapping);
+ }
+ return new FilteringIterator<String>(super.allOverridableAttributeNames_(typeMapping)) {
+ @Override
+ protected boolean accept(String attributeName) {
+ // overridable names are (usually?) qualified with a container mapping,
+ // which may also be the one mapped by a relationship
+ int dotIndex = attributeName.indexOf('.');
+ String qualifier = (dotIndex > 0) ? attributeName.substring(0, dotIndex) : attributeName;
+ return ! mappedByRelationshipAttributeNames.contains(qualifier);
+ }
+ };
+ }
+
+ protected Set<String> buildMappedByRelationshipAttributeNames() {
+ return CollectionTools.set(GenericOrmEmbeddedIdMapping.this.getMappedByRelationshipAttributeNames());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
new file mode 100644
index 0000000000..aa025b16e4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> embedded mapping
+ */
+public class GenericOrmEmbeddedMapping
+ extends AbstractOrmBaseEmbeddedMapping<XmlEmbedded>
+ implements OrmEmbeddedMapping2_0
+{
+ protected final OrmAssociationOverrideContainer associationOverrideContainer;
+
+
+ public GenericOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded xmlMapping) {
+ super(parent, xmlMapping);
+ this.associationOverrideContainer = this.buildAssociationOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.associationOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.associationOverrideContainer.update();
+ }
+
+
+ // ********** association override container **********
+
+ public OrmAssociationOverrideContainer getAssociationOverrideContainer() {
+ return this.associationOverrideContainer;
+ }
+
+ protected OrmAssociationOverrideContainer buildAssociationOverrideContainer() {
+ return this.isJpa2_0Compatible() ?
+ this.getContextNodeFactory2_0().buildOrmAssociationOverrideContainer(this, this.buildAssociationOverrideContainerOwner()) :
+ new GenericOrmAssociationOverrideContainer(this, null);
+ }
+
+ protected OrmAssociationOverrideContainer.Owner buildAssociationOverrideContainerOwner() {
+ return new AssociationOverrideContainerOwner();
+ }
+
+
+ // ********** embedded mappings **********
+
+ /**
+ * This is only to build the choices for a "mapped by" setting in a
+ * relationship mapping. JPA 2.0 does not support relationship mappings
+ * in an embedded ID class; so we only put this logic here.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterator<String> allMappingNames() {
+ return this.isJpa2_0Compatible() ?
+ new CompositeIterator<String>(super.allMappingNames(), this.allEmbeddableAttributeMappingNames()) :
+ super.allMappingNames();
+ }
+
+ protected Iterator<String> allEmbeddableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<RelationshipMapping> allOverridableAssociations() {
+ return (this.targetEmbeddable != null) ?
+ new SubIteratorWrapper<AttributeMapping, RelationshipMapping>(this.allOverridableAssociations_()) :
+ EmptyIterator.<RelationshipMapping>instance();
+ }
+
+ protected Iterator<AttributeMapping> allOverridableAssociations_() {
+ return new FilteringIterator<AttributeMapping>(this.targetEmbeddable.attributeMappings()) {
+ @Override
+ protected boolean accept(AttributeMapping attributeMapping) {
+ return attributeMapping.isOverridableAssociationMapping();
+ }
+ };
+ }
+
+ @Override
+ public AttributeMapping resolveAttributeMapping(String attributeName) {
+ AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ return this.isJpa2_0Compatible() ? this.resolveAttributeMapping_(attributeName) : null;
+ }
+
+ protected AttributeMapping resolveAttributeMapping_(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ // recurse into the embeddable mappings
+ for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) {
+ AttributeMapping resolvedMapping = mapping.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 80;
+ }
+
+ protected JavaEmbeddedMapping2_0 getJavaEmbeddedMapping2_0() {
+ return (JavaEmbeddedMapping2_0) this.getJavaEmbeddedMapping();
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmEmbeddedMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
+ xmlAttributes.getEmbeddeds().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
+ xmlAttributes.getEmbeddeds().remove(this.xmlAttributeMapping);
+ }
+
+ protected JavaAssociationOverride getSpecifiedJavaAssociationOverrideNamed(String attributeName) {
+ JavaEmbeddedMapping2_0 javaMapping = this.getJavaEmbeddedMapping2_0();
+ return (javaMapping == null) ? null : javaMapping.getAssociationOverrideContainer().getSpecifiedOverrideNamed(attributeName);
+ }
+
+ @Override
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ return this.isJpa2_0Compatible() ? this.resolveOverriddenRelationship_(attributeName) : null;
+ }
+
+ protected Relationship resolveOverriddenRelationship_(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getRelationship() : this.resolveOverriddenRelationshipInTargetEmbeddable(attributeName);
+ }
+
+ protected Relationship resolveOverriddenRelationshipInTargetEmbeddable(String attributeName) {
+ return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenRelationship(attributeName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected void validateOverrides(List<IMessage> messages, IReporter reporter) {
+ super.validateOverrides(messages, reporter);
+ this.associationOverrideContainer.validate(messages, reporter);
+ }
+
+
+ // ********** association override container owner **********
+
+ protected class AssociationOverrideContainerOwner
+ implements OrmAssociationOverrideContainer.Owner
+ {
+ protected String getMappingName() {
+ return GenericOrmEmbeddedMapping.this.getName();
+ }
+
+ public OrmTypeMapping getTypeMapping() {
+ return GenericOrmEmbeddedMapping.this.getTypeMapping();
+ }
+
+ public TypeMapping getOverridableTypeMapping() {
+ return GenericOrmEmbeddedMapping.this.getTargetEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.<String>instance();
+ }
+
+ public EList<XmlAssociationOverride> getXmlOverrides() {
+ return GenericOrmEmbeddedMapping.this.getXmlAttributeMapping().getAssociationOverrides();
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return this.getTypeMapping().tableNameIsInvalid(tableName);
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return this.getTypeMapping().allAssociatedTableNames();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public String getDefaultTableName() {
+ return this.getTypeMapping().getPrimaryTableName();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmEmbeddedMapping.this.getValidationTextRange();
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideValidator(this.getPersistentAttribute(), (AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideInverseJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinTableValidator(this.getPersistentAttribute(), override, (JoinTable) table, textRangeResolver);
+ }
+
+ protected OrmPersistentAttribute getPersistentAttribute() {
+ return GenericOrmEmbeddedMapping.this.getPersistentAttribute();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java
new file mode 100644
index 0000000000..469d04a4e8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEntity;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
+
+public class GenericOrmEntity
+ extends AbstractOrmEntity<XmlEntity>
+{
+ // EclipseLink holds its cacheable in its caching
+ protected final OrmCacheable2_0 cacheable;
+
+
+ public GenericOrmEntity(OrmPersistentType parent, XmlEntity xmlEntity) {
+ super(parent, xmlEntity);
+ this.cacheable = this.buildCacheable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.cacheable.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.cacheable.update();
+ }
+
+
+ // ********** cacheable **********
+
+ public OrmCacheable2_0 getCacheable() {
+ return this.cacheable;
+ }
+
+ protected OrmCacheable2_0 buildCacheable() {
+ return this.isJpa2_0Compatible() ?
+ this.getContextNodeFactory2_0().buildOrmCacheable(this) :
+ new NullOrmCacheable2_0(this);
+ }
+
+ public boolean calculateDefaultCacheable() {
+ CacheableHolder2_0 javaEntity = (CacheableHolder2_0) this.getJavaTypeMappingForDefaults();
+ if (javaEntity != null) {
+ return javaEntity.getCacheable().isCacheable();
+ }
+
+ Cacheable2_0 parentCacheable = this.getParentCacheable();
+ return (parentCacheable != null) ?
+ parentCacheable.isCacheable() :
+ ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable();
+ }
+
+ protected Cacheable2_0 getParentCacheable() {
+ CacheableHolder2_0 parentEntity = (CacheableHolder2_0) this.getParentEntity();
+ return (parentEntity == null) ? null : parentEntity.getCacheable();
+ }
+
+ public XmlCacheable_2_0 getXmlCacheable() {
+ return this.getXmlTypeMapping();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
new file mode 100644
index 0000000000..d923aec695
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.EnumType;
+import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class GenericOrmEnumeratedConverter
+ extends AbstractOrmConverter
+ implements OrmEnumeratedConverter
+{
+ protected EnumType specifiedEnumType;
+ protected EnumType defaultEnumType;
+
+
+ public GenericOrmEnumeratedConverter(OrmAttributeMapping parent) {
+ super(parent);
+ this.specifiedEnumType = this.buildSpecifiedEnumType();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedEnumType_(this.buildSpecifiedEnumType());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultEnumType(this.buildDefaultEnumType());
+ }
+
+
+ // ********** enum type **********
+
+ public EnumType getEnumType() {
+ return (this.specifiedEnumType != null) ? this.specifiedEnumType : this.getDefaultEnumType();
+ }
+
+ public EnumType getSpecifiedEnumType() {
+ return this.specifiedEnumType;
+ }
+
+ public void setSpecifiedEnumType(EnumType enumType) {
+ this.setSpecifiedEnumType_(enumType);
+ this.setXmlEnumerated(enumType);
+ }
+
+ protected void setSpecifiedEnumType_(EnumType enumType) {
+ EnumType old = this.specifiedEnumType;
+ this.specifiedEnumType = enumType;
+ this.firePropertyChanged(SPECIFIED_ENUM_TYPE_PROPERTY, old, enumType);
+ }
+
+ protected void setXmlEnumerated(EnumType enumType) {
+ this.getXmlConvertibleMapping().setEnumerated(EnumType.toOrmResourceModel(enumType));
+ }
+
+ protected EnumType buildSpecifiedEnumType() {
+ return EnumType.fromOrmResourceModel(this.getXmlConvertibleMapping().getEnumerated());
+ }
+
+ public EnumType getDefaultEnumType() {
+ return this.defaultEnumType;
+ }
+
+ protected void setDefaultEnumType(EnumType enumType) {
+ EnumType old = this.defaultEnumType;
+ this.defaultEnumType = enumType;
+ this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType);
+ }
+
+ /**
+ * There is no default enum type in XML.
+ * If you specify the enumerated element, you must
+ * specify either {@link EnumType#ORDINAL} or
+ * {@link EnumType#STRING}.
+ */
+ protected EnumType buildDefaultEnumType() {
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ public Class<? extends Converter> getType() {
+ return EnumeratedConverter.class;
+ }
+
+ public void initialize() {
+ this.specifiedEnumType = DEFAULT_ENUM_TYPE;
+ this.setXmlEnumerated(this.specifiedEnumType);
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return EmptyIterable.instance();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getXmlConvertibleMapping().getEnumeratedTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
new file mode 100644
index 0000000000..107502d1fe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.GenerationType;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> generated value
+ */
+public class GenericOrmGeneratedValue
+ extends AbstractOrmXmlContextNode
+ implements OrmGeneratedValue
+{
+ protected final XmlGeneratedValue xmlGeneratedValue;
+
+ protected GenerationType specifiedStrategy;
+ protected GenerationType defaultStrategy;
+
+ protected String specifiedGenerator;
+ protected String defaultGenerator;
+
+
+ public GenericOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue xmlGeneratedValue) {
+ super(parent);
+ this.xmlGeneratedValue = xmlGeneratedValue;
+ this.specifiedStrategy = this.buildSpecifiedStrategy();
+ this.specifiedGenerator = xmlGeneratedValue.getGenerator();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedStrategy_(this.buildSpecifiedStrategy());
+ this.setSpecifiedGenerator_(this.xmlGeneratedValue.getGenerator());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultStrategy(this.buildDefaultStrategy());
+ this.setDefaultGenerator(this.buildDefaultGenerator());
+ }
+
+
+ // ********** strategy **********
+
+ public GenerationType getStrategy() {
+ return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.defaultStrategy;
+ }
+
+ public GenerationType getSpecifiedStrategy() {
+ return this.specifiedStrategy;
+ }
+
+ public void setSpecifiedStrategy(GenerationType strategy) {
+ this.setSpecifiedStrategy_(strategy);
+ this.xmlGeneratedValue.setStrategy(GenerationType.toOrmResourceModel(strategy));
+ }
+
+ protected void setSpecifiedStrategy_(GenerationType strategy) {
+ GenerationType old = this.specifiedStrategy;
+ this.specifiedStrategy = strategy;
+ this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected GenerationType buildSpecifiedStrategy() {
+ return GenerationType.fromOrmResourceModel(this.xmlGeneratedValue.getStrategy());
+ }
+
+ public GenerationType getDefaultStrategy() {
+ return this.defaultStrategy;
+ }
+
+ protected void setDefaultStrategy(GenerationType strategy) {
+ GenerationType old = this.defaultStrategy;
+ this.defaultStrategy = strategy;
+ this.firePropertyChanged(DEFAULT_STRATEGY_PROPERTY, old, strategy);
+ }
+
+ // TODO
+ protected GenerationType buildDefaultStrategy() {
+ return DEFAULT_STRATEGY;
+ }
+
+
+ // ********** generator **********
+
+ public String getGenerator() {
+ return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator;
+ }
+
+ public String getSpecifiedGenerator() {
+ return this.specifiedGenerator;
+ }
+
+ public void setSpecifiedGenerator(String generator) {
+ this.setSpecifiedGenerator_(generator);
+ this.xmlGeneratedValue.setGenerator(generator);
+ }
+
+ protected void setSpecifiedGenerator_(String generator) {
+ String old = this.specifiedGenerator;
+ this.specifiedGenerator = generator;
+ this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
+ }
+
+ public String getDefaultGenerator() {
+ return this.defaultGenerator;
+ }
+
+ protected void setDefaultGenerator(String generator) {
+ String old = this.defaultGenerator;
+ this.defaultGenerator = generator;
+ this.firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, old, generator);
+ }
+
+ // TODO
+ protected String buildDefaultGenerator() {
+ return null;
+ }
+
+ public TextRange getGeneratorTextRange() {
+ TextRange textRange = this.xmlGeneratedValue.getGeneratorTextRange();
+ return textRange != null ? textRange : this.getValidationTextRange();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public XmlContextNode getParent() {
+ return (XmlContextNode) super.getParent();
+ }
+
+ public XmlGeneratedValue getXmlGeneratedValue() {
+ return this.xmlGeneratedValue;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ String generator = this.getGenerator();
+ if (generator == null) {
+ return;
+ }
+
+ for (Iterator<Generator> stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) {
+ if (generator.equals(stream.next().getName())) {
+ return;
+ }
+ }
+
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME,
+ new String[] {generator},
+ this.getParent(),
+ this.getGeneratorTextRange()
+ )
+ );
+ }
+
+ public TextRange getValidationTextRange() {
+ TextRange validationTextRange = this.xmlGeneratedValue.getValidationTextRange();
+ return (validationTextRange != null) ? validationTextRange : this.getParent().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
new file mode 100644
index 0000000000..7cca101c7a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmGeneratorContainer
+ extends AbstractOrmXmlContextNode
+ implements OrmGeneratorContainer
+{
+ protected final XmlGeneratorContainer xmlGeneratorContainer;
+
+ protected OrmSequenceGenerator sequenceGenerator;
+
+ protected OrmTableGenerator tableGenerator;
+
+
+ public GenericOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer xmlGeneratorContainer) {
+ super(parent);
+ this.xmlGeneratorContainer = xmlGeneratorContainer;
+ this.sequenceGenerator = this.buildSequenceGenerator();
+ this.tableGenerator = this.buildTableGenerator();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSequenceGenerator();
+ this.syncTableGenerator();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ if (this.sequenceGenerator != null) {
+ this.sequenceGenerator.update();
+ }
+ if (this.tableGenerator != null) {
+ this.tableGenerator.update();
+ }
+ }
+
+
+ // ********** sequence generator **********
+
+ public OrmSequenceGenerator getSequenceGenerator() {
+ return this.sequenceGenerator;
+ }
+
+ public OrmSequenceGenerator addSequenceGenerator() {
+ if (this.sequenceGenerator != null) {
+ throw new IllegalStateException("sequence generator already exists: " + this.sequenceGenerator); //$NON-NLS-1$
+ }
+ XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator();
+ OrmSequenceGenerator generator = this.buildSequenceGenerator(xmlGenerator);
+ this.setSequenceGenerator_(generator);
+ this.xmlGeneratorContainer.setSequenceGenerator(xmlGenerator);
+ return generator;
+ }
+
+ protected XmlSequenceGenerator buildXmlSequenceGenerator() {
+ return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
+ }
+
+ public void removeSequenceGenerator() {
+ if (this.sequenceGenerator == null) {
+ throw new IllegalStateException("sequence generator does not exist"); //$NON-NLS-1$
+ }
+ this.setSequenceGenerator_(null);
+ this.xmlGeneratorContainer.setSequenceGenerator(null);
+ }
+
+ protected OrmSequenceGenerator buildSequenceGenerator() {
+ XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator();
+ return (xmlGenerator == null) ? null : this.buildSequenceGenerator(xmlGenerator);
+ }
+
+ protected XmlSequenceGenerator getXmlSequenceGenerator() {
+ return this.xmlGeneratorContainer.getSequenceGenerator();
+ }
+
+ protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator xmlSequenceGenerator) {
+ return this.getContextNodeFactory().buildOrmSequenceGenerator(this, xmlSequenceGenerator);
+ }
+
+ protected void syncSequenceGenerator() {
+ XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator();
+ if (xmlGenerator == null) {
+ if (this.sequenceGenerator != null) {
+ this.setSequenceGenerator_(null);
+ }
+ } else {
+ if ((this.sequenceGenerator != null) && (this.sequenceGenerator.getXmlGenerator() == xmlGenerator)) {
+ this.sequenceGenerator.synchronizeWithResourceModel();
+ } else {
+ this.setSequenceGenerator_(this.buildSequenceGenerator(xmlGenerator));
+ }
+ }
+ }
+
+ protected void setSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) {
+ OrmSequenceGenerator old = this.sequenceGenerator;
+ this.sequenceGenerator = sequenceGenerator;
+ this.firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, old, sequenceGenerator);
+ }
+
+
+ // ********** table generator **********
+
+ public OrmTableGenerator getTableGenerator() {
+ return this.tableGenerator;
+ }
+
+ public OrmTableGenerator addTableGenerator() {
+ if (this.tableGenerator != null) {
+ throw new IllegalStateException("table generator already exists: " + this.tableGenerator); //$NON-NLS-1$
+ }
+ XmlTableGenerator xmlGenerator = this.buildXmlTableGenerator();
+ OrmTableGenerator generator = this.buildTableGenerator(xmlGenerator);
+ this.setTableGenerator_(generator);
+ this.xmlGeneratorContainer.setTableGenerator(xmlGenerator);
+ return generator;
+ }
+
+ protected XmlTableGenerator buildXmlTableGenerator() {
+ return OrmFactory.eINSTANCE.createXmlTableGenerator();
+ }
+
+ public void removeTableGenerator() {
+ if (this.tableGenerator == null) {
+ throw new IllegalStateException("table generator does not exist"); //$NON-NLS-1$
+ }
+ this.setTableGenerator_(null);
+ this.xmlGeneratorContainer.setTableGenerator(null);
+ }
+
+ protected OrmTableGenerator buildTableGenerator() {
+ XmlTableGenerator xmlGenerator = this.getXmlTableGenerator();
+ return (xmlGenerator == null) ? null : this.buildTableGenerator(xmlGenerator);
+ }
+
+ protected XmlTableGenerator getXmlTableGenerator() {
+ return this.xmlGeneratorContainer.getTableGenerator();
+ }
+
+ protected OrmTableGenerator buildTableGenerator(XmlTableGenerator xmlTableGenerator) {
+ return this.getContextNodeFactory().buildOrmTableGenerator(this, xmlTableGenerator);
+ }
+
+ protected void syncTableGenerator() {
+ XmlTableGenerator xmlGenerator = this.getXmlTableGenerator();
+ if (xmlGenerator == null) {
+ if (this.tableGenerator != null) {
+ this.setTableGenerator_(null);
+ }
+ } else {
+ if ((this.tableGenerator != null) && (this.tableGenerator.getXmlGenerator() == xmlGenerator)) {
+ this.tableGenerator.synchronizeWithResourceModel();
+ } else {
+ this.setTableGenerator_(this.buildTableGenerator(xmlGenerator));
+ }
+ }
+ }
+
+ protected void setTableGenerator_(OrmTableGenerator tableGenerator) {
+ OrmTableGenerator old = this.tableGenerator;
+ this.tableGenerator = tableGenerator;
+ this.firePropertyChanged(TABLE_GENERATOR_PROPERTY, old, tableGenerator);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateGenerators(messages);
+ }
+
+ protected void validateGenerators(List<IMessage> messages) {
+ for (OrmGenerator localGenerator : this.getGenerators()) {
+ String name = localGenerator.getName();
+ if (StringTools.stringIsEmpty(name)){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.GENERATOR_NAME_UNDEFINED,
+ new String[] {},
+ localGenerator,
+ localGenerator.getNameTextRange()
+ )
+ );
+ } else {
+ List<String> reportedNames = new ArrayList<String>();
+ for (Iterator<Generator> globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) {
+ if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.GENERATOR_DUPLICATE_NAME,
+ new String[] {name},
+ localGenerator,
+ localGenerator.getNameTextRange()
+ )
+ );
+ reportedNames.add(name);
+ }
+ }
+ }
+ }
+ }
+
+ protected Iterable<OrmGenerator> getGenerators() {
+ ArrayList<OrmGenerator> generators = new ArrayList<OrmGenerator>();
+ this.addGeneratorsTo(generators);
+ return generators;
+ }
+
+ protected void addGeneratorsTo(ArrayList<OrmGenerator> generators) {
+ if (this.sequenceGenerator != null) {
+ generators.add(this.sequenceGenerator);
+ }
+ if (this.tableGenerator != null) {
+ generators.add(this.tableGenerator);
+ }
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.xmlGeneratorContainer.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
new file mode 100644
index 0000000000..958b87ddf5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmIdMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
+
+/**
+ * <code>orm.xml</code> ID mapping
+ */
+public class GenericOrmIdMapping
+ extends AbstractOrmIdMapping<XmlId>
+{
+ public GenericOrmIdMapping(OrmPersistentAttribute parent, XmlId xmlMapping) {
+ super(parent, xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
new file mode 100644
index 0000000000..165d659ec5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * <code>orm.xml</code> join column
+ */
+public class GenericOrmJoinColumn
+ extends AbstractOrmBaseColumn<XmlJoinColumn, OrmJoinColumn.Owner>
+ implements OrmJoinColumn
+{
+ /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */
+ protected /* final */ XmlJoinColumn xmlColumn; // null for default join columns
+
+ protected String specifiedReferencedColumnName;
+ protected String defaultReferencedColumnName;
+
+
+ public GenericOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner) {
+ this(parent, owner, null);
+ }
+
+ public GenericOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn xmlColumn) {
+ super(parent, owner, xmlColumn);
+ this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
+ }
+
+
+ // ********** XML column **********
+
+ @Override
+ public XmlJoinColumn getXmlColumn() {
+ return this.xmlColumn;
+ }
+
+ @Override
+ protected void setXmlColumn(XmlJoinColumn xmlColumn) {
+ this.xmlColumn = xmlColumn;
+ }
+
+ /**
+ * join columns are part of a collection;
+ * the 'join-column' element will be removed/added
+ * when the XML join column is removed from/added to
+ * the owner's collection
+ */
+ @Override
+ protected XmlJoinColumn buildXmlColumn() {
+ throw new IllegalStateException("XML join column is missing"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see #buildXmlColumn()
+ */
+ @Override
+ protected void removeXmlColumn() {
+ // do nothing
+ }
+
+
+ // ********** referenced column name **********
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ public void setSpecifiedReferencedColumnName(String name) {
+ this.setSpecifiedReferencedColumnName_(name);
+ this.getXmlColumn().setReferencedColumnName(name);
+ }
+
+ protected void setSpecifiedReferencedColumnName_(String name) {
+ String old = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = name;
+ this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedReferencedColumnName() {
+ XmlJoinColumn joinColumn = this.getXmlColumn();
+ return (joinColumn == null) ? null : joinColumn.getReferencedColumnName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String name) {
+ String old = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = name;
+ this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultReferencedColumnName() {
+ return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner);
+ }
+
+
+ // ********** database stuff **********
+
+ public Table getReferencedColumnDbTable() {
+ return this.owner.getReferencedColumnDbTable();
+ }
+
+ protected Column getReferencedDbColumn() {
+ Table table = this.getReferencedColumnDbTable();
+ return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
+ }
+
+ public boolean referencedColumnIsResolved() {
+ return this.getReferencedDbColumn() != null;
+ }
+
+
+ // ********** misc **********
+
+ public void initializeFrom(ReadOnlyJoinColumn oldColumn) {
+ super.initializeFrom(oldColumn);
+ this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName());
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinColumn virtualColumn) {
+ super.initializeFromVirtual(virtualColumn);
+ this.setSpecifiedReferencedColumnName(virtualColumn.getReferencedColumnName());
+ }
+
+ public boolean isDefault() {
+ return this.owner.joinColumnIsDefault(this);
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return MappingTools.buildJoinColumnDefaultName(this, this.owner);
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getTextRange(this.xmlColumn.getReferencedColumnNameTextRange());
+ }
+
+ @Override
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmJoinColumnTextRangeResolver(this);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
new file mode 100644
index 0000000000..a1bfda698f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
@@ -0,0 +1,511 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> join table
+ */
+public class GenericOrmJoinTable
+ extends GenericOrmReferenceTable<XmlJoinTable>
+ implements OrmJoinTable
+{
+ protected final Vector<OrmJoinColumn> specifiedInverseJoinColumns = new Vector<OrmJoinColumn>();
+ protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final OrmJoinColumn.Owner inverseJoinColumnOwner;
+
+ protected OrmJoinColumn defaultInverseJoinColumn;
+
+
+ public GenericOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Owner owner) {
+ super(parent, owner);
+ this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
+ this.initializeSpecifiedInverseJoinColumns();
+ }
+
+ @Override
+ protected OrmJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedInverseJoinColumns();
+ if (this.defaultInverseJoinColumn != null) {
+ this.defaultInverseJoinColumn.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedInverseJoinColumns());
+ this.updateDefaultInverseJoinColumn();
+ }
+
+
+ // ********** XML table **********
+
+ @Override
+ protected XmlJoinTable getXmlTable() {
+ return this.getJoinStrategy().getXmlJoinTable();
+ }
+
+ @Override
+ protected XmlJoinTable buildXmlTable() {
+ return this.getJoinStrategy().buildXmlJoinTable();
+ }
+
+ @Override
+ protected void removeXmlTable() {
+ this.getJoinStrategy().removeXmlJoinTable();
+ }
+
+
+ // ********** inverse join columns **********
+
+ public ListIterator<OrmJoinColumn> inverseJoinColumns() {
+ return this.getInverseJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmJoinColumn> getInverseJoinColumns() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
+ }
+
+ public int inverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
+ }
+
+ public void convertDefaultToSpecifiedInverseJoinColumn() {
+ MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this);
+ }
+
+
+ // ********** specified inverse join columns **********
+
+ public ListIterator<OrmJoinColumn> specifiedInverseJoinColumns() {
+ return this.getSpecifiedInverseJoinColumns().iterator();
+ }
+
+ public ListIterable<OrmJoinColumn> getSpecifiedInverseJoinColumns() {
+ return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedInverseJoinColumns);
+ }
+
+ public int specifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedInverseJoinColumns() {
+ return this.specifiedInverseJoinColumns.size() != 0;
+ }
+
+ public OrmJoinColumn getSpecifiedInverseJoinColumn(int index) {
+ return this.specifiedInverseJoinColumns.get(index);
+ }
+
+ public OrmJoinColumn addSpecifiedInverseJoinColumn() {
+ return this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size());
+ }
+
+ public OrmJoinColumn addSpecifiedInverseJoinColumn(int index) {
+ XmlJoinTable xmlTable = this.getXmlTableForUpdate();
+ XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
+ OrmJoinColumn joinColumn = this.addSpecifiedInverseJoinColumn_(index, xmlJoinColumn);
+ xmlTable.getInverseJoinColumns().add(index, xmlJoinColumn);
+ return joinColumn;
+ }
+
+ public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
+ this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedInverseJoinColumn(int index) {
+ this.removeSpecifiedInverseJoinColumn_(index);
+ this.getXmlTable().getInverseJoinColumns().remove(index);
+ this.removeXmlTableIfUnset();
+ }
+
+ protected void removeSpecifiedInverseJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.getXmlTable().getInverseJoinColumns().move(targetIndex, sourceIndex);
+ }
+
+ public void clearSpecifiedInverseJoinColumns() {
+ this.clearCollection(this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.getXmlTable().getInverseJoinColumns().clear();
+ }
+
+ protected void initializeSpecifiedInverseJoinColumns() {
+ for (XmlJoinColumn xmlJoinColumn : this.getXmlInverseJoinColumns()) {
+ this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(xmlJoinColumn));
+ }
+ }
+
+ protected void syncSpecifiedInverseJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedInverseJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<XmlJoinColumn> getXmlInverseJoinColumns() {
+ XmlJoinTable xmlTable = this.getXmlTable();
+ return (xmlTable == null) ?
+ EmptyIterable.<XmlJoinColumn>instance() :
+ // clone to reduce chance of concurrency problems
+ new LiveCloneIterable<XmlJoinColumn>(xmlTable.getInverseJoinColumns());
+ }
+
+ protected void moveSpecifiedInverseJoinColumn_(int index, OrmJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmJoinColumn addSpecifiedInverseJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
+ OrmJoinColumn joinColumn = this.buildInverseJoinColumn(xmlJoinColumn);
+ this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedInverseJoinColumn_(OrmJoinColumn joinColumn) {
+ this.removeSpecifiedInverseJoinColumn_(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ }
+
+ /**
+ * specified inverse join column container adapter
+ */
+ protected class SpecifiedInverseJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
+ {
+ public Iterable<OrmJoinColumn> getContextElements() {
+ return GenericOrmJoinTable.this.getSpecifiedInverseJoinColumns();
+ }
+ public Iterable<XmlJoinColumn> getResourceElements() {
+ return GenericOrmJoinTable.this.getXmlInverseJoinColumns();
+ }
+ public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
+ return contextElement.getXmlColumn();
+ }
+ public void moveContextElement(int index, OrmJoinColumn element) {
+ GenericOrmJoinTable.this.moveSpecifiedInverseJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, XmlJoinColumn resourceElement) {
+ GenericOrmJoinTable.this.addSpecifiedInverseJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(OrmJoinColumn element) {
+ GenericOrmJoinTable.this.removeSpecifiedInverseJoinColumn_(element);
+ }
+ }
+
+ protected OrmJoinColumn.Owner buildInverseJoinColumnOwner() {
+ return new InverseJoinColumnOwner();
+ }
+
+
+ // ********** default inverse join column **********
+
+ public OrmJoinColumn getDefaultInverseJoinColumn() {
+ return this.defaultInverseJoinColumn;
+ }
+
+ protected void setDefaultInverseJoinColumn(OrmJoinColumn joinColumn) {
+ OrmJoinColumn old = this.defaultInverseJoinColumn;
+ this.defaultInverseJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn);
+ }
+
+ protected ListIterable<OrmJoinColumn> getDefaultInverseJoinColumns() {
+ return (this.defaultInverseJoinColumn != null) ?
+ new SingleElementListIterable<OrmJoinColumn>(this.defaultInverseJoinColumn) :
+ EmptyListIterable.<OrmJoinColumn>instance();
+ }
+
+ protected int getDefaultInverseJoinColumnsSize() {
+ return (this.defaultInverseJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultInverseJoinColumn() {
+ if (this.buildsDefaultInverseJoinColumn()) {
+ if (this.defaultInverseJoinColumn == null) {
+ this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(null));
+ } else {
+ this.defaultInverseJoinColumn.update();
+ }
+ } else {
+ this.setDefaultInverseJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultInverseJoinColumn() {
+ return ! this.hasSpecifiedInverseJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmJoinTableRelationshipStrategy getParent() {
+ return (OrmJoinTableRelationshipStrategy) super.getParent();
+ }
+
+ protected OrmJoinTableRelationshipStrategy getJoinStrategy() {
+ return this.getParent();
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return this.getJoinStrategy().getJoinTableDefaultName();
+ }
+
+ public void initializeFrom(ReadOnlyJoinTable oldTable) {
+ super.initializeFrom(oldTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedInverseJoinColumns())) {
+ this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn);
+ }
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) {
+ super.initializeFromVirtual(virtualTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.inverseJoinColumns())) {
+ this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn);
+ }
+ }
+
+ protected OrmJoinColumn buildInverseJoinColumn(XmlJoinColumn xmlJoinColumn) {
+ return this.getContextNodeFactory().buildOrmJoinColumn(this, this.inverseJoinColumnOwner, xmlJoinColumn);
+ }
+
+ public RelationshipMapping getRelationshipMapping() {
+ return this.getJoinStrategy().getRelationship().getMapping();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getRelationshipMapping().getPersistentAttribute();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected void validateJoinColumns(List<IMessage> messages, IReporter reporter) {
+ super.validateJoinColumns(messages, reporter);
+ this.validateJoinColumns(this.getInverseJoinColumns(), messages, reporter);
+ }
+
+ public boolean validatesAgainstDatabase() {
+ return this.getJoinStrategy().validatesAgainstDatabase();
+ }
+
+
+ // ********** join column owners **********
+
+ /**
+ * just a little common behavior
+ */
+ protected abstract class AbstractJoinColumnOwner
+ implements OrmJoinColumn.Owner
+ {
+ protected AbstractJoinColumnOwner() {
+ super();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericOrmJoinTable.this.getJoinStrategy().getRelationship().getTypeMapping();
+ }
+
+ protected PersistentAttribute getPersistentAttribute() {
+ return GenericOrmJoinTable.this.getPersistentAttribute();
+ }
+
+ /**
+ * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
+ */
+ public String getDefaultColumnName() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * If there is a specified table name it needs to be the same
+ * the default table name. the table is always the join table
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
+ }
+
+ /**
+ * the join column can only be on the join table itself
+ */
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return Tools.valuesAreEqual(GenericOrmJoinTable.this.getName(), tableName) ?
+ GenericOrmJoinTable.this.getDbTable() :
+ null;
+ }
+
+ /**
+ * by default, the join column is, obviously, in the join table;
+ * not sure whether it can be anywhere else...
+ */
+ public String getDefaultTableName() {
+ return GenericOrmJoinTable.this.getName();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmJoinTable.this.getValidationTextRange();
+ }
+
+ protected boolean isPersistentAttributeVirtual() {
+ return this.getPersistentAttribute().isVirtual();
+ }
+
+ protected String getPersistentAttributeName() {
+ return this.getPersistentAttribute().getName();
+ }
+
+ protected OrmJoinTableRelationshipStrategy getJoinStrategy() {
+ return GenericOrmJoinTable.this.getJoinStrategy();
+ }
+ }
+
+
+ /**
+ * owner for "back-pointer" join columns;
+ * these point at the source/owning entity
+ */
+ protected class JoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ return this.getJoinStrategy().getRelationship().getEntity();
+ }
+
+ public String getAttributeName() {
+ return MappingTools.getTargetAttributeName(GenericOrmJoinTable.this.getRelationshipMapping());
+ }
+
+ @Override
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
+ return (dbTable != null) ? dbTable : this.getTypeMapping().resolveDbTable(tableName);
+ }
+
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ return this.getTypeMapping().getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmJoinTable.this.defaultJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmJoinTable.this.joinColumnsSize();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return this.getJoinStrategy().buildJoinTableJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+
+
+ /**
+ * owner for "forward-pointer" join columns;
+ * these point at the target/inverse entity
+ */
+ protected class InverseJoinColumnOwner
+ extends AbstractJoinColumnOwner
+ {
+ protected InverseJoinColumnOwner() {
+ super();
+ }
+
+ public Entity getRelationshipTarget() {
+ RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
+ }
+
+ public String getAttributeName() {
+ RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping();
+ return (relationshipMapping == null) ? null : relationshipMapping.getName();
+ }
+
+ @Override
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
+ if (dbTable != null) {
+ return dbTable;
+ }
+ Entity relationshipTarget = this.getRelationshipTarget();
+ return (relationshipTarget == null) ? null : relationshipTarget.resolveDbTable(tableName);
+ }
+
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ Entity relationshipTarget = this.getRelationshipTarget();
+ return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmJoinTable.this.defaultInverseJoinColumn == joinColumn;
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmJoinTable.this.inverseJoinColumnsSize();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return this.getJoinStrategy().buildJoinTableInverseJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
new file mode 100644
index 0000000000..324ceb7bff
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.LobConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class GenericOrmLobConverter
+ extends AbstractOrmConverter
+ implements OrmLobConverter
+{
+ public GenericOrmLobConverter(OrmAttributeMapping parent) {
+ super(parent);
+ }
+
+
+ // ********** misc **********
+
+ public Class<? extends Converter> getType() {
+ return LobConverter.class;
+ }
+
+ public void initialize() {
+ this.getXmlConvertibleMapping().setLob(true);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getXmlConvertibleMapping().getLobTextRange();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return EmptyIterable.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
new file mode 100644
index 0000000000..6a002b3d2e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToManyMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
+
+public class GenericOrmManyToManyMapping
+ extends AbstractOrmManyToManyMapping<XmlManyToMany>
+{
+ public GenericOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany xmlMapping) {
+ super(parent, xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
new file mode 100644
index 0000000000..740c4e01e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToOneMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
+
+public class GenericOrmManyToOneMapping
+ extends AbstractOrmManyToOneMapping<XmlManyToOne>
+{
+ public GenericOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne xmlMapping) {
+ super(parent, xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
new file mode 100644
index 0000000000..45014549d5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmMappedSuperclass;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
+
+/**
+ * <code>orm.xml</code> mapped superclass
+ */
+public class GenericOrmMappedSuperclass
+ extends AbstractOrmMappedSuperclass<XmlMappedSuperclass>
+{
+ public GenericOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) {
+ super(parent, resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
new file mode 100644
index 0000000000..ffc4ce61b8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
+
+/**
+ * <code>orm.xml</code> named native query
+ */
+public class GenericOrmNamedNativeQuery
+ extends AbstractOrmQuery<XmlNamedNativeQuery>
+ implements OrmNamedNativeQuery
+{
+ protected String resultClass;
+
+ protected String resultSetMapping;
+
+
+ public GenericOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery xmlNamedNativeQuery) {
+ super(parent, xmlNamedNativeQuery);
+ this.resultClass = xmlNamedNativeQuery.getResultClass();
+ this.resultSetMapping = xmlNamedNativeQuery.getResultSetMapping();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setResultClass_(this.xmlQuery.getResultClass());
+ this.setResultSetMapping_(this.xmlQuery.getResultSetMapping());
+ }
+
+
+ // ********** result class **********
+
+ public String getResultClass() {
+ return this.resultClass;
+ }
+
+ public void setResultClass(String resultClass) {
+ this.setResultClass_(resultClass);
+ this.xmlQuery.setResultClass(resultClass);
+ }
+
+ protected void setResultClass_(String resultClass) {
+ String old = this.resultClass;
+ this.resultClass = resultClass;
+ this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
+ }
+
+ public char getResultClassEnclosingTypeSeparator() {
+ return '$';
+ }
+
+
+ // ********** result set mapping **********
+
+ public String getResultSetMapping() {
+ return this.resultSetMapping;
+ }
+
+ public void setResultSetMapping(String resultSetMapping) {
+ this.setResultSetMapping_(resultSetMapping);
+ this.xmlQuery.setResultSetMapping(resultSetMapping);
+ }
+
+ protected void setResultSetMapping_(String resultSetMapping) {
+ String old = this.resultSetMapping;
+ this.resultSetMapping = resultSetMapping;
+ this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
new file mode 100644
index 0000000000..35ef25259f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
+
+/**
+ * <code>orm.xml</code> named query
+ */
+public class GenericOrmNamedQuery
+ extends AbstractOrmQuery<XmlNamedQuery>
+ implements OrmNamedQuery
+{
+ public GenericOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
+ super(parent, resourceNamedQuery);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
new file mode 100644
index 0000000000..374f84e338
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
+
+/**
+ * <code>orm.xml</code> null attribute mapping
+ */
+public class GenericOrmNullAttributeMapping
+ extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
+{
+ public GenericOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) {
+ super(parent, xmlMapping);
+ }
+
+ public String getKey() {
+ return null;
+ }
+
+ public int getXmlSequence() {
+ return -1;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmAttributeMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ********** metamodel **********
+
+ @Override
+ public MetamodelField getMetamodelField() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
new file mode 100644
index 0000000000..4fdad7ce7b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToManyMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
+
+public class GenericOrmOneToManyMapping
+ extends AbstractOrmOneToManyMapping<XmlOneToMany>
+{
+ public GenericOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany xmlMapping) {
+ super(parent, xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
new file mode 100644
index 0000000000..e89cef7e89
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToOneMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
+
+/**
+ * <code>orm.xml</code> 1:1 mapping
+ */
+public class GenericOrmOneToOneMapping
+ extends AbstractOrmOneToOneMapping<XmlOneToOne>
+{
+ public GenericOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne xmlMapping) {
+ super(parent, xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
new file mode 100644
index 0000000000..a86fd056d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
@@ -0,0 +1,452 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.OrderColumnValidator;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> ordering
+ * <p>
+ * <strong>NB:</strong> Setting any flag to <code>false</code> (or setting the
+ * specified "order by" to <code>null</code>) can be a bit unpredictable. The
+ * intent is to set a flag to <code>true</code> (or set the specified "order by"
+ * to a non-<code>null</code> value).
+ * <p>
+ * <strong>(JPA 2.0 only) NB:</strong> If both the "order-by" and the
+ * "order-column" elements are present (which is prohibited by the JPA spec),
+ * both are ignored.
+ */
+public class GenericOrmOrderable
+ extends AbstractOrmXmlContextNode
+ implements OrmOrderable2_0
+{
+ protected String specifiedOrderBy;
+ protected boolean noOrdering = false;
+ protected boolean pkOrdering = false;
+ protected boolean customOrdering = false;
+
+ // JPA 2.0
+ protected final Owner owner; // this is null for JPA 1.0 mappings
+ protected boolean orderColumnOrdering = false;
+ protected final OrmOrderColumn2_0 orderColumn; // this is null for JPA 1.0 mappings
+
+
+ /**
+ * JPA 1.0
+ */
+ public GenericOrmOrderable(OrmAttributeMapping parent) {
+ this(parent, null);
+ }
+
+ /**
+ * JPA 2.0
+ */
+ public GenericOrmOrderable(OrmAttributeMapping parent, Owner owner) {
+ super(parent);
+
+ this.specifiedOrderBy = this.buildSpecifiedOrderBy();
+ this.noOrdering = this.buildNoOrdering();
+ this.pkOrdering = this.buildPkOrdering();
+ this.customOrdering = this.buildCustomOrdering();
+
+ this.owner = owner;
+ this.orderColumnOrdering = this.buildOrderColumnOrdering();
+ this.orderColumn = this.buildOrderColumn();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+
+ this.setSpecifiedOrderBy_(this.buildSpecifiedOrderBy());
+ this.setNoOrdering_(this.buildNoOrdering());
+ this.setPkOrdering_(this.buildPkOrdering());
+ this.setCustomOrdering_(this.buildCustomOrdering());
+
+ this.setOrderColumnOrdering_(this.buildOrderColumnOrdering());
+ if (this.orderColumn != null) {
+ this.orderColumn.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ if (this.orderColumn != null) {
+ this.orderColumn.update();
+ }
+ }
+
+
+ // ********** specified order by **********
+
+ public String getSpecifiedOrderBy() {
+ return this.specifiedOrderBy;
+ }
+
+ public void setSpecifiedOrderBy(String orderBy) {
+ if (orderBy != null) {
+ this.setSpecifiedOrderBy_(orderBy);
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(orderBy.length() == 0);
+ this.setCustomOrdering_(orderBy.length() != 0);
+ this.setOrderColumnOrdering_(false);
+
+ this.removeXmlOrderColumn();
+ this.getXmlOrderable().setOrderBy(orderBy);
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setSpecifiedOrderBy_(String orderBy) {
+ String old = this.specifiedOrderBy;
+ this.specifiedOrderBy = orderBy;
+ this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
+ }
+
+ protected String buildSpecifiedOrderBy() {
+ if (this.xmlOrderColumnIsPresent()) {
+ return null;
+ }
+ return this.getXmlOrderBy();
+ }
+
+
+ // ********** no ordering **********
+
+ public boolean isNoOrdering() {
+ return this.noOrdering;
+ }
+
+ public void setNoOrdering(boolean noOrdering) {
+ if (noOrdering) {
+ this.setSpecifiedOrderBy_(null);
+ this.setNoOrdering_(true);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(false);
+
+ this.removeXmlOrderColumn();
+ this.getXmlOrderable().setOrderBy(null);
+ } else {
+ this.setPkOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setNoOrdering_(boolean noOrdering) {
+ boolean old = this.noOrdering;
+ this.noOrdering = noOrdering;
+ this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
+ }
+
+ protected boolean buildNoOrdering() {
+ return this.isJpa2_0Compatible() ? this.buildNoOrdering2_0() : this.buildNoOrdering1_0();
+ }
+
+ /**
+ * both elements are missing <em>or</em> both are present
+ */
+ protected boolean buildNoOrdering2_0() {
+ boolean orderByMissing = (this.getXmlOrderBy() == null);
+ boolean orderByPresent = ! orderByMissing;
+ boolean orderColumnMissing = (this.getXmlOrderColumn() == null);
+ boolean orderColumnPresent = ! orderColumnMissing;
+ return (orderByMissing && orderColumnMissing) || (orderByPresent && orderColumnPresent);
+ }
+
+ /**
+ * the order-by element is missing
+ */
+ protected boolean buildNoOrdering1_0() {
+ return this.getXmlOrderBy() == null;
+ }
+
+
+ // ********** pk ordering **********
+
+ public boolean isPkOrdering() {
+ return this.pkOrdering;
+ }
+
+ public void setPkOrdering(boolean pkOrdering) {
+ if (pkOrdering) {
+ this.setSpecifiedOrderBy(""); //$NON-NLS-1$
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setPkOrdering_(boolean pkOrdering) {
+ boolean old = this.pkOrdering;
+ this.pkOrdering = pkOrdering;
+ this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
+ }
+
+ /**
+ * the order-by element is present but no value specified
+ */
+ protected boolean buildPkOrdering() {
+ if (this.xmlOrderColumnIsPresent()) {
+ return false;
+ }
+ String xmlOrderBy = this.getXmlOrderBy();
+ return (xmlOrderBy != null) && (xmlOrderBy.length() == 0);
+ }
+
+
+ // ********** custom ordering **********
+
+ public boolean isCustomOrdering() {
+ return this.customOrdering;
+ }
+
+ /**
+ * Unfortunately, setting the "custom ordering" flag directly is a bit hacky:
+ * The "specified order-by" is initially set to an empty string, which is
+ * the same as a "primary key ordering" state....
+ */
+ public void setCustomOrdering(boolean customOrdering) {
+ if (customOrdering) {
+ this.setSpecifiedOrderBy_(""); // hmmm... //$NON-NLS-1$
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(true);
+ this.setOrderColumnOrdering_(false);
+
+ this.removeXmlOrderColumn();
+ this.getXmlOrderable().setOrderBy(""); //$NON-NLS-1$
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setCustomOrdering_(boolean customOrdering) {
+ boolean old = this.customOrdering;
+ this.customOrdering = customOrdering;
+ this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
+ }
+
+ /**
+ * the order-by element is present and it has a specified value
+ */
+ protected boolean buildCustomOrdering() {
+ if (this.xmlOrderColumnIsPresent()) {
+ return false;
+ }
+ String xmlOrderBy = this.getXmlOrderBy();
+ return (xmlOrderBy != null) && (xmlOrderBy.length() != 0);
+ }
+
+
+ // ********** order column ordering **********
+
+ public boolean isOrderColumnOrdering() {
+ return this.orderColumnOrdering;
+ }
+
+ public void setOrderColumnOrdering(boolean orderColumnOrdering) {
+ if (orderColumnOrdering) {
+ this.setSpecifiedOrderBy_(null);
+ this.setNoOrdering_(false);
+ this.setPkOrdering_(false);
+ this.setCustomOrdering_(false);
+ this.setOrderColumnOrdering_(true);
+
+ this.getXmlOrderable().setOrderBy(null);
+ this.buildXmlOrderColumn();
+ } else {
+ this.setNoOrdering(true); // hmmm...
+ }
+ }
+
+ protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
+ boolean old = this.orderColumnOrdering;
+ this.orderColumnOrdering = orderColumnOrdering;
+ this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
+ }
+
+ /**
+ * JPA 2.0 only;
+ * the <code>order-column</code> element is present <em>and</em>
+ * the <code>order-by</code> element is missing
+ */
+ protected boolean buildOrderColumnOrdering() {
+ return this.xmlOrderColumnIsPresent() &&
+ (this.getXmlOrderBy() == null);
+ }
+
+
+ // ********** order column **********
+
+ public OrmOrderColumn2_0 getOrderColumn() {
+ return this.orderColumn;
+ }
+
+ /**
+ * JPA 2.0 only
+ */
+ protected OrmOrderColumn2_0 buildOrderColumn() {
+ return this.isJpa2_0Compatible() ? this.buildOrderColumn_() : null;
+ }
+
+ protected OrmOrderColumn2_0 buildOrderColumn_() {
+ return this.getContextNodeFactory2_0().buildOrmOrderColumn(this, new OrderColumnOwner());
+ }
+
+
+ // ********** xml order by **********
+
+ protected String getXmlOrderBy() {
+ return this.getXmlOrderable().getOrderBy();
+ }
+
+
+ // ********** xml order column **********
+
+ protected XmlOrderColumn getXmlOrderColumn() {
+ return this.getXmlOrderable().getOrderColumn();
+ }
+
+ /**
+ * NB: Only return <code>true</code> for JPA 2.0 mappings.
+ */
+ protected boolean xmlOrderColumnIsPresent() {
+ return this.isJpa2_0Compatible() && (this.getXmlOrderColumn() != null);
+ }
+
+ protected XmlOrderColumn buildXmlOrderColumn() {
+ XmlOrderColumn xmlColumn = OrmFactory.eINSTANCE.createXmlOrderColumn();
+ GenericOrmOrderable.this.getXmlOrderable().setOrderColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ protected void removeXmlOrderColumn() {
+ if (this.xmlOrderColumnIsPresent()) {
+ this.getXmlOrderable().setOrderColumn(null);
+ }
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmAttributeMapping getParent() {
+ return (OrmAttributeMapping) super.getParent();
+ }
+
+ protected OrmAttributeMapping getAttributeMapping() {
+ return this.getParent();
+ }
+
+ protected OrmPersistentAttribute getPersistentAttribute() {
+ return this.getAttributeMapping().getPersistentAttribute();
+ }
+
+ protected XmlOrderable getXmlOrderable() {
+ return (XmlOrderable) this.getAttributeMapping().getXmlAttributeMapping();
+ }
+
+ // JPA 2.0
+ public String getDefaultTableName() {
+ return this.owner.getTableName();
+ }
+
+ // JPA 2.0
+ protected Table resolveDbTable(String tableName) {
+ return this.owner.resolveDbTable(tableName);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ TextRange textRange = this.getXmlOrderable().getValidationTextRange();
+ return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange();
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ // order-column and order-by both specified is handled with schema validation
+ if (this.orderColumnOrdering) {
+ // TODO validation message if type is not List
+ this.orderColumn.validate(messages, reporter);
+ }
+ }
+
+
+ // ********** order column owner (JPA 2.0) **********
+
+ protected class OrderColumnOwner
+ implements OrmOrderColumn2_0.Owner
+ {
+ public String getDefaultTableName() {
+ return GenericOrmOrderable.this.getDefaultTableName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericOrmOrderable.this.resolveDbTable(tableName);
+ }
+
+ public String getDefaultColumnName() {
+ return this.getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getPersistentAttribute().getOwningTypeMapping();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmOrderable.this.getValidationTextRange();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new OrderColumnValidator(this.getPersistentAttribute(), (OrderColumn2_0) column, textRangeResolver);
+ }
+
+ public XmlOrderColumn getXmlColumn() {
+ return GenericOrmOrderable.this.getXmlOrderColumn();
+ }
+
+ public XmlOrderColumn buildXmlColumn() {
+ return GenericOrmOrderable.this.buildXmlOrderColumn();
+ }
+
+ public void removeXmlColumn() {
+ GenericOrmOrderable.this.removeXmlOrderColumn();
+ }
+
+ protected OrmPersistentAttribute getPersistentAttribute() {
+ return GenericOrmOrderable.this.getPersistentAttribute();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
new file mode 100644
index 0000000000..f669f9864d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
+import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOverrideJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.orm.NullOrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmOverrideJoinTableRelationshipStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOverrideRelationship2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmOverrideRelationship
+ extends AbstractOrmXmlContextNode
+ implements OrmOverrideRelationship2_0
+{
+ protected OrmRelationshipStrategy strategy;
+
+ protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy;
+
+ // JPA 2.0
+ protected final OrmJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericOrmOverrideRelationship(OrmAssociationOverride parent) {
+ super(parent);
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.joinColumnStrategy.synchronizeWithResourceModel();
+ this.joinTableStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setStrategy(this.buildStrategy());
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ public OrmRelationshipStrategy getStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(OrmRelationshipStrategy strategy) {
+ OrmRelationshipStrategy old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected OrmRelationshipStrategy buildStrategy() {
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
+ return this.joinColumnStrategy;
+ }
+ return this.joinTableStrategy;
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** join column strategy **********
+
+ public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ this.joinColumnStrategy.addStrategy();
+ this.joinTableStrategy.removeStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return false;
+ }
+
+ protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericOrmOverrideJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public OrmJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public void setStrategyToJoinTable() {
+ this.joinTableStrategy.addStrategy();
+ this.joinColumnStrategy.removeStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return false;
+ }
+
+ protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return this.isJpa2_0Compatible() ?
+ new GenericOrmOverrideJoinTableRelationshipStrategy2_0(this) :
+ new NullOrmJoinTableRelationshipStrategy(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeFrom(ReadOnlyRelationship oldRelationship) {
+ oldRelationship.initializeOn(this);
+ }
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ }
+
+ public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
+ // NOP
+ }
+
+ public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
+ this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
+ }
+
+ public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
+ this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
+ }
+
+ public void initializeFromVirtual(ReadOnlyOverrideRelationship virtualRelationship) {
+ virtualRelationship.initializeOnSpecified(this);
+ }
+
+ public void initializeOnSpecified(OverrideRelationship specifiedRelationship) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void initializeFromVirtualJoinTableRelationship(ReadOnlyJoinTableRelationship virtualRelationship) {
+ this.joinTableStrategy.initializeFromVirtual(virtualRelationship.getJoinTableStrategy());
+ }
+
+ public void initializeFromVirtualJoinColumnRelationship(ReadOnlyJoinColumnRelationship virtualRelationship) {
+ this.joinColumnStrategy.initializeFromVirtual(virtualRelationship.getJoinColumnStrategy());
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmAssociationOverride getParent() {
+ return (OrmAssociationOverride) super.getParent();
+ }
+
+ public OrmAssociationOverride getAssociationOverride() {
+ return this.getParent();
+ }
+
+ public XmlAssociationOverride getXmlContainer() {
+ return this.getAssociationOverride().getXmlOverride();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getAssociationOverride().getContainer().getTypeMapping();
+ }
+
+ public Entity getEntity() {
+ TypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ public RelationshipMapping getMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getAssociationOverride().getValidationTextRange();
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.joinColumnStrategy.validate(messages, reporter);
+ this.joinTableStrategy.validate(messages, reporter);
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.getAssociationOverride().getContainer().buildJoinTableJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver);
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.getAssociationOverride().getContainer().buildJoinTableInverseJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver);
+ }
+
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return this.getAssociationOverride().getContainer().buildTableValidator(this.getAssociationOverride(), table, textRangeResolver);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
new file mode 100644
index 0000000000..7ff900e4d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitDefaults2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.db.Catalog;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.SchemaContainer;
+
+/**
+ * <code>orm.xml</code> file
+ * <br>
+ * <code>persistence-unit-defaults</code> element
+ */
+public class GenericOrmPersistenceUnitDefaults
+ extends AbstractOrmXmlContextNode
+ implements OrmPersistenceUnitDefaults2_0
+{
+ protected AccessType access;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected boolean cascadePersist;
+
+ protected boolean delimitedIdentifiers;
+
+
+ // ********** constructor/initialization **********
+
+ public GenericOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) {
+ super(parent);
+ this.access = this.buildAccess();
+ this.specifiedCatalog = this.buildSpecifiedCatalog();
+ this.specifiedSchema = this.buildSpecifiedSchema();
+ this.cascadePersist = this.buildCascadePersist();
+ this.delimitedIdentifiers = this.buildDelimitedIdentifiers();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setAccess_(this.buildAccess());
+ this.setSpecifiedCatalog_(this.buildSpecifiedCatalog());
+ this.setSpecifiedSchema_(this.buildSpecifiedSchema());
+ this.setCascadePersist_(this.buildCascadePersist());
+ this.setDelimitedIdentifiers_(this.buildDelimitedIdentifiers());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.setDefaultSchema(this.buildDefaultSchema());
+ }
+
+
+ // ********** access **********
+
+ public AccessType getAccess() {
+ return this.access;
+ }
+
+ public void setAccess(AccessType access) {
+ if (this.valuesAreDifferent(this.access, access)) {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
+ this.setAccess_(access);
+ xmlDefaults.setAccess(AccessType.toOrmResourceModel(access));
+ this.removeXmlDefaultsIfUnset();
+ }
+ }
+
+ protected void setAccess_(AccessType access) {
+ AccessType old = this.access;
+ this.access = access;
+ this.firePropertyChanged(ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildAccess() {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
+ return (xmlDefaults == null) ? null : AccessType.fromOrmResourceModel(xmlDefaults.getAccess());
+ }
+
+
+ // ********** schema container **********
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
+ * then the database probably does not support catalogs; and we need to
+ * get the schema directly from the database.
+ */
+ public SchemaContainer getDbSchemaContainer() {
+ String catalog = this.getCatalog();
+ return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
+ }
+
+
+ // ********** catalog **********
+
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ if (this.valuesAreDifferent(this.specifiedCatalog, catalog)) {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
+ this.setSpecifiedCatalog_(catalog);
+ xmlDefaults.setCatalog(catalog);
+ this.removeXmlDefaultsIfUnset();
+ }
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildSpecifiedCatalog() {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
+ return (xmlDefaults == null) ? null : xmlDefaults.getCatalog();
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildDefaultCatalog() {
+ return this.getJpaProject().getDefaultCatalog();
+ }
+
+ /**
+ * If we don't have a catalog (i.e. we don't even have a <em>default</em>
+ * catalog), then the database probably does not support catalogs.
+ */
+ public Catalog getDbCatalog() {
+ String catalog = this.getCatalog();
+ return (catalog == null) ? null : this.resolveDbCatalog(catalog);
+ }
+
+
+ // ********** schema **********
+
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ if (this.valuesAreDifferent(this.specifiedSchema, schema)) {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
+ this.setSpecifiedSchema_(schema);
+ xmlDefaults.setSchema(schema);
+ this.removeXmlDefaultsIfUnset();
+ }
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildSpecifiedSchema() {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
+ return (xmlDefaults == null) ? null : xmlDefaults.getSchema();
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildDefaultSchema() {
+ return this.getJpaProject().getDefaultSchema();
+ }
+
+ public Schema getDbSchema() {
+ SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
+ return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
+ }
+
+
+ // ********** cascade persist **********
+
+ public boolean isCascadePersist() {
+ return this.cascadePersist;
+ }
+
+ public void setCascadePersist(boolean cascadePersist) {
+ if (this.cascadePersist != cascadePersist) {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
+ this.setCascadePersist_(cascadePersist);
+ xmlDefaults.setCascadePersist(cascadePersist);
+ this.removeXmlDefaultsIfUnset();
+ }
+ }
+
+ protected void setCascadePersist_(boolean cascadePersist) {
+ boolean old = this.cascadePersist;
+ this.cascadePersist = cascadePersist;
+ this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist);
+ }
+
+ protected boolean buildCascadePersist() {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
+ return (xmlDefaults == null) ? false : xmlDefaults.isCascadePersist();
+ }
+
+
+ // ********** delimited identifiers **********
+
+ public boolean isDelimitedIdentifiers() {
+ return this.delimitedIdentifiers;
+ }
+
+ public void setDelimitedIdentifiers(boolean delimitedIdentifiers) {
+ if (this.delimitedIdentifiers != delimitedIdentifiers) {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate();
+ this.setDelimitedIdentifiers_(delimitedIdentifiers);
+ xmlDefaults.setDelimitedIdentifiers(delimitedIdentifiers);
+ this.removeXmlDefaultsIfUnset();
+ }
+ }
+
+ protected void setDelimitedIdentifiers_(boolean di) {
+ boolean old = this.delimitedIdentifiers;
+ this.delimitedIdentifiers = di;
+ this.firePropertyChanged(DELIMITED_IDENTIFIERS_PROPERTY, old, di);
+ }
+
+ protected boolean buildDelimitedIdentifiers() {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
+ return (xmlDefaults == null) ? false : xmlDefaults.isDelimitedIdentifiers();
+ }
+
+
+ // ********** XML defaults **********
+
+ /**
+ * Return <code>null</code> if the XML defaults does not exist.
+ */
+ protected XmlPersistenceUnitDefaults getXmlDefaults() {
+ XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
+ return (xmlMetadata == null) ? null : xmlMetadata.getPersistenceUnitDefaults();
+ }
+
+ protected XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata() {
+ return this.getPersistenceUnitMetadata().getXmlPersistenceUnitMetadata();
+ }
+
+ /**
+ * Build the XML defaults (and XML metadata if necessary) if it does not exist.
+ */
+ protected XmlPersistenceUnitDefaults getXmlDefaultsForUpdate() {
+ XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadataForUpdate();
+ XmlPersistenceUnitDefaults xmlDefaults = xmlMetadata.getPersistenceUnitDefaults();
+ return (xmlDefaults != null) ? xmlDefaults : this.buildXmlDefaults(xmlMetadata);
+ }
+
+ protected XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate() {
+ return this.getPersistenceUnitMetadata().getXmlPersistenceUnitMetadataForUpdate();
+ }
+
+ protected XmlPersistenceUnitDefaults buildXmlDefaults(XmlPersistenceUnitMetadata xmlMetadata) {
+ XmlPersistenceUnitDefaults xmlDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
+ xmlMetadata.setPersistenceUnitDefaults(xmlDefaults);
+ return xmlDefaults;
+ }
+
+ /**
+ * clear the XML defaults (and the XML metadata) if appropriate
+ */
+ protected void removeXmlDefaultsIfUnset() {
+ if (this.getXmlDefaults().isUnset()) {
+ this.getXmlPersistenceUnitMetadata().setPersistenceUnitDefaults(null);
+ this.removeXmlPersistenceUnitMetadataIfUnset();
+ }
+ }
+
+ protected void removeXmlPersistenceUnitMetadataIfUnset() {
+ this.getPersistenceUnitMetadata().removeXmlPersistenceUnitMetadataIfUnset();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmPersistenceUnitMetadata getParent() {
+ return (OrmPersistenceUnitMetadata) super.getParent();
+ }
+
+ public OrmPersistenceUnitMetadata getPersistenceUnitMetadata() {
+ return this.getParent();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
+ return (xmlDefaults != null) ?
+ xmlDefaults.getValidationTextRange() :
+ this.getPersistenceUnitMetadata().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
new file mode 100644
index 0000000000..63409c28f1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitMetadata2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+/**
+ * <code>orm.xml</code> file
+ * <br>
+ * <code>persistence-unit-metadata</code> element
+ */
+public class GenericOrmPersistenceUnitMetadata
+ extends AbstractOrmXmlContextNode
+ implements OrmPersistenceUnitMetadata2_0
+{
+ protected boolean xmlMappingMetadataComplete;
+
+ protected String description;
+
+ // never null
+ protected final OrmPersistenceUnitDefaults persistenceUnitDefaults;
+
+
+ public GenericOrmPersistenceUnitMetadata(EntityMappings parent) {
+ super(parent);
+ this.xmlMappingMetadataComplete = this.buildXmlMappingMetadataComplete();
+ this.description = this.buildDescription();
+ this.persistenceUnitDefaults = this.buildPersistenceUnitDefaults();
+ }
+
+ protected OrmPersistenceUnitDefaults buildPersistenceUnitDefaults() {
+ return this.getContextNodeFactory().buildOrmPersistenceUnitDefaults(this);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setXmlMappingMetadataComplete_(this.buildXmlMappingMetadataComplete());
+ this.setDescription_(this.buildDescription());
+ this.persistenceUnitDefaults.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.persistenceUnitDefaults.update();
+ }
+
+
+ // ********** XML metadata **********
+
+ /**
+ * Return <code>null</code> if the XML metadata does not exist.
+ */
+ public XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata() {
+ return this.getXmlEntityMappings().getPersistenceUnitMetadata();
+ }
+
+ /**
+ * Build the XML metadata if it does not exist.
+ */
+ public XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate() {
+ XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
+ return (xmlMetadata != null) ? xmlMetadata : this.buildXmlPersistenceUnitMetadata();
+ }
+
+ protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata() {
+ XmlPersistenceUnitMetadata xmlMetadata = this.buildXmlPersistenceUnitMetadata_();
+ this.getXmlEntityMappings().setPersistenceUnitMetadata(xmlMetadata);
+ return xmlMetadata;
+ }
+
+ protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata_() {
+ return EmfTools.create(
+ this.getResourceNodeFactory(),
+ OrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata(),
+ XmlPersistenceUnitMetadata.class
+ );
+ }
+
+ public void removeXmlPersistenceUnitMetadataIfUnset() {
+ if (this.getXmlPersistenceUnitMetadata().isUnset()) {
+ this.getXmlEntityMappings().setPersistenceUnitMetadata(null);
+ }
+ }
+
+
+ // ********** XML mapping metadata complete **********
+
+ public boolean isXmlMappingMetadataComplete() {
+ return this.xmlMappingMetadataComplete;
+ }
+
+ public void setXmlMappingMetadataComplete(boolean xmlMappingMetadataComplete) {
+ if (this.xmlMappingMetadataComplete != xmlMappingMetadataComplete) {
+ XmlPersistenceUnitMetadata xmlPersistenceUnitMetadata = this.getXmlPersistenceUnitMetadataForUpdate();
+ this.setXmlMappingMetadataComplete_(xmlMappingMetadataComplete);
+ xmlPersistenceUnitMetadata.setXmlMappingMetadataComplete(xmlMappingMetadataComplete);
+ this.removeXmlPersistenceUnitMetadataIfUnset();
+ }
+ }
+
+ protected void setXmlMappingMetadataComplete_(boolean xmlMappingMetadataComplete) {
+ boolean old = this.xmlMappingMetadataComplete;
+ this.xmlMappingMetadataComplete = xmlMappingMetadataComplete;
+ this.firePropertyChanged(XML_MAPPING_METADATA_COMPLETE_PROPERTY, old, xmlMappingMetadataComplete);
+ }
+
+ protected boolean buildXmlMappingMetadataComplete() {
+ XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
+ return (xmlMetadata != null) ? xmlMetadata.isXmlMappingMetadataComplete() : false;
+ }
+
+
+ // ********** description **********
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ if (this.valuesAreDifferent(this.description, description)) {
+ XmlPersistenceUnitMetadata xmlPersistenceUnitMetadata = this.getXmlPersistenceUnitMetadataForUpdate();
+ this.setDescription_(description);
+ xmlPersistenceUnitMetadata.setDescription(description);
+ this.removeXmlPersistenceUnitMetadataIfUnset();
+ }
+ }
+
+ protected void setDescription_(String description) {
+ String old = this.description;
+ this.description = description;
+ this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description);
+ }
+
+ protected String buildDescription() {
+ XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
+ return (xmlMetadata == null) ? null : xmlMetadata.getDescription();
+ }
+
+
+ // ********** persistence unit defaults **********
+
+ public OrmPersistenceUnitDefaults getPersistenceUnitDefaults() {
+ return this.persistenceUnitDefaults;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public EntityMappings getParent() {
+ return (EntityMappings) super.getParent();
+ }
+
+ public XmlEntityMappings getXmlEntityMappings() {
+ return this.getParent().getXmlEntityMappings();
+ }
+
+ public boolean resourceExists() {
+ return this.getXmlPersistenceUnitMetadata() != null;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
+ return (xmlMetadata != null) ?
+ xmlMetadata.getValidationTextRange() :
+ this.getXmlEntityMappings().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
new file mode 100644
index 0000000000..1bdd5cc4c0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> persistent attribute
+ */
+public class GenericOrmPersistentAttribute
+ extends SpecifiedOrmPersistentAttribute
+{
+ public GenericOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
+ super(parent, xmlMapping);
+ }
+
+
+ // ********** access **********
+
+ /**
+ * JPA 1.0 does not support a specified access for attributes.
+ */
+ @Override
+ public AccessType getSpecifiedAccess() {
+ return null;
+ }
+
+ public void setSpecifiedAccess(AccessType access) {
+ throw new UnsupportedOperationException("A specified access is not supported in JPA 1.0: " + this); //$NON-NLS-1$
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected void validateAttribute(List<IMessage> messages, IReporter reporter) {
+ super.validateAttribute(messages, reporter);
+ if (this.javaPersistentAttribute != null) {
+ JavaPersistentType javaPersistentType = this.getOwningPersistentType().getJavaPersistentType();
+ if ((javaPersistentType != null) && (javaPersistentType.getAttributeNamed(this.javaPersistentAttribute.getName()) == null)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED,
+ new String[] {
+ this.getName(),
+ this.getOwningPersistentType().getMapping().getClass_()
+ },
+ this.mapping,
+ this.mapping.getNameTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ @Override
+ protected JptValidator buildAttibuteValidator() {
+ return new GenericPersistentAttributeValidator(this, getJavaPersistentAttribute(), buildTextRangeResolver());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
new file mode 100644
index 0000000000..9e28935ce4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
@@ -0,0 +1,1195 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.BodySourceWriter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentType2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> persistent type:<ul>
+ * <li>mapping
+ * <li>access
+ * <li>attributes
+ * <li>super persistent type
+ * <li>Java persistent type
+ * </ul>
+ */
+public class GenericOrmPersistentType
+ extends AbstractOrmXmlContextNode
+ implements OrmPersistentType2_0
+{
+ protected OrmTypeMapping mapping; // never null
+
+ protected JavaPersistentType javaPersistentType;
+
+ protected AccessType specifiedAccess;
+ protected AccessType defaultAccess; // never null
+
+ protected final Vector<OrmPersistentAttribute> specifiedAttributes = new Vector<OrmPersistentAttribute>();
+ protected final SpecifiedAttributeContainerAdapter specifiedAttributeContainerAdapter = new SpecifiedAttributeContainerAdapter();
+
+ protected final Vector<OrmReadOnlyPersistentAttribute> virtualAttributes = new Vector<OrmReadOnlyPersistentAttribute>();
+ protected final VirtualAttributeContainerAdapter virtualAttributeContainerAdapter = new VirtualAttributeContainerAdapter();
+
+ protected PersistentType superPersistentType;
+
+ protected String declaringTypeName;
+
+ protected final MetamodelSourceType.Synchronizer metamodelSynchronizer;
+
+
+ public GenericOrmPersistentType(EntityMappings parent, XmlTypeMapping xmlTypeMapping) {
+ super(parent);
+ this.mapping = this.buildMapping(xmlTypeMapping);
+ // 'javaPersistentType' is resolved in the update
+ this.specifiedAccess = this.buildSpecifiedAccess();
+ this.defaultAccess = AccessType.FIELD; // keep this non-null
+ this.initializeSpecifiedAttributes();
+ this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.mapping.synchronizeWithResourceModel();
+ this.syncJavaPersistentType();
+ this.setSpecifiedAccess_(this.buildSpecifiedAccess());
+ this.syncSpecifiedAttributes();
+ this.synchronizeNodesWithResourceModel(this.getVirtualAttributes());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.mapping.update();
+ this.updateJavaPersistentType();
+ this.setDefaultAccess(this.buildDefaultAccess());
+ this.updateNodes(this.getSpecifiedAttributes());
+ this.updateVirtualAttributes();
+ this.setSuperPersistentType(this.buildSuperPersistentType());
+ this.setDeclaringTypeName(this.buildDeclaringTypeName());
+ }
+
+
+ // ********** mapping **********
+
+ public OrmTypeMapping getMapping() {
+ return this.mapping;
+ }
+
+ public String getMappingKey() {
+ return this.mapping.getKey();
+ }
+
+ public void setMappingKey(String mappingKey) {
+ if (this.valuesAreDifferent(this.getMappingKey(), mappingKey)) {
+ this.setMappingKey_(mappingKey);
+ }
+ }
+
+ protected void setMappingKey_(String mappingKey) {
+ OrmTypeMapping old = this.mapping;
+ OrmTypeMappingDefinition mappingDefinition = this.getMappingFileDefinition().getTypeMappingDefinition(mappingKey);
+ XmlTypeMapping xmlTypeMapping = mappingDefinition.buildResourceMapping(this.getResourceNodeFactory());
+ this.mapping = this.buildMapping(xmlTypeMapping);
+ this.getEntityMappings().changeMapping(this, old, this.mapping);
+ this.firePropertyChanged(MAPPING_PROPERTY, old, this.mapping);
+ }
+
+ protected OrmTypeMapping buildMapping(XmlTypeMapping xmlTypeMapping) {
+ OrmTypeMappingDefinition md = this.getMappingFileDefinition().getTypeMappingDefinition(xmlTypeMapping.getMappingKey());
+ return md.buildContextMapping(this, xmlTypeMapping, this.getContextNodeFactory());
+ }
+
+ protected XmlTypeMapping getXmlTypeMapping() {
+ return this.mapping.getXmlTypeMapping();
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.convertMappingClassName(this.mapping.getClass_());
+ }
+
+ public String getSimpleName(){
+ String className = this.getName();
+ return StringTools.stringIsEmpty(className) ? null : ClassName.getSimpleName(className);
+ }
+
+ /**
+ * We clear out {@link #javaPersistentType} here because we cannot compare its name
+ * to the mapping's class name, since it may have been prefixed by the entity
+ * mappings package.
+ */
+ public void mappingClassChanged(String oldClass, String newClass) {
+ this.firePropertyChanged(NAME_PROPERTY, this.convertMappingClassName(oldClass), this.convertMappingClassName(newClass));
+ // clear out the Java type here, it will be rebuilt during "update"
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.dispose();
+ this.setJavaPersistentType(null);
+ }
+ }
+
+ /**
+ * Nested class names are specified with a <code>'$'</code>
+ * in <code>orm.xml</code>.
+ */
+ protected String convertMappingClassName(String name) {
+ return (name == null) ? null : name.replace('$', '.');
+ }
+
+
+ // ********** Java persistent type **********
+
+ public JavaPersistentType getJavaPersistentType() {
+ return this.javaPersistentType;
+ }
+
+ protected void setJavaPersistentType(JavaPersistentType javaPersistentType) {
+ JavaPersistentType old = this.javaPersistentType;
+ this.javaPersistentType = javaPersistentType;
+ this.firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, old, javaPersistentType);
+ }
+
+ /**
+ * If the persistent type's mapping's class (name) changes during
+ * <em>sync</em>, the Java persistent type will be cleared out in
+ * {@link #mappingClassChanged(String, String)}. If we get here and
+ * the Java persistent type is still present, we can
+ * <em>sync</em> it. Of course, it might still be obsolete if the
+ * entity mappings's package has changed....
+ *
+ * @see #updateJavaPersistentType()
+ */
+ protected void syncJavaPersistentType() {
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.synchronizeWithResourceModel();
+ }
+ }
+
+ /**
+ * @see #syncJavaPersistentType()
+ */
+ protected void updateJavaPersistentType() {
+ JavaResourcePersistentType resourceType = this.resolveJavaResourcePersistentType();
+ if (resourceType == null) {
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.dispose();
+ this.setJavaPersistentType(null);
+ }
+ } else {
+ if (this.javaPersistentType == null) {
+ this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
+ } else {
+ if (this.javaPersistentType.getResourcePersistentType() == resourceType) {
+ this.javaPersistentType.update();
+ } else {
+ this.javaPersistentType.dispose();
+ this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
+ }
+ }
+ }
+ }
+
+ protected JavaResourcePersistentType resolveJavaResourcePersistentType() {
+ return this.getEntityMappings().resolveJavaResourcePersistentType(this.getName());
+ }
+
+ protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
+ return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
+ }
+
+
+ // ********** access **********
+
+ public AccessType getAccess() {
+ return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
+ }
+
+ public AccessType getSpecifiedAccess() {
+ return this.specifiedAccess;
+ }
+
+ public void setSpecifiedAccess(AccessType access) {
+ this.setSpecifiedAccess_(access);
+ this.getXmlTypeMapping().setAccess(AccessType.toOrmResourceModel(access));
+ }
+
+ protected void setSpecifiedAccess_(AccessType access) {
+ AccessType old = this.specifiedAccess;
+ this.specifiedAccess = access;
+ this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildSpecifiedAccess() {
+ return AccessType.fromOrmResourceModel(this.getXmlTypeMapping().getAccess());
+ }
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType access) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = access;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildDefaultAccess() {
+ if ( ! this.mapping.isMetadataComplete()) {
+ if (this.javaPersistentType != null) {
+ if (this.javaPersistentTypeHasSpecifiedAccess()) {
+ return this.javaPersistentType.getAccess();
+ }
+ if (this.superPersistentType != null) {
+ return this.superPersistentType.getAccess();
+ }
+ }
+ }
+ AccessType access = this.getMappingFileRoot().getAccess();
+ return (access != null) ? access : AccessType.FIELD; // default to FIELD if no specified access found
+ }
+
+ /**
+ * pre-condition: {@link #javaPersistentType} is not <code>null</code>
+ */
+ protected boolean javaPersistentTypeHasSpecifiedAccess() {
+ return (this.javaPersistentType.getSpecifiedAccess() != null) ||
+ this.javaPersistentType.hasAnyAnnotatedAttributes();
+ }
+
+ public AccessType getOwnerOverrideAccess() {
+ return this.getEntityMappings().getOverridePersistentTypeAccess();
+ }
+
+ public AccessType getOwnerDefaultAccess() {
+ return this.getEntityMappings().getDefaultPersistentTypeAccess();
+ }
+
+
+ // ********** attributes **********
+
+ public ListIterator<OrmReadOnlyPersistentAttribute> attributes() {
+ return this.getAttributes().iterator();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterable<OrmReadOnlyPersistentAttribute> getAttributes() {
+ return new CompositeListIterable<OrmReadOnlyPersistentAttribute>(this.getReadOnlySpecifiedAttributes(), this.getVirtualAttributes());
+ }
+
+ public int attributesSize() {
+ return this.specifiedAttributesSize() + this.virtualAttributesSize();
+ }
+
+ public Iterator<String> attributeNames() {
+ return this.getAttributeNames().iterator();
+ }
+
+ public Iterable<String> getAttributeNames() {
+ return this.convertToNames(this.getAttributes());
+ }
+
+ public OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) {
+ Iterator<OrmReadOnlyPersistentAttribute> stream = this.getAttributesNamed(attributeName).iterator();
+ return stream.hasNext() ? stream.next() : null;
+ }
+
+ public Iterator<ReadOnlyPersistentAttribute> allAttributes() {
+ return this.getAllAttributes().iterator();
+ }
+
+ public Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
+ return new CompositeIterable<ReadOnlyPersistentAttribute>(
+ new TransformationIterable<PersistentType, Iterable<ReadOnlyPersistentAttribute>>(this.getInheritanceHierarchy()) {
+ @Override
+ protected Iterable<ReadOnlyPersistentAttribute> transform(PersistentType pt) {
+ return new SnapshotCloneIterable<ReadOnlyPersistentAttribute>(pt.attributes());
+ }
+ }
+ );
+ }
+
+ public Iterator<String> allAttributeNames() {
+ return this.getAllAttributeNames().iterator();
+ }
+
+ public Iterable<String> getAllAttributeNames() {
+ return this.convertToNames(this.getAllAttributes());
+ }
+
+ protected Iterable<OrmReadOnlyPersistentAttribute> getAttributesNamed(final String attributeName) {
+ return new FilteringIterable<OrmReadOnlyPersistentAttribute>(this.getAttributes()) {
+ @Override
+ protected boolean accept(OrmReadOnlyPersistentAttribute attribute) {
+ return Tools.valuesAreEqual(attributeName, attribute.getName());
+ }
+ };
+ }
+
+ public ReadOnlyPersistentAttribute resolveAttribute(String attributeName) {
+ Iterator<OrmReadOnlyPersistentAttribute> attributes = this.getAttributesNamed(attributeName).iterator();
+ if (attributes.hasNext()) {
+ OrmReadOnlyPersistentAttribute attribute = attributes.next();
+ return attributes.hasNext() ? null /* more than one */: attribute;
+ }
+ // recurse
+ return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
+ }
+
+ protected Iterable<String> convertToNames(Iterable<? extends ReadOnlyPersistentAttribute> attributes) {
+ return new TransformationIterable<ReadOnlyPersistentAttribute, String>(attributes) {
+ @Override
+ protected String transform(ReadOnlyPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+
+ // ********** attribute conversions **********
+
+ public OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute) {
+ return this.convertAttributeToSpecified(virtualAttribute, virtualAttribute.getMappingKey());
+ }
+
+ public OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey) {
+ if ( ! virtualAttribute.isVirtual()) {
+ throw new IllegalArgumentException("Attribute is already specified: " + virtualAttribute); //$NON-NLS-1$
+ }
+ if (mappingKey == null) {
+ // this typically happens when the virtual attribute does not have a mapping
+ throw new IllegalArgumentException("Use convertAttributeToSpecified(OrmReadOnlyPersistentAttribute, String) instead and specify a mapping key"); //$NON-NLS-1$
+ }
+ return this.convertAttributeToSpecified_(virtualAttribute, mappingKey);
+ }
+
+ /**
+ * <em>Silently</em> remove the virtual attribute and add specified
+ * attribute before triggering an <em>update</em> or the dangling
+ * virtual attribute will be removed preemptively.
+ */
+ protected OrmPersistentAttribute convertAttributeToSpecified_(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey) {
+ // silently remove the virtual attribute
+ int virtualIndex = this.virtualAttributes.indexOf(virtualAttribute);
+ this.virtualAttributes.remove(virtualIndex);
+ virtualAttribute.dispose();
+
+ // silently add the specified attribute
+ OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey);
+ XmlAttributeMapping xmlMapping = md.buildResourceMapping(this.getResourceNodeFactory());
+
+ OrmPersistentAttribute specifiedAttribute = this.buildSpecifiedAttribute(xmlMapping);
+ // we need to add the attribute to the right spot in the list - stupid spec...
+ int specifiedIndex = this.getSpecifiedAttributeInsertionIndex(specifiedAttribute);
+ this.specifiedAttributes.add(specifiedIndex, specifiedAttribute);
+
+ // this will trigger the initial update;
+ // no changes to either collection (virtual or specified) should be detected at this point
+ specifiedAttribute.getMapping().setName(virtualAttribute.getName());
+
+ // fire the list change events
+ this.fireItemRemoved(VIRTUAL_ATTRIBUTES_LIST, virtualIndex, virtualAttribute);
+ this.fireItemAdded(SPECIFIED_ATTRIBUTES_LIST, specifiedIndex, specifiedAttribute);
+
+ // it should be safe to update the XML now
+ Attributes xmlAttributes = this.getXmlAttributesForUpdate();
+ specifiedAttribute.getMapping().addXmlAttributeMappingTo(xmlAttributes);
+ // possibly a NOP, but needed when we trigger the creation of a new 'attributes'
+ this.getXmlTypeMapping().setAttributes(xmlAttributes);
+
+ // copy over the specified access(?)
+ AccessType oldAccess = virtualAttribute.getJavaPersistentAttribute().getSpecifiedAccess();
+ if (oldAccess != null) {
+ specifiedAttribute.setSpecifiedAccess(oldAccess);
+ }
+ return specifiedAttribute;
+ }
+
+ // TODO this is used only by our tests...
+ // we cannot delegate to getAttributeNamed(String).convertToSpecified()
+ // because the tests use this method to add "orphan" xml attributes (that
+ // do not have a corresponding java attribute :( )
+ public OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName) {
+ // force the creation of an empty xml attribute container beforehand or it will trigger
+ // a sync and, if we do this after adding the attribute, clear out our context attributes
+ Attributes xmlAttributes = this.getXmlAttributesForUpdate();
+ this.getXmlTypeMapping().setAttributes(xmlAttributes); // possibly a NOP
+
+ OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey);
+ XmlAttributeMapping xmlMapping = md.buildResourceMapping(this.getResourceNodeFactory());
+
+ OrmPersistentAttribute specifiedAttribute = this.buildSpecifiedAttribute(xmlMapping);
+ // we need to add the attribute to the right spot in the list - stupid spec...
+ int specifiedIndex = this.getSpecifiedAttributeInsertionIndex(specifiedAttribute);
+ // the virtual attributes list should remain unchanged since the specified attribute has no name
+ this.addItemToList(specifiedIndex, specifiedAttribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
+ specifiedAttribute.getMapping().addXmlAttributeMappingTo(xmlAttributes);
+
+ // this will trigger the update of the virtual attributes list
+ specifiedAttribute.getMapping().setName(attributeName);
+
+ return specifiedAttribute;
+ }
+
+ protected int getSpecifiedAttributeInsertionIndex(OrmPersistentAttribute attribute) {
+ return CollectionTools.insertionIndexOf(this.specifiedAttributes, attribute, this.getAttributeComparator());
+ }
+
+ protected Comparator<OrmPersistentAttribute> getAttributeComparator() {
+ return ATTRIBUTE_COMPARATOR;
+ }
+
+ protected static final Comparator<OrmPersistentAttribute> ATTRIBUTE_COMPARATOR =
+ new Comparator<OrmPersistentAttribute>() {
+ public int compare(OrmPersistentAttribute attribute1, OrmPersistentAttribute attribute2) {
+ int seq1 = attribute1.getMapping().getXmlSequence();
+ int seq2 = attribute2.getMapping().getXmlSequence();
+ return (seq1 == seq2) ? 0 : (seq1 < seq2) ? -1 : 1;
+ }
+ };
+
+ /**
+ * <em>Silently</em> add the new virtual attribute before removing the
+ * specified attribute, or the <em>update</em> will discover the missing
+ * virtual attribute and add it preemptively.
+ */
+ public OrmReadOnlyPersistentAttribute convertAttributeToVirtual(OrmPersistentAttribute specifiedAttribute) {
+ if (specifiedAttribute.isVirtual()) {
+ throw new IllegalArgumentException("Attribute is already virtual: " + specifiedAttribute); //$NON-NLS-1$
+ }
+
+ int virtualIndex = this.virtualAttributes.size();
+ OrmReadOnlyPersistentAttribute virtualAttribute = null;
+ // make sure the corresponding resource Java attribute actually exists in the *current* type;
+ // do *not* take the context Java attribute directly from the specified ORM
+ // attribute we are converting since it may have come from a superclass;
+ // instead, use its resource Java attribute (which will match both name and access type,
+ // but we still need to check its parent type)
+ JavaResourcePersistentAttribute javaResourceAttribute = specifiedAttribute.getJavaResourcePersistentAttribute();
+ if ((javaResourceAttribute != null) && this.javaResourceAttributeWillBeVirtual(javaResourceAttribute, specifiedAttribute)) {
+ virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute);
+ this.virtualAttributes.add(virtualIndex, virtualAttribute);
+ }
+
+ this.removeSpecifiedAttribute(specifiedAttribute); // trigger update
+
+ if (virtualAttribute != null) {
+ this.fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualIndex, virtualAttribute);
+ }
+ return virtualAttribute;
+ }
+
+ /**
+ * Return whether the specified Java resource attribute will be a
+ * <em>virtual</em> attribute when the specified specified attribute is
+ * removed from the type. The Java resource attribute must be among the
+ * valid Java resource attributes and it must not correspond to any of the
+ * remaining specified attributes.
+ */
+ protected boolean javaResourceAttributeWillBeVirtual(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute specifiedAttributeToBeRemoved) {
+ return CollectionTools.contains(this.getJavaResourceAttributes(), javaResourceAttribute) &&
+ (this.getSpecifiedAttributeFor(javaResourceAttribute, specifiedAttributeToBeRemoved) == null);
+ }
+
+
+ // ********** xml attributes **********
+
+ /**
+ * Return <code>null</code> if the <code>attributes</code> element is missing.
+ */
+ protected Attributes getXmlAttributes() {
+ return this.getXmlTypeMapping().getAttributes();
+ }
+
+ /**
+ * Build a new <code>attributes</code> element if it is not present;
+ * but do <em>not</em> add it to the XML type mapping. Callers will have
+ * to add it to the XML type mapping when appropriate.
+ */
+ protected Attributes getXmlAttributesForUpdate() {
+ Attributes xmlAttributes = this.getXmlAttributes();
+ return (xmlAttributes != null) ? xmlAttributes : this.buildXmlAttributes();
+ }
+
+ protected Attributes buildXmlAttributes() {
+ return EmfTools.create(this.getResourceNodeFactory(), OrmPackage.eINSTANCE.getAttributes(), Attributes.class);
+ }
+
+ protected void removeXmlAttributesIfUnset() {
+ if (this.getXmlAttributes().isUnset()) {
+ this.getXmlTypeMapping().setAttributes(null);
+ }
+ }
+
+
+ // ********** specified attributes **********
+
+ public ListIterator<OrmPersistentAttribute> specifiedAttributes() {
+ return this.getSpecifiedAttributes().iterator();
+ }
+
+ protected ListIterable<OrmPersistentAttribute> getSpecifiedAttributes() {
+ return new LiveCloneListIterable<OrmPersistentAttribute>(this.specifiedAttributes);
+ }
+
+ protected ListIterable<OrmReadOnlyPersistentAttribute> getReadOnlySpecifiedAttributes() {
+ return new SuperListIterableWrapper<OrmReadOnlyPersistentAttribute>(this.getSpecifiedAttributes());
+ }
+
+ public int specifiedAttributesSize() {
+ return this.specifiedAttributes.size();
+ }
+
+ protected void removeSpecifiedAttribute(OrmPersistentAttribute attribute) {
+ this.removeSpecifiedAttribute_(attribute);
+ attribute.getMapping().removeXmlAttributeMappingFrom(this.getXmlAttributes());
+ this.removeXmlAttributesIfUnset();
+ }
+
+ public void changeMapping(OrmPersistentAttribute attribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping) {
+ // keep the context model in sync with each change to the resource model
+ int sourceIndex = this.specifiedAttributes.indexOf(attribute);
+ this.specifiedAttributes.remove(sourceIndex);
+ oldMapping.removeXmlAttributeMappingFrom(this.getXmlAttributes());
+
+ int targetIndex = this.getSpecifiedAttributeInsertionIndex(attribute);
+ this.specifiedAttributes.add(targetIndex, attribute);
+ newMapping.addXmlAttributeMappingTo(this.getXmlAttributes());
+
+ oldMapping.initializeOn(newMapping);
+
+ this.fireItemMoved(SPECIFIED_ATTRIBUTES_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void initializeSpecifiedAttributes() {
+ for (XmlAttributeMapping xmlMapping : this.getXmlAttributeMappings()) {
+ this.specifiedAttributes.add(this.buildSpecifiedAttribute(xmlMapping));
+ }
+ }
+
+ protected Iterable<XmlAttributeMapping> getXmlAttributeMappings() {
+ Attributes xmlAttributes = this.getXmlAttributes();
+ return (xmlAttributes != null) ? xmlAttributes.getAttributeMappings() : EmptyIterable.<XmlAttributeMapping>instance();
+ }
+
+ protected OrmPersistentAttribute buildSpecifiedAttribute(XmlAttributeMapping xmlMapping) {
+ return this.getContextNodeFactory().buildOrmPersistentAttribute(this, xmlMapping);
+ }
+
+ protected void syncSpecifiedAttributes() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedAttributeContainerAdapter);
+ }
+
+ protected void moveSpecifiedAttribute_(int index, OrmPersistentAttribute attribute) {
+ this.moveItemInList(index, attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
+ }
+
+ protected void addSpecifiedAttribute_(int index, XmlAttributeMapping xmlMapping) {
+ OrmPersistentAttribute attribute = this.buildSpecifiedAttribute(xmlMapping);
+ this.addItemToList(index, attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
+ }
+
+ protected void removeSpecifiedAttribute_(OrmPersistentAttribute attribute) {
+ this.removeItemFromList(attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST);
+ }
+
+ /**
+ * specified attribute container adapter
+ */
+ protected class SpecifiedAttributeContainerAdapter
+ implements ContextContainerTools.Adapter<OrmPersistentAttribute, XmlAttributeMapping>
+ {
+ public Iterable<OrmPersistentAttribute> getContextElements() {
+ return GenericOrmPersistentType.this.getSpecifiedAttributes();
+ }
+ public Iterable<XmlAttributeMapping> getResourceElements() {
+ return GenericOrmPersistentType.this.getXmlAttributeMappings();
+ }
+ public XmlAttributeMapping getResourceElement(OrmPersistentAttribute contextElement) {
+ return contextElement.getMapping().getXmlAttributeMapping();
+ }
+ public void moveContextElement(int index, OrmPersistentAttribute element) {
+ GenericOrmPersistentType.this.moveSpecifiedAttribute_(index, element);
+ }
+ public void addContextElement(int index, XmlAttributeMapping resourceElement) {
+ GenericOrmPersistentType.this.addSpecifiedAttribute_(index, resourceElement);
+ }
+ public void removeContextElement(OrmPersistentAttribute element) {
+ GenericOrmPersistentType.this.removeSpecifiedAttribute_(element);
+ }
+ }
+
+
+ // ********** virtual attributes **********
+
+ public ListIterator<OrmReadOnlyPersistentAttribute> virtualAttributes() {
+ return this.getVirtualAttributes().iterator();
+ }
+
+ public ListIterable<OrmReadOnlyPersistentAttribute> getVirtualAttributes() {
+ return new LiveCloneListIterable<OrmReadOnlyPersistentAttribute>(this.virtualAttributes);
+ }
+
+ public int virtualAttributesSize() {
+ return this.virtualAttributes.size();
+ }
+
+ protected void updateVirtualAttributes() {
+ ContextContainerTools.update(this.virtualAttributeContainerAdapter);
+ }
+
+ /**
+ * Return all the Java resource attributes that have the appropriate access
+ * and do not have a corresponding <code>orm.xml</code> mapping currently
+ * specified in the <code>orm.xml</code> persistent type.
+ */
+ protected Iterable<JavaResourcePersistentAttribute> getVirtualJavaResourceAttributes() {
+ return new FilteringIterable<JavaResourcePersistentAttribute>(this.getJavaResourceAttributes()) {
+ @Override
+ protected boolean accept(JavaResourcePersistentAttribute javaResourceAttribute) {
+ return GenericOrmPersistentType.this.javaResourceAttributeIsVirtual(javaResourceAttribute);
+ }
+ };
+ }
+
+ protected Iterable<JavaResourcePersistentAttribute> getJavaResourceAttributes() {
+ return CollectionTools.iterable(this.javaResourceAttributes());
+ }
+
+ /**
+ * Return the Java resource attributes with the appropriate access type.
+ */
+ protected Iterator<JavaResourcePersistentAttribute> javaResourceAttributes() {
+ JavaResourcePersistentType javaResourceType = this.getJavaResourceType();
+ return (javaResourceType != null) ?
+ javaResourceType.persistableAttributes(this.getVirtualJavaAccess().getJavaAccessType()) :
+ EmptyListIterator.<JavaResourcePersistentAttribute>instance();
+ }
+
+ protected JavaResourcePersistentType getJavaResourceType() {
+ return (this.javaPersistentType == null) ? null : this.javaPersistentType.getResourcePersistentType();
+ }
+
+ /**
+ * Return the access type that determines which Java attributes are to be
+ * used for the <code>orm.xml</code> type's <em>virtual</em> attributes.
+ */
+ protected AccessType getVirtualJavaAccess() {
+ if (this.specifiedAccess != null) {
+ return this.specifiedAccess;
+ }
+ if (this.mapping.isMetadataComplete()) {
+ return this.defaultAccess;
+ }
+ AccessType javaAccess = this.javaPersistentType.getSpecifiedAccess();
+ return (javaAccess != null) ? javaAccess : this.defaultAccess;
+ }
+
+ protected boolean javaResourceAttributeIsVirtual(JavaResourcePersistentAttribute javaResourceAttribute) {
+ return this.getSpecifiedAttributeFor(javaResourceAttribute) == null;
+ }
+
+ protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute) {
+ return this.getSpecifiedAttributeFor(javaResourceAttribute, null);
+ }
+
+ /**
+ * Return the specified attribute corresponding to the specified Java
+ * resource attribute, ignoring the specified excluded attribute (since
+ * there can be more than one specified attribute per Java resource
+ * attribute; albeit erroneously).
+ */
+ protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute exclude) {
+ for (OrmPersistentAttribute ormAttribute : this.getSpecifiedAttributes()) {
+ if (ormAttribute == exclude) {
+ continue; // skip
+ }
+ if (ormAttribute.getJavaResourcePersistentAttribute() == javaResourceAttribute) {
+ return ormAttribute;
+ }
+ }
+ return null;
+ }
+
+ protected void moveVirtualAttribute(int index, OrmReadOnlyPersistentAttribute virtualAttribute) {
+ this.moveItemInList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
+ }
+
+ protected void addVirtualAttribute(int index, JavaResourcePersistentAttribute javaResourceAttribute) {
+ OrmReadOnlyPersistentAttribute virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute);
+ this.addItemToList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
+ }
+
+ protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourcePersistentAttribute javaResourceAttribute) {
+ return this.getContextNodeFactory().buildVirtualOrmPersistentAttribute(this, javaResourceAttribute);
+ }
+
+ protected void removeVirtualAttribute(OrmReadOnlyPersistentAttribute virtualAttribute) {
+ virtualAttribute.dispose();
+ this.removeItemFromList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
+ }
+
+ /**
+ * virtual attribute container adapter
+ */
+ protected class VirtualAttributeContainerAdapter
+ implements ContextContainerTools.Adapter<OrmReadOnlyPersistentAttribute, JavaResourcePersistentAttribute>
+ {
+ public Iterable<OrmReadOnlyPersistentAttribute> getContextElements() {
+ return GenericOrmPersistentType.this.getVirtualAttributes();
+ }
+ public Iterable<JavaResourcePersistentAttribute> getResourceElements() {
+ return GenericOrmPersistentType.this.getVirtualJavaResourceAttributes();
+ }
+ public JavaResourcePersistentAttribute getResourceElement(OrmReadOnlyPersistentAttribute contextElement) {
+ return contextElement.getJavaResourcePersistentAttribute();
+ }
+ public void moveContextElement(int index, OrmReadOnlyPersistentAttribute element) {
+ GenericOrmPersistentType.this.moveVirtualAttribute(index, element);
+ }
+ public void addContextElement(int index, JavaResourcePersistentAttribute resourceElement) {
+ GenericOrmPersistentType.this.addVirtualAttribute(index, resourceElement);
+ }
+ public void removeContextElement(OrmReadOnlyPersistentAttribute element) {
+ GenericOrmPersistentType.this.removeVirtualAttribute(element);
+ }
+ }
+
+
+ // ********** super persistent type **********
+
+ public PersistentType getSuperPersistentType() {
+ return this.superPersistentType;
+ }
+
+ protected void setSuperPersistentType(PersistentType persistentType) {
+ PersistentType old = this.superPersistentType;
+ this.superPersistentType = persistentType;
+ this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, persistentType);
+ }
+
+ protected PersistentType buildSuperPersistentType() {
+ PersistentType spt = this.buildSuperPersistentType_();
+ if (spt == null) {
+ return null;
+ }
+ // check for circular inheritance
+ return CollectionTools.contains(spt.inheritanceHierarchy(), this) ? null : spt;
+ }
+
+ protected PersistentType buildSuperPersistentType_() {
+ return (this.javaPersistentType == null) ? null : this.javaPersistentType.getSuperPersistentType();
+ }
+
+
+ // ********** inheritance **********
+
+ public Iterator<PersistentType> inheritanceHierarchy() {
+ return this.getInheritanceHierarchy().iterator();
+ }
+
+ public Iterable<PersistentType> getInheritanceHierarchy() {
+ return this.getInheritanceHierarchyOf(this);
+ }
+
+ public Iterator<PersistentType> ancestors() {
+ return this.getAncestors().iterator();
+ }
+
+ public Iterable<PersistentType> getAncestors() {
+ return this.getInheritanceHierarchyOf(this.superPersistentType);
+ }
+
+ protected Iterable<PersistentType> getInheritanceHierarchyOf(PersistentType start) {
+ // using a chain iterable to traverse up the inheritance tree
+ return new ChainIterable<PersistentType>(start) {
+ @Override
+ protected PersistentType nextLink(PersistentType persistentType) {
+ return persistentType.getSuperPersistentType();
+ }
+ };
+ }
+
+
+ // ********** declaring type name **********
+
+ public String getDeclaringTypeName() {
+ return this.declaringTypeName;
+ }
+
+ protected void setDeclaringTypeName(String name) {
+ String old = this.declaringTypeName;
+ this.declaringTypeName = name;
+ this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDeclaringTypeName() {
+ return this.isJpa2_0Compatible() ? this.buildDeclaringTypeName_() : null;
+ }
+
+ protected String buildDeclaringTypeName_() {
+ return (this.javaPersistentType == null) ?
+ null : ((JavaPersistentType2_0) this.javaPersistentType).getDeclaringTypeName();
+ }
+
+
+ // ********** metamodel **********
+
+ protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() {
+ return this.isJpa2_0Compatible() ?
+ this.getJpaFactory2_0().buildMetamodelSynchronizer(this) :
+ null;
+ }
+
+ public IFile getMetamodelFile() {
+ return (this.javaPersistentType == null) ? null : this.metamodelSynchronizer.getFile();
+ }
+
+ public void initializeMetamodel() {
+ // do nothing - probably shouldn't be called...
+ }
+
+ public boolean isManaged() {
+ return true;
+ }
+
+ /**
+ * All <code>orm.xml</code> persistent types must be able to generate a static metamodel
+ * because 1.0 <code>orm.xml</code> files can be referenced from 2.0 persistence.xml files.
+ */
+ public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ if (this.javaPersistentType != null) {
+ this.metamodelSynchronizer.synchronize(memberTypeTree);
+ }
+ }
+
+ public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ if (this.javaPersistentType != null) {
+ this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree);
+ }
+ }
+
+ public void disposeMetamodel() {
+ // do nothing - probably shouldn't be called...
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return OrmStructureNodes.PERSISTENT_TYPE_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ for (OrmPersistentAttribute attribute : this.getSpecifiedAttributes()) {
+ if (attribute.contains(textOffset)) {
+ return attribute;
+ }
+ }
+ return this;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.mapping.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.dispose();
+ }
+ for (OrmReadOnlyPersistentAttribute virtualAttribute : this.getVirtualAttributes()) {
+ virtualAttribute.dispose();
+ }
+ }
+
+
+ // ********** PersistentType.Owner implementation **********
+
+ public AccessType getOverridePersistentTypeAccess() {
+ if (this.specifiedAccess != null) {
+ return this.specifiedAccess;
+ }
+
+ if (this.superPersistentType instanceof OrmPersistentType) {
+ AccessType accessType = ((OrmPersistentType) this.superPersistentType).getSpecifiedAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+ }
+
+ if (this.mapping.isMetadataComplete()) {
+ AccessType accessType = this.getOwnerDefaultAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+ }
+
+ // no override access type
+ return null;
+ }
+
+ public AccessType getDefaultPersistentTypeAccess() {
+ if (this.superPersistentType instanceof OrmPersistentType) {
+ AccessType accessType = ((OrmPersistentType) this.superPersistentType).getDefaultAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+ }
+
+ return this.getOwnerDefaultAccess();
+ }
+
+
+ //*********** refactoring ***********
+
+ public Iterable<DeleteEdit> createDeleteTypeEdits(IType type) {
+ return this.isFor(type.getFullyQualifiedName('.')) ?
+ new SingleElementIterable<DeleteEdit>(this.mapping.createDeleteEdit()) :
+ EmptyIterable.<DeleteEdit>instance();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.mapping.createRenameTypeEdits(originalType, newName),
+ this.createSpecifiedAttributesRenameTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createSpecifiedAttributesRenameTypeEdits(final IType originalType, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
+ return persistentAttribute.createRenameTypeEdits(originalType, newName);
+ }
+ }
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.mapping.createMoveTypeEdits(originalType, newPackage),
+ this.createSpecifiedAttributesMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createSpecifiedAttributesMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
+ return persistentAttribute.createMoveTypeEdits(originalType, newPackage);
+ }
+ }
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.mapping.createRenamePackageEdits(originalPackage, newName),
+ this.createSpecifiedAttributesRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createSpecifiedAttributesRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
+ return persistentAttribute.createRenamePackageEdits(originalPackage, newName);
+ }
+ }
+ );
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateClass(messages);
+ this.validateMapping(messages, reporter);
+ this.validateAttributes(messages, reporter);
+ }
+
+ protected void validateClass(List<IMessage> messages) {
+ if (this.javaPersistentType == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS,
+ new String[] {this.getName()},
+ this,
+ this.mapping.getClassTextRange()
+ )
+ );
+ }
+ }
+
+ protected void validateMapping(List<IMessage> messages, IReporter reporter) {
+ try {
+ this.mapping.validate(messages, reporter);
+ } catch(Throwable t) {
+ JptJpaCorePlugin.log(t);
+ }
+ }
+
+ protected void validateAttributes(List<IMessage> messages, IReporter reporter) {
+ for (Iterator<OrmReadOnlyPersistentAttribute> stream = this.attributes(); stream.hasNext(); ) {
+ this.validateAttribute(stream.next(), messages, reporter);
+ }
+ }
+
+ protected void validateAttribute(OrmReadOnlyPersistentAttribute attribute, List<IMessage> messages, IReporter reporter) {
+ try {
+ attribute.validate(messages, reporter);
+ } catch(Throwable t) {
+ JptJpaCorePlugin.log(t);
+ }
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.mapping.getValidationTextRange();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public EntityMappings getParent() {
+ return (EntityMappings) super.getParent();
+ }
+
+ protected EntityMappings getEntityMappings() {
+ return this.getParent();
+ }
+
+ public String getDefaultPackage() {
+ return this.getEntityMappings().getPackage();
+ }
+
+ public boolean isFor(String typeName) {
+ String name = this.getName();
+ if (name == null) {
+ return false;
+ }
+ if (name.equals(typeName)) {
+ return true;
+ }
+ String defaultPackage = this.getDefaultPackage();
+ if (defaultPackage == null) {
+ return false;
+ }
+ return (defaultPackage + '.' + name).equals(typeName);
+ }
+
+ public boolean isIn(IPackageFragment packageFragment) {
+ String packageName = this.getPackageName();
+ if (Tools.valuesAreEqual(packageName, packageFragment.getElementName())) {
+ return true;
+ }
+ String defaultPackage = this.getDefaultPackage();
+ if (defaultPackage == null) {
+ return false;
+ }
+ packageName = (packageName == null) ? defaultPackage : defaultPackage + '.' + packageName;
+ return packageName.equals(packageFragment.getElementName());
+ }
+
+ protected String getPackageName() {
+ String className = this.getName();
+ if (className == null) {
+ return null;
+ }
+ int lastPeriod = className.lastIndexOf('.');
+ return (lastPeriod == -1) ? null : className.substring(0, lastPeriod);
+ }
+
+ public boolean contains(int textOffset) {
+ return this.mapping.containsOffset(textOffset);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..9761ef1cce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmPrimaryKeyJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.db.Column;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * <code>orm.xml</code> primary key join column
+ */
+public class GenericOrmPrimaryKeyJoinColumn
+ extends AbstractOrmNamedColumn<XmlPrimaryKeyJoinColumn, OrmBaseJoinColumn.Owner>
+ implements OrmPrimaryKeyJoinColumn
+{
+ /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */
+ protected /* final */ XmlPrimaryKeyJoinColumn xmlColumn; // null for default pk join columns
+
+ protected String specifiedReferencedColumnName;
+ protected String defaultReferencedColumnName;
+
+
+ public GenericOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn xmlColumn) {
+ super(parent, owner, xmlColumn);
+ this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
+ }
+
+
+ // ********** XML column **********
+
+ @Override
+ public XmlPrimaryKeyJoinColumn getXmlColumn() {
+ return this.xmlColumn;
+ }
+
+ @Override
+ protected void setXmlColumn(XmlPrimaryKeyJoinColumn xmlColumn) {
+ this.xmlColumn = xmlColumn;
+ }
+
+ /**
+ * primary key join columns are part of a collection;
+ * the 'primary-key-join-column' element will be removed/added
+ * when the XML join column is removed from/added to
+ * the owner's collection
+ */
+ @Override
+ protected XmlPrimaryKeyJoinColumn buildXmlColumn() {
+ throw new IllegalStateException("XML primary key join column is missing"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see #buildXmlColumn()
+ */
+ @Override
+ protected void removeXmlColumn() {
+ // do nothing
+ }
+
+
+ // ********** referenced column name **********
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ public void setSpecifiedReferencedColumnName(String name) {
+ this.setSpecifiedReferencedColumnName_(name);
+ this.xmlColumn.setReferencedColumnName(name);
+ }
+
+ protected void setSpecifiedReferencedColumnName_(String name) {
+ String old = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = name;
+ this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedReferencedColumnName() {
+ return (this.xmlColumn == null) ? null : this.xmlColumn.getReferencedColumnName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String name) {
+ String old = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = name;
+ this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ // TODO not correct when we start supporting
+ // primary key join columns in 1-1 mappings
+ protected String buildDefaultReferencedColumnName() {
+ return this.buildDefaultName();
+ }
+
+
+ // ********** database stuff **********
+
+ public Table getReferencedColumnDbTable() {
+ return this.owner.getReferencedColumnDbTable();
+ }
+
+ protected Column getReferencedDbColumn() {
+ Table table = this.getReferencedColumnDbTable();
+ return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName());
+ }
+
+ public boolean referencedColumnIsResolved() {
+ return this.getReferencedDbColumn() != null;
+ }
+
+
+ // ********** misc **********
+
+ public void initializeFrom(ReadOnlyPrimaryKeyJoinColumn oldColumn) {
+ super.initializeFrom(oldColumn);
+ this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName());
+ }
+
+ public boolean isDefault() {
+ return this.owner.joinColumnIsDefault(this);
+ }
+
+ @Override
+ public String getTable() {
+ return this.owner.getDefaultTableName();
+ }
+
+ @Override
+ protected NamedColumnTextRangeResolver buildTextRangeResolver() {
+ return new OrmPrimaryKeyJoinColumnTextRangeResolver(this);
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return this.getTextRange(this.xmlColumn.getReferencedColumnNameTextRange());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
new file mode 100644
index 0000000000..c4858f9420
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
@@ -0,0 +1,366 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> query container
+ */
+public class GenericOrmQueryContainer
+ extends AbstractOrmXmlContextNode
+ implements OrmQueryContainer
+{
+ protected final XmlQueryContainer xmlQueryContainer;
+
+ protected final Vector<OrmNamedQuery> namedQueries = new Vector<OrmNamedQuery>();
+ protected NamedQueryContainerAdapter namedQueryContainerAdapter = new NamedQueryContainerAdapter();
+
+ protected final Vector<OrmNamedNativeQuery> namedNativeQueries = new Vector<OrmNamedNativeQuery>();
+ protected NamedNativeQueryContainerAdapter namedNativeQueryContainerAdapter = new NamedNativeQueryContainerAdapter();
+
+
+ public GenericOrmQueryContainer(XmlContextNode parent, XmlQueryContainer xmlQueryContainer) {
+ super(parent);
+ this.xmlQueryContainer = xmlQueryContainer;
+ this.initializeNamedQueries();
+ this.initializeNamedNativeQueries();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncNamedQueries();
+ this.syncNamedNativeQueries();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getNamedQueries());
+ this.updateNodes(this.getNamedNativeQueries());
+ }
+
+
+ // ********** named queries **********
+
+ public ListIterator<OrmNamedQuery> namedQueries() {
+ return this.getNamedQueries().iterator();
+ }
+
+ protected ListIterable<OrmNamedQuery> getNamedQueries() {
+ return new LiveCloneListIterable<OrmNamedQuery>(this.namedQueries);
+ }
+
+ public int namedQueriesSize() {
+ return this.namedQueries.size();
+ }
+
+ public OrmNamedQuery addNamedQuery() {
+ return this.addNamedQuery(this.namedQueries.size());
+ }
+
+ public OrmNamedQuery addNamedQuery(int index) {
+ XmlNamedQuery xmlQuery = this.buildXmlNamedQuery();
+ OrmNamedQuery query = this.addNamedQuery_(index, xmlQuery);
+ this.xmlQueryContainer.getNamedQueries().add(index, xmlQuery);
+ return query;
+ }
+
+ protected XmlNamedQuery buildXmlNamedQuery() {
+ return OrmFactory.eINSTANCE.createXmlNamedQuery();
+ }
+
+ public void removeNamedQuery(NamedQuery namedQuery) {
+ this.removeNamedQuery(this.namedQueries.indexOf(namedQuery));
+ }
+
+ public void removeNamedQuery(int index) {
+ this.removeNamedQuery_(index);
+ this.xmlQueryContainer.getNamedQueries().remove(index);
+ }
+
+ protected void removeNamedQuery_(int index) {
+ this.removeItemFromList(index, this.namedQueries, NAMED_QUERIES_LIST);
+ }
+
+ public void moveNamedQuery(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.namedQueries, NAMED_QUERIES_LIST);
+ this.xmlQueryContainer.getNamedQueries().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeNamedQueries() {
+ for (XmlNamedQuery xmlQuery : this.getXmlNamedQueries()) {
+ this.namedQueries.add(this.buildNamedQuery(xmlQuery));
+ }
+ }
+
+ protected OrmNamedQuery buildNamedQuery(XmlNamedQuery xmlNamedQuery) {
+ return this.getContextNodeFactory().buildOrmNamedQuery(this, xmlNamedQuery);
+ }
+
+ protected void syncNamedQueries() {
+ ContextContainerTools.synchronizeWithResourceModel(this.namedQueryContainerAdapter);
+ }
+
+ protected Iterable<XmlNamedQuery> getXmlNamedQueries() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlNamedQuery>(this.xmlQueryContainer.getNamedQueries());
+ }
+
+ protected void moveNamedQuery_(int index, OrmNamedQuery namedQuery) {
+ this.moveItemInList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
+ }
+
+ protected OrmNamedQuery addNamedQuery_(int index, XmlNamedQuery xmlNamedQuery) {
+ OrmNamedQuery query = this.buildNamedQuery(xmlNamedQuery);
+ this.addItemToList(index, query, this.namedQueries, NAMED_QUERIES_LIST);
+ return query;
+ }
+
+ protected void removeNamedQuery_(OrmNamedQuery namedQuery) {
+ this.removeNamedQuery_(this.namedQueries.indexOf(namedQuery));
+ }
+
+ /**
+ * named query container adapter
+ */
+ protected class NamedQueryContainerAdapter
+ implements ContextContainerTools.Adapter<OrmNamedQuery, XmlNamedQuery>
+ {
+ public Iterable<OrmNamedQuery> getContextElements() {
+ return GenericOrmQueryContainer.this.getNamedQueries();
+ }
+ public Iterable<XmlNamedQuery> getResourceElements() {
+ return GenericOrmQueryContainer.this.getXmlNamedQueries();
+ }
+ public XmlNamedQuery getResourceElement(OrmNamedQuery contextElement) {
+ return contextElement.getXmlQuery();
+ }
+ public void moveContextElement(int index, OrmNamedQuery element) {
+ GenericOrmQueryContainer.this.moveNamedQuery_(index, element);
+ }
+ public void addContextElement(int index, XmlNamedQuery resourceElement) {
+ GenericOrmQueryContainer.this.addNamedQuery_(index, resourceElement);
+ }
+ public void removeContextElement(OrmNamedQuery element) {
+ GenericOrmQueryContainer.this.removeNamedQuery_(element);
+ }
+ }
+
+
+ // ********** named native queries **********
+
+ public ListIterator<OrmNamedNativeQuery> namedNativeQueries() {
+ return this.getNamedNativeQueries().iterator();
+ }
+
+ protected ListIterable<OrmNamedNativeQuery> getNamedNativeQueries() {
+ return new LiveCloneListIterable<OrmNamedNativeQuery>(this.namedNativeQueries);
+ }
+
+ public int namedNativeQueriesSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ public OrmNamedNativeQuery addNamedNativeQuery() {
+ return this.addNamedNativeQuery(this.namedNativeQueries.size());
+ }
+
+ public OrmNamedNativeQuery addNamedNativeQuery(int index) {
+ XmlNamedNativeQuery xmlQuery = this.buildXmlNamedNativeQuery();
+ OrmNamedNativeQuery query = this.addNamedNativeQuery_(index, xmlQuery);
+ this.xmlQueryContainer.getNamedNativeQueries().add(index, xmlQuery);
+ return query;
+ }
+
+ protected XmlNamedNativeQuery buildXmlNamedNativeQuery() {
+ return OrmFactory.eINSTANCE.createXmlNamedNativeQuery();
+ }
+
+ public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
+ this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery));
+ }
+
+ public void removeNamedNativeQuery(int index) {
+ this.removeNamedNativeQuery_(index);
+ this.xmlQueryContainer.getNamedNativeQueries().remove(index);
+ }
+
+ protected void removeNamedNativeQuery_(int index) {
+ this.removeItemFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ this.xmlQueryContainer.getNamedNativeQueries().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeNamedNativeQueries() {
+ for (XmlNamedNativeQuery xmlQuery : this.getXmlNamedNativeQueries()) {
+ this.namedNativeQueries.add(this.buildNamedNativeQuery(xmlQuery));
+ }
+ }
+
+ protected OrmNamedNativeQuery buildNamedNativeQuery(XmlNamedNativeQuery xmlNamedNativeQuery) {
+ return this.getContextNodeFactory().buildOrmNamedNativeQuery(this, xmlNamedNativeQuery);
+ }
+
+ protected void syncNamedNativeQueries() {
+ ContextContainerTools.synchronizeWithResourceModel(this.namedNativeQueryContainerAdapter);
+ }
+
+ protected Iterable<XmlNamedNativeQuery> getXmlNamedNativeQueries() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlNamedNativeQuery>(this.xmlQueryContainer.getNamedNativeQueries());
+ }
+
+ protected void moveNamedNativeQuery_(int index, OrmNamedNativeQuery namedNativeQuery) {
+ this.moveItemInList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ protected OrmNamedNativeQuery addNamedNativeQuery_(int index, XmlNamedNativeQuery xmlNamedNativeQuery) {
+ OrmNamedNativeQuery query = this.buildNamedNativeQuery(xmlNamedNativeQuery);
+ this.addItemToList(index, query, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ return query;
+ }
+
+ protected void removeNamedNativeQuery_(OrmNamedNativeQuery namedNativeQuery) {
+ this.removeNamedNativeQuery_(this.namedNativeQueries.indexOf(namedNativeQuery));
+ }
+
+ /**
+ * named native query container adapter
+ */
+ protected class NamedNativeQueryContainerAdapter
+ implements ContextContainerTools.Adapter<OrmNamedNativeQuery, XmlNamedNativeQuery>
+ {
+ public Iterable<OrmNamedNativeQuery> getContextElements() {
+ return GenericOrmQueryContainer.this.getNamedNativeQueries();
+ }
+ public Iterable<XmlNamedNativeQuery> getResourceElements() {
+ return GenericOrmQueryContainer.this.getXmlNamedNativeQueries();
+ }
+ public XmlNamedNativeQuery getResourceElement(OrmNamedNativeQuery contextElement) {
+ return contextElement.getXmlQuery();
+ }
+ public void moveContextElement(int index, OrmNamedNativeQuery element) {
+ GenericOrmQueryContainer.this.moveNamedNativeQuery_(index, element);
+ }
+ public void addContextElement(int index, XmlNamedNativeQuery resourceElement) {
+ GenericOrmQueryContainer.this.addNamedNativeQuery_(index, resourceElement);
+ }
+ public void removeContextElement(OrmNamedNativeQuery element) {
+ GenericOrmQueryContainer.this.removeNamedNativeQuery_(element);
+ }
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateQueries(messages);
+ }
+
+ protected void validateQueries(List<IMessage> messages) {
+ for (OrmQuery localQuery : this.getQueries()) {
+ String name = localQuery.getName();
+ if (StringTools.stringIsEmpty(name)){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.QUERY_NAME_UNDEFINED,
+ new String[] {},
+ localQuery,
+ localQuery.getNameTextRange()
+ )
+ );
+ } else {
+ List<String> reportedNames = new ArrayList<String>();
+ for (Iterator<Query> globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) {
+ Query globalQuery = globalQueries.next();
+ if (localQuery.duplicates(globalQuery) && !reportedNames.contains(name)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.QUERY_DUPLICATE_NAME,
+ new String[] {name},
+ localQuery,
+ localQuery.getNameTextRange())
+ );
+ reportedNames.add(name);
+ }
+ }
+ }
+ String query = localQuery.getQuery();
+ if (StringTools.stringIsEmpty(query)){
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.QUERY_STATEMENT_UNDEFINED,
+ new String[] {name},
+ localQuery,
+ localQuery.getNameTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ /**
+ * Return all the queries, named and named native.
+ */
+ @SuppressWarnings("unchecked")
+ protected Iterable<OrmQuery> getQueries() {
+ return new CompositeIterable<OrmQuery>(
+ this.getNamedQueries(),
+ this.getNamedNativeQueries()
+ );
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.xmlQueryContainer.getValidationTextRange();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
new file mode 100644
index 0000000000..36774ef58d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
+
+/**
+ * <code>orm.xml</code> query hint
+ */
+public class GenericOrmQueryHint
+ extends AbstractOrmXmlContextNode
+ implements OrmQueryHint
+{
+ protected final XmlQueryHint xmlQueryHint;
+
+ protected String name;
+ protected String value;
+
+
+ public GenericOrmQueryHint(OrmQuery parent, XmlQueryHint xmlQueryHint) {
+ super(parent);
+ this.xmlQueryHint = xmlQueryHint;
+ this.name = xmlQueryHint.getName();
+ this.value = xmlQueryHint.getValue();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.xmlQueryHint.getName());
+ this.setValue_(this.xmlQueryHint.getValue());
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.setName_(name);
+ this.xmlQueryHint.setName(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+
+ // ********** value **********
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.setValue_(value);
+ this.xmlQueryHint.setValue(value);
+ }
+
+ protected void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.xmlQueryHint.getValidationTextRange();
+ }
+
+
+ // ********** miscelleneous **********
+
+ public XmlQueryHint getXmlQueryHint() {
+ return this.xmlQueryHint;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
new file mode 100644
index 0000000000..f6a5bc41c6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReferenceTable;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
+import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> join table or collection table
+ */
+public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTable>
+ extends AbstractOrmTable<X>
+ implements OrmReferenceTable
+{
+ protected final Vector<OrmJoinColumn> specifiedJoinColumns = new Vector<OrmJoinColumn>();
+ protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final OrmJoinColumn.Owner joinColumnOwner;
+
+ protected OrmJoinColumn defaultJoinColumn;
+
+
+ protected GenericOrmReferenceTable(XmlContextNode parent, Owner owner) {
+ super(parent, owner);
+ this.joinColumnOwner = this.buildJoinColumnOwner();
+ this.initializeSpecifiedJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedJoinColumns();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedJoinColumns());
+ this.updateDefaultJoinColumn();
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<OrmJoinColumn> joinColumns() {
+ return this.getJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmJoinColumn> getJoinColumns() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
+ }
+
+ public int joinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ }
+
+ public void convertDefaultToSpecifiedJoinColumn() {
+ MappingTools.convertReferenceTableDefaultToSpecifiedJoinColumn(this);
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
+ return this.getSpecifiedJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
+ return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return this.specifiedJoinColumns.size() != 0;
+ }
+
+ public OrmJoinColumn getSpecifiedJoinColumn(int index) {
+ return this.specifiedJoinColumns.get(index);
+ }
+
+ public OrmJoinColumn addSpecifiedJoinColumn() {
+ return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ }
+
+ public OrmJoinColumn addSpecifiedJoinColumn(int index) {
+ X xmlTable = this.getXmlTableForUpdate();
+ XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
+ OrmJoinColumn joinColumn = this.addSpecifiedJoinColumn_(index, xmlJoinColumn);
+ xmlTable.getJoinColumns().add(index, xmlJoinColumn);
+ return joinColumn;
+ }
+
+ protected XmlJoinColumn buildXmlJoinColumn() {
+ return OrmFactory.eINSTANCE.createXmlJoinColumn();
+ }
+
+ public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ this.removeSpecifiedJoinColumn_(index);
+ this.getXmlTable().getJoinColumns().remove(index);
+ this.removeXmlTableIfUnset();
+ }
+
+ protected void removeSpecifiedJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.getXmlTable().getJoinColumns().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeSpecifiedJoinColumns() {
+ for (XmlJoinColumn xmlJoinColumn : this.getXmlJoinColumns()) {
+ this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn));
+ }
+ }
+
+ protected void syncSpecifiedJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<XmlJoinColumn> getXmlJoinColumns() {
+ X xmlTable = this.getXmlTable();
+ return (xmlTable == null) ?
+ EmptyIterable.<XmlJoinColumn>instance() :
+ // clone to reduce chance of concurrency problems
+ new LiveCloneIterable<XmlJoinColumn>(xmlTable.getJoinColumns());
+ }
+
+ protected void moveSpecifiedJoinColumn_(int index, OrmJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmJoinColumn addSpecifiedJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
+ OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn);
+ this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) {
+ this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
+ }
+
+ /**
+ * specified join column container adapter
+ */
+ protected class SpecifiedJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
+ {
+ public Iterable<OrmJoinColumn> getContextElements() {
+ return GenericOrmReferenceTable.this.getSpecifiedJoinColumns();
+ }
+ public Iterable<XmlJoinColumn> getResourceElements() {
+ return GenericOrmReferenceTable.this.getXmlJoinColumns();
+ }
+ public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
+ return contextElement.getXmlColumn();
+ }
+ public void moveContextElement(int index, OrmJoinColumn element) {
+ GenericOrmReferenceTable.this.moveSpecifiedJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, XmlJoinColumn resourceElement) {
+ GenericOrmReferenceTable.this.addSpecifiedJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(OrmJoinColumn element) {
+ GenericOrmReferenceTable.this.removeSpecifiedJoinColumn_(element);
+ }
+ }
+
+ protected abstract OrmJoinColumn.Owner buildJoinColumnOwner();
+
+
+ // ********** default join column **********
+
+ public OrmJoinColumn getDefaultJoinColumn() {
+ return this.defaultJoinColumn;
+ }
+
+ protected void setDefaultJoinColumn(OrmJoinColumn joinColumn) {
+ OrmJoinColumn old = this.defaultJoinColumn;
+ this.defaultJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn);
+ }
+
+ protected ListIterable<OrmJoinColumn> getDefaultJoinColumns() {
+ return (this.defaultJoinColumn != null) ?
+ new SingleElementListIterable<OrmJoinColumn>(this.defaultJoinColumn) :
+ EmptyListIterable.<OrmJoinColumn>instance();
+ }
+
+ protected int getDefaultJoinColumnsSize() {
+ return (this.defaultJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultJoinColumn() {
+ if (this.buildsDefaultJoinColumn()) {
+ if (this.defaultJoinColumn == null) {
+ this.setDefaultJoinColumn(this.buildJoinColumn(null));
+ } else {
+ this.defaultJoinColumn.update();
+ }
+ } else {
+ this.setDefaultJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultJoinColumn() {
+ return ! this.hasSpecifiedJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ protected void initializeFrom(ReadOnlyReferenceTable oldTable) {
+ super.initializeFrom(oldTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedJoinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
+ }
+ }
+
+ protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) {
+ super.initializeFromVirtual(virtualTable);
+ for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.joinColumns())) {
+ this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
+ }
+ }
+
+ protected OrmJoinColumn buildJoinColumn(XmlJoinColumn xmlJoinColumn) {
+ return this.getContextNodeFactory().buildOrmJoinColumn(this, this.joinColumnOwner, xmlJoinColumn);
+ }
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ boolean continueValidating = this.buildTableValidator().validate(messages, reporter);
+
+ //join column validation will handle the check for whether to validate against the database
+ //some validation messages are not database specific. If the database validation for the
+ //table fails we will stop there and not validate the join columns at all
+ if (continueValidating) {
+ this.validateJoinColumns(messages, reporter);
+ }
+ }
+
+ protected void validateJoinColumns(List<IMessage> messages, IReporter reporter) {
+ this.validateJoinColumns(this.getJoinColumns(), messages, reporter);
+ }
+
+ protected void validateJoinColumns(Iterable<OrmJoinColumn> joinColumns, List<IMessage> messages, IReporter reporter) {
+ for (OrmJoinColumn joinColumn : joinColumns) {
+ joinColumn.validate(messages, reporter);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
new file mode 100644
index 0000000000..39971d0abb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
@@ -0,0 +1,418 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.context.BaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
+import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
+import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>orm.xml</code> secondary table
+ */
+public class GenericOrmSecondaryTable
+ extends AbstractOrmTable<XmlSecondaryTable>
+ implements OrmSecondaryTable
+{
+ /** @see AbstractOrmTable#AbstractOrmTable(org.eclipse.jpt.jpa.core.context.XmlContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable) */
+ protected /* final */ XmlSecondaryTable xmlSecondaryTable;
+
+ protected final Vector<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
+ protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final OrmBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
+
+ protected OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
+
+
+ public GenericOrmSecondaryTable(OrmEntity parent, Owner owner, XmlSecondaryTable xmlSecondaryTable) {
+ super(parent, owner, xmlSecondaryTable);
+ this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ this.initializeSpecifiedPrimaryKeyJoinColumns();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncSpecifiedPrimaryKeyJoinColumns();
+ if (this.defaultPrimaryKeyJoinColumn != null) {
+ this.defaultPrimaryKeyJoinColumn.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getSpecifiedPrimaryKeyJoinColumns());
+ this.updateDefaultPrimaryKeyJoinColumn();
+ }
+
+
+ // ********** XML table **********
+
+ @Override
+ public XmlSecondaryTable getXmlTable() {
+ return this.xmlSecondaryTable;
+ }
+
+ /**
+ * @see AbstractOrmTable
+ */
+ @Override
+ protected void setXmlTable(XmlSecondaryTable xmlTable) {
+ this.xmlSecondaryTable = xmlTable;
+ }
+
+ /**
+ * secondary tables are part of a collection;
+ * the 'secondary-table' element will be removed from/added
+ * when the XML secondary table is removed/added to
+ * the XML entity's collection
+ */
+ @Override
+ protected XmlSecondaryTable buildXmlTable() {
+ throw new IllegalStateException("XML secondary table is missing"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see #buildXmlTable()
+ */
+ @Override
+ protected void removeXmlTable() {
+ // do nothing
+ }
+
+
+ // ********** primary key join columns **********
+
+ public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.getPrimaryKeyJoinColumns().iterator();
+ }
+
+ protected ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
+ }
+
+
+ // ********** specified primary key join columns **********
+
+ public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
+ }
+
+ public ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return new LiveCloneListIterable<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ }
+
+ public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ }
+
+ public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
+ OrmPrimaryKeyJoinColumn joinColumn = this.addSpecifiedPrimaryKeyJoinColumn_(index, xmlJoinColumn);
+ this.xmlSecondaryTable.getPrimaryKeyJoinColumns().add(index, xmlJoinColumn);
+ return joinColumn;
+ }
+
+ protected XmlPrimaryKeyJoinColumn buildXmlPrimaryKeyJoinColumn() {
+ return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn();
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ this.removeSpecifiedPrimaryKeyJoinColumn_(index);
+ this.xmlSecondaryTable.getPrimaryKeyJoinColumns().remove(index);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
+ this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.xmlSecondaryTable.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeSpecifiedPrimaryKeyJoinColumns() {
+ for (XmlPrimaryKeyJoinColumn xmlJoinColumn : this.getXmlPrimaryKeyJoinColumns()) {
+ this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlJoinColumn));
+ }
+ }
+
+ protected void syncSpecifiedPrimaryKeyJoinColumns() {
+ ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ }
+
+ protected Iterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlPrimaryKeyJoinColumn>(this.xmlSecondaryTable.getPrimaryKeyJoinColumns());
+ }
+
+ protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn joinColumn) {
+ this.moveItemInList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ protected OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlJoinColumn) {
+ OrmPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(xmlJoinColumn);
+ this.addItemToList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ return joinColumn;
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ }
+
+ /**
+ * specified primary key join column container adapter
+ */
+ protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
+ implements ContextContainerTools.Adapter<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
+ {
+ public Iterable<OrmPrimaryKeyJoinColumn> getContextElements() {
+ return GenericOrmSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns();
+ }
+ public Iterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
+ return GenericOrmSecondaryTable.this.getXmlPrimaryKeyJoinColumns();
+ }
+ public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
+ return contextElement.getXmlColumn();
+ }
+ public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) {
+ GenericOrmSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
+ }
+ public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) {
+ GenericOrmSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
+ }
+ public void removeContextElement(OrmPrimaryKeyJoinColumn element) {
+ GenericOrmSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
+ }
+ }
+
+ protected OrmBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+
+ // ********** default primary key join column **********
+
+ public OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
+ return this.defaultPrimaryKeyJoinColumn;
+ }
+
+ protected void setDefaultPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn joinColumn) {
+ OrmPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn;
+ this.defaultPrimaryKeyJoinColumn = joinColumn;
+ this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, old, joinColumn);
+ }
+
+ protected ListIterable<OrmPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
+ return (this.defaultPrimaryKeyJoinColumn != null) ?
+ new SingleElementListIterable<OrmPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
+ EmptyListIterable.<OrmPrimaryKeyJoinColumn>instance();
+ }
+
+ protected int getDefaultPrimaryKeyJoinColumnsSize() {
+ return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
+ }
+
+ protected void updateDefaultPrimaryKeyJoinColumn() {
+ if (this.buildsDefaultPrimaryKeyJoinColumn()) {
+ if (this.defaultPrimaryKeyJoinColumn == null) {
+ this.setDefaultPrimaryKeyJoinColumn(this.buildPrimaryKeyJoinColumn(null));
+ } else {
+ this.defaultPrimaryKeyJoinColumn.update();
+ }
+ } else {
+ this.setDefaultPrimaryKeyJoinColumn(null);
+ }
+ }
+
+ protected boolean buildsDefaultPrimaryKeyJoinColumn() {
+ return ! this.hasSpecifiedPrimaryKeyJoinColumns();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmEntity getParent() {
+ return (OrmEntity) super.getParent();
+ }
+
+ protected OrmEntity getEntity() {
+ return this.getParent();
+ }
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ public void initializeFrom(ReadOnlySecondaryTable oldSecondaryTable) {
+ super.initializeFrom(oldSecondaryTable);
+ for (ReadOnlyPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(oldSecondaryTable.specifiedPrimaryKeyJoinColumns())) {
+ this.addSpecifiedPrimaryKeyJoinColumn().initializeFrom(pkJoinColumn);
+ }
+ }
+
+ protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlJoinColumn) {
+ return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlJoinColumn);
+ }
+
+
+ // ********** defaults **********
+
+ /**
+ * a secondary table doesn't have a default name
+ */
+ @Override
+ protected String buildDefaultName() {
+ return null;
+ }
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.connectionProfileIsActive();
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ boolean continueValidating = this.buildTableValidator().validate(messages, reporter);
+
+ //join column validation will handle the check for whether to validate against the database
+ //some validation messages are not database specific. If the database validation for the
+ //table fails we will stop there and not validate the join columns at all
+ if (continueValidating) {
+ for (OrmPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
+ pkJoinColumn.validate(messages, reporter);
+ }
+ }
+ }
+
+
+ // ********** primary key join column owner adapter **********
+
+ protected class PrimaryKeyJoinColumnOwner
+ implements OrmBaseJoinColumn.Owner
+ {
+ protected OrmEntity getEntity() {
+ return GenericOrmSecondaryTable.this.getEntity();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getEntity();
+ }
+
+ public String getDefaultTableName() {
+ return GenericOrmSecondaryTable.this.getName();
+ }
+
+ public String getDefaultColumnName() {
+ if (this.joinColumnsSize() != 1) {
+ return null;
+ }
+ Entity parentEntity = this.getEntity().getParentEntity();
+ return (parentEntity != null) ?
+ parentEntity.getPrimaryKeyColumnName() :
+ this.getEntity().getPrimaryKeyColumnName();
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return GenericOrmSecondaryTable.this.getDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmSecondaryTable.this.primaryKeyJoinColumnsSize();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public Table getReferencedColumnDbTable() {
+ return this.getTypeMapping().getPrimaryDbTable();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmSecondaryTable.this.getValidationTextRange();
+ }
+
+ protected boolean isSecondaryTableVirtual() {
+ return GenericOrmSecondaryTable.this.isVirtual();
+ }
+
+ protected String getSecondaryTableName() {
+ return GenericOrmSecondaryTable.this.getName();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericOrmSecondaryTable.this, (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
new file mode 100644
index 0000000000..5e56c71cc4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+
+/**
+ * <code>orm.xml</code> sequence generator
+ */
+public class GenericOrmSequenceGenerator
+ extends AbstractOrmSequenceGenerator
+{
+ public GenericOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) {
+ super(parent, xmlSequenceGenerator);
+ }
+
+ // ********** database stuff **********
+
+ /**
+ * The JPA 1.0 spec does not allow a sequence to specify a catalog.
+ */
+ @Override
+ protected String getCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+ /**
+ * The JPA 1.0 spec does not allow a sequence to specify a schema.
+ */
+ @Override
+ protected String getSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java
new file mode 100644
index 0000000000..0832952ada
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTable;
+
+/**
+ * <code>orm.xml</code> table
+ */
+public class GenericOrmTable
+ extends AbstractOrmTable<XmlTable>
+{
+ public GenericOrmTable(OrmEntity parent, Owner owner) {
+ super(parent, owner);
+ }
+
+
+ // ********** XML table **********
+
+ @Override
+ protected XmlTable getXmlTable() {
+ return this.getXmlEntity().getTable();
+ }
+
+ @Override
+ protected XmlTable buildXmlTable() {
+ XmlTable xmlTable = OrmFactory.eINSTANCE.createXmlTable();
+ this.getXmlEntity().setTable(xmlTable);
+ return xmlTable;
+ }
+
+ @Override
+ protected void removeXmlTable() {
+ this.getXmlEntity().setTable(null);
+ }
+
+ protected XmlEntity getXmlEntity() {
+ return this.getEntity().getXmlTypeMapping();
+ }
+
+
+ // ********** defaults **********
+
+ @Override
+ protected String buildDefaultName() {
+ return this.getEntity().getDefaultTableName();
+ }
+
+ @Override
+ protected String buildDefaultSchema() {
+ return this.getEntity().getDefaultSchema();
+ }
+
+ @Override
+ protected String buildDefaultCatalog() {
+ return this.getEntity().getDefaultCatalog();
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.connectionProfileIsActive();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmEntity getParent() {
+ return (OrmEntity) super.getParent();
+ }
+
+ protected OrmEntity getEntity() {
+ return this.getParent();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
new file mode 100644
index 0000000000..9805b186f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
@@ -0,0 +1,440 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
+import org.eclipse.jpt.jpa.db.Schema;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * <code>orm.xml</code> table generator
+ */
+public class GenericOrmTableGenerator
+ extends AbstractOrmGenerator<XmlTableGenerator>
+ implements OrmTableGenerator, UniqueConstraint.Owner
+{
+ protected String specifiedTable;
+ protected String defaultTable;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedPkColumnName;
+ protected String defaultPkColumnName;
+
+ protected String specifiedValueColumnName;
+ protected String defaultValueColumnName;
+
+ protected String specifiedPkColumnValue;
+ protected String defaultPkColumnValue;
+
+ protected final Vector<OrmUniqueConstraint> uniqueConstraints = new Vector<OrmUniqueConstraint>();
+ protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+
+
+ // ********** constructor **********
+
+ public GenericOrmTableGenerator(XmlContextNode parent, XmlTableGenerator xmlTableGenerator) {
+ super(parent, xmlTableGenerator);
+ this.specifiedTable = xmlTableGenerator.getTable();
+ this.specifiedSchema = xmlTableGenerator.getSchema();
+ this.specifiedCatalog = xmlTableGenerator.getCatalog();
+ this.specifiedPkColumnName = xmlTableGenerator.getPkColumnName();
+ this.specifiedValueColumnName = xmlTableGenerator.getValueColumnName();
+ this.specifiedPkColumnValue = xmlTableGenerator.getPkColumnValue();
+ this.initializeUniqueContraints();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTable_(this.xmlGenerator.getTable());
+ this.setSpecifiedSchema_(this.xmlGenerator.getSchema());
+ this.setSpecifiedCatalog_(this.xmlGenerator.getCatalog());
+ this.setSpecifiedPkColumnName_(this.xmlGenerator.getPkColumnName());
+ this.setSpecifiedValueColumnName_(this.xmlGenerator.getValueColumnName());
+ this.setSpecifiedPkColumnValue_(this.xmlGenerator.getPkColumnValue());
+ this.syncUniqueConstraints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultTable(this.buildDefaultTable());
+ this.setDefaultSchema(this.buildDefaultSchema());
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.setDefaultPkColumnName(this.buildDefaultPkColumnName());
+ this.setDefaultValueColumnName(this.buildDefaultValueColumnName());
+ this.setDefaultPkColumnValue(this.buildDefaultPkColumnValue());
+ this.updateNodes(this.getUniqueConstraints());
+ }
+
+
+ // ********** initial value **********
+
+ @Override
+ protected int buildDefaultInitialValue() {
+ return DEFAULT_INITIAL_VALUE;
+ }
+
+
+ // ********** table **********
+
+ public String getTable() {
+ return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable;
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ public void setSpecifiedTable(String table) {
+ this.setSpecifiedTable_(table);
+ this.xmlGenerator.setTable(table);
+ }
+
+ protected void setSpecifiedTable_(String table) {
+ String old = this.specifiedTable;
+ this.specifiedTable = table;
+ this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table);
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String table) {
+ String old = this.defaultTable;
+ this.defaultTable = table;
+ this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table);
+ }
+
+ protected String buildDefaultTable() {
+ return null; // TODO the default table is determined by the runtime provider...
+ }
+
+ public Table getDbTable() {
+ Schema dbSchema = this.getDbSchema();
+ return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getTable());
+ }
+
+
+ // ********** schema **********
+
+ @Override
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ this.setSpecifiedSchema_(schema);
+ this.xmlGenerator.setSchema(schema);
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+
+ // ********** catalog **********
+
+ @Override
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ this.setSpecifiedCatalog_(catalog);
+ this.xmlGenerator.setCatalog(catalog);
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** primary key column name **********
+
+ public String getPkColumnName() {
+ return (this.specifiedPkColumnName != null) ? this.specifiedPkColumnName : this.defaultPkColumnName;
+ }
+
+ public String getSpecifiedPkColumnName() {
+ return this.specifiedPkColumnName;
+ }
+
+ public void setSpecifiedPkColumnName(String name) {
+ this.setSpecifiedPkColumnName_(name);
+ this.xmlGenerator.setPkColumnName(name);
+ }
+
+ protected void setSpecifiedPkColumnName_(String name) {
+ String old = this.specifiedPkColumnName;
+ this.specifiedPkColumnName = name;
+ this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ public String getDefaultPkColumnName() {
+ return this.defaultPkColumnName;
+ }
+
+ protected void setDefaultPkColumnName(String name) {
+ String old = this.defaultPkColumnName;
+ this.defaultPkColumnName = name;
+ this.firePropertyChanged(DEFAULT_PK_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultPkColumnName() {
+ return null; // TODO the default pk column name is determined by the runtime provider...
+ }
+
+
+ // ********** value column name **********
+
+ public String getValueColumnName() {
+ return (this.specifiedValueColumnName != null) ? this.specifiedValueColumnName : this.defaultValueColumnName;
+ }
+
+ public String getSpecifiedValueColumnName() {
+ return this.specifiedValueColumnName;
+ }
+
+ public void setSpecifiedValueColumnName(String name) {
+ this.setSpecifiedValueColumnName_(name);
+ this.xmlGenerator.setValueColumnName(name);
+ }
+
+ protected void setSpecifiedValueColumnName_(String name) {
+ String old = this.specifiedValueColumnName;
+ this.specifiedValueColumnName = name;
+ this.firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ public String getDefaultValueColumnName() {
+ return this.defaultValueColumnName;
+ }
+
+ protected void setDefaultValueColumnName(String name) {
+ String old = this.defaultValueColumnName;
+ this.defaultValueColumnName = name;
+ this.firePropertyChanged(DEFAULT_VALUE_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultValueColumnName() {
+ return null; // TODO the default value column name is determined by the runtime provider...
+ }
+
+
+ // ********** primary key column value **********
+
+ public String getPkColumnValue() {
+ return (this.specifiedPkColumnValue != null) ? this.specifiedPkColumnValue : this.defaultPkColumnValue;
+ }
+
+ public String getSpecifiedPkColumnValue() {
+ return this.specifiedPkColumnValue;
+ }
+
+ public void setSpecifiedPkColumnValue(String value) {
+ this.setSpecifiedPkColumnValue_(value);
+ this.xmlGenerator.setPkColumnValue(value);
+ }
+
+ protected void setSpecifiedPkColumnValue_(String value) {
+ String old = this.specifiedPkColumnValue;
+ this.specifiedPkColumnValue = value;
+ this.firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, old, value);
+ }
+
+ public String getDefaultPkColumnValue() {
+ return this.defaultPkColumnValue;
+ }
+
+ protected void setDefaultPkColumnValue(String value) {
+ String old = this.defaultPkColumnValue;
+ this.defaultPkColumnValue = value;
+ this.firePropertyChanged(DEFAULT_PK_COLUMN_VALUE_PROPERTY, old, value);
+ }
+
+ protected String buildDefaultPkColumnValue() {
+ return null; // TODO the default pk column value is determined by the runtime provider...
+ }
+
+
+ // ********** unique constraints **********
+
+ public Iterable<OrmUniqueConstraint> getUniqueConstraints() {
+ return new LiveCloneIterable<OrmUniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public OrmUniqueConstraint addUniqueConstraint() {
+ return this.addUniqueConstraint(this.uniqueConstraints.size());
+ }
+
+ public OrmUniqueConstraint addUniqueConstraint(int index) {
+ XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint();
+ OrmUniqueConstraint constraint = this.addUniqueConstraint_(index, xmlConstraint);
+ this.xmlGenerator.getUniqueConstraints().add(index, xmlConstraint);
+ return constraint;
+ }
+
+ protected XmlUniqueConstraint buildXmlUniqueConstraint() {
+ return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
+ }
+
+ public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
+ }
+
+ public void removeUniqueConstraint(int index) {
+ this.removeUniqueConstraint_(index);
+ this.xmlGenerator.getUniqueConstraints().remove(index);
+ }
+
+ protected void removeUniqueConstraint_(int index) {
+ this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.xmlGenerator.getUniqueConstraints().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeUniqueContraints() {
+ for (XmlUniqueConstraint constraint : this.getXmlUniqueConstraints()) {
+ this.uniqueConstraints.add(this.buildUniqueConstraint(constraint));
+ }
+ }
+
+ protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint resourceUniqueConstraint) {
+ return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, resourceUniqueConstraint);
+ }
+
+ protected void syncUniqueConstraints() {
+ ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
+ }
+
+ protected Iterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneIterable<XmlUniqueConstraint>(this.xmlGenerator.getUniqueConstraints());
+ }
+
+ protected void moveUniqueConstraint_(int index, OrmUniqueConstraint uniqueConstraint) {
+ this.moveItemInList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ protected OrmUniqueConstraint addUniqueConstraint_(int index, XmlUniqueConstraint xmlConstraint) {
+ OrmUniqueConstraint constraint = this.buildUniqueConstraint(xmlConstraint);
+ this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ return constraint;
+ }
+
+ protected void removeUniqueConstraint_(OrmUniqueConstraint uniqueConstraint) {
+ this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(uniqueConstraint));
+ }
+
+ /**
+ * unique constraint container adapter
+ */
+ protected class UniqueConstraintContainerAdapter
+ implements ContextContainerTools.Adapter<OrmUniqueConstraint, XmlUniqueConstraint>
+ {
+ public Iterable<OrmUniqueConstraint> getContextElements() {
+ return GenericOrmTableGenerator.this.getUniqueConstraints();
+ }
+ public Iterable<XmlUniqueConstraint> getResourceElements() {
+ return GenericOrmTableGenerator.this.getXmlUniqueConstraints();
+ }
+ public XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
+ return contextElement.getXmlUniqueConstraint();
+ }
+ public void moveContextElement(int index, OrmUniqueConstraint element) {
+ GenericOrmTableGenerator.this.moveUniqueConstraint_(index, element);
+ }
+ public void addContextElement(int index, XmlUniqueConstraint resourceElement) {
+ GenericOrmTableGenerator.this.addUniqueConstraint_(index, resourceElement);
+ }
+ public void removeContextElement(OrmUniqueConstraint element) {
+ GenericOrmTableGenerator.this.removeUniqueConstraint_(element);
+ }
+ }
+
+
+ // ********** UniqueConstraint.Owner implementation **********
+
+ public Iterator<String> candidateUniqueConstraintColumnNames() {
+ org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
+ return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.<String>instance();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
new file mode 100644
index 0000000000..c95d8743e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.TemporalConverter;
+import org.eclipse.jpt.jpa.core.context.TemporalType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class GenericOrmTemporalConverter
+ extends AbstractOrmConverter
+ implements OrmTemporalConverter
+{
+ protected TemporalType temporalType;
+
+
+ public GenericOrmTemporalConverter(OrmAttributeMapping parent) {
+ super(parent);
+ this.temporalType = this.buildTemporalType();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setTemporalType_(this.buildTemporalType());
+ }
+
+
+ // ********** temporal type **********
+
+ public TemporalType getTemporalType() {
+ return this.temporalType;
+ }
+
+ public void setTemporalType(TemporalType temporalType) {
+ this.setTemporalType_(temporalType);
+ this.setXmlTemporal(temporalType);
+ }
+
+ protected void setTemporalType_(TemporalType temporalType) {
+ TemporalType old = this.temporalType;
+ this.temporalType = temporalType;
+ this.firePropertyChanged(TEMPORAL_TYPE_PROPERTY, old, temporalType);
+ }
+
+ protected void setXmlTemporal(TemporalType temporalType) {
+ this.getXmlConvertibleMapping().setTemporal(TemporalType.toOrmResourceModel(temporalType));
+ }
+
+ protected TemporalType buildTemporalType() {
+ return TemporalType.fromOrmResourceModel(this.getXmlConvertibleMapping().getTemporal());
+ }
+
+
+ // ********** misc **********
+
+ public Class<? extends Converter> getType() {
+ return TemporalConverter.class;
+ }
+
+ public void initialize() {
+ // start with DATE(?)
+ this.temporalType = TemporalType.DATE;
+ this.setXmlTemporal(this.temporalType);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getXmlConvertibleMapping().getTemporalTextRange();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return EmptyIterable.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
new file mode 100644
index 0000000000..fdd0cbbe07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
+
+/**
+ * <code>orm.xml</code> transient mapping
+ */
+public class GenericOrmTransientMapping
+ extends AbstractOrmAttributeMapping<XmlTransient>
+ implements OrmTransientMapping
+{
+ public GenericOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient xmlMapping) {
+ super(parent, xmlMapping);
+ }
+
+ public String getKey() {
+ return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 90;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmTransientMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ resourceAttributes.getTransients().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ resourceAttributes.getTransients().remove(this.xmlAttributeMapping);
+ }
+
+ // ********** metamodel **********
+
+ @Override
+ public MetamodelField getMetamodelField() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
new file mode 100644
index 0000000000..372829c881
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
+
+public class GenericOrmUniqueConstraint
+ extends AbstractOrmReadOnlyUniqueConstraint
+ implements OrmUniqueConstraint
+{
+ protected Owner owner;
+ protected final XmlUniqueConstraint xmlUniqueConstraint;
+
+
+ public GenericOrmUniqueConstraint(XmlContextNode parent, Owner owner, XmlUniqueConstraint xmlUniqueConstraint) {
+ super(parent);
+ this.owner = owner;
+ this.xmlUniqueConstraint = xmlUniqueConstraint;
+ this.initializeColumnNames();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncColumnNames();
+ }
+
+
+ // ********** column names **********
+
+ public void addColumnName(String columnName) {
+ this.addColumnName(this.columnNames.size(), columnName);
+ }
+
+ public void addColumnName(int index, String columnName) {
+ this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
+ this.xmlUniqueConstraint.getColumnNames().add(index, columnName);
+ }
+
+ public void removeColumnName(String columnName) {
+ this.removeColumnName(this.columnNames.indexOf(columnName));
+ }
+
+ public void removeColumnName(int index) {
+ this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST);
+ this.xmlUniqueConstraint.getColumnNames().remove(index);
+ }
+
+ public void moveColumnName(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST);
+ this.xmlUniqueConstraint.getColumnNames().move(targetIndex, sourceIndex);
+ }
+
+ protected void initializeColumnNames() {
+ for (String xmlColumnName : this.xmlUniqueConstraint.getColumnNames()) {
+ this.columnNames.add(xmlColumnName);
+ }
+ }
+
+ @Override
+ protected Iterable<String> getResourceColumnNames() {
+ return this.xmlUniqueConstraint.getColumnNames();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.xmlUniqueConstraint.getValidationTextRange();
+ }
+
+
+ // ********** misc **********
+
+ public XmlUniqueConstraint getXmlUniqueConstraint() {
+ return this.xmlUniqueConstraint;
+ }
+
+ public void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint) {
+ for (String columnName : oldUniqueConstraint.getColumnNames()) {
+ this.addColumnName(columnName);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
new file mode 100644
index 0000000000..5cd6602686
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVersionMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
+
+
+public class GenericOrmVersionMapping
+ extends AbstractOrmVersionMapping<XmlVersion>
+{
+ public GenericOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion xmlMapping) {
+ super(parent, xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
new file mode 100644
index 0000000000..aee0a4591d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
+
+/**
+ * Virtual <code>orm.xml</code> association override
+ */
+public class GenericOrmVirtualAssociationOverride
+ extends AbstractOrmVirtualOverride<OrmAssociationOverrideContainer>
+ implements OrmVirtualAssociationOverride
+{
+ protected final OrmVirtualOverrideRelationship relationship;
+
+
+ public GenericOrmVirtualAssociationOverride(OrmAssociationOverrideContainer parent, String name) {
+ super(parent, name);
+ this.relationship = this.buildRelationship();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.relationship.update();
+ }
+
+ @Override
+ public OrmAssociationOverride convertToSpecified() {
+ return (OrmAssociationOverride) super.convertToSpecified();
+ }
+
+ public RelationshipMapping getMapping() {
+ return this.getContainer().getRelationshipMapping(this.name);
+ }
+
+
+ // ********** relationship **********
+
+ public OrmVirtualOverrideRelationship getRelationship() {
+ return this.relationship;
+ }
+
+ /**
+ * The relationship should be available (since its presence precipitated the
+ * creation of the virtual override).
+ */
+ protected OrmVirtualOverrideRelationship buildRelationship() {
+ return this.getContextNodeFactory().buildOrmVirtualOverrideRelationship(this);
+ }
+
+ public Relationship resolveOverriddenRelationship() {
+ return this.getContainer().resolveOverriddenRelationship(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
new file mode 100644
index 0000000000..d1327dba88
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
+
+/**
+ * Virtual <code>orm.xml</code> attribute override
+ */
+public class GenericOrmVirtualAttributeOverride
+ extends AbstractOrmVirtualOverride<OrmAttributeOverrideContainer>
+ implements OrmVirtualAttributeOverride, OrmVirtualColumn.Owner
+{
+ protected final OrmVirtualColumn column;
+
+
+ public GenericOrmVirtualAttributeOverride(OrmAttributeOverrideContainer parent, String name) {
+ super(parent, name);
+ this.column = this.buildColumn();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.column.update();
+ }
+
+ @Override
+ public OrmAttributeOverride convertToSpecified() {
+ return (OrmAttributeOverride) super.convertToSpecified();
+ }
+
+
+ // ********** column **********
+
+ public OrmVirtualColumn getColumn() {
+ return this.column;
+ }
+
+ /**
+ * The original column should be available (since the presence of its
+ * attribute is what precipitated the creation of the virtual override).
+ */
+ protected OrmVirtualColumn buildColumn() {
+ return this.getContextNodeFactory().buildOrmVirtualColumn(this, this);
+ }
+
+
+ // ********** column owner implementation **********
+
+ public TypeMapping getTypeMapping() {
+ return this.getContainer().getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ String overriddenColumnTable = this.getOverriddenColumnTable();
+ return (overriddenColumnTable != null) ? overriddenColumnTable : this.getContainer().getDefaultTableName();
+ }
+
+ protected String getOverriddenColumnTable() {
+ ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn();
+ // pretty sure this is the *specified* table...
+ return (overriddenColumn == null) ? null : overriddenColumn.getSpecifiedTable();
+ }
+
+ public String getDefaultColumnName() {
+ String overriddenColumnName = this.getOverriddenColumnName();
+ return (overriddenColumnName != null) ? overriddenColumnName : this.name;
+ }
+
+ protected String getOverriddenColumnName() {
+ ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn();
+ return (overriddenColumn == null) ? null : overriddenColumn.getName();
+ }
+
+ public Column resolveOverriddenColumn() {
+ return this.getContainer().resolveOverriddenColumn(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
new file mode 100644
index 0000000000..3cf168ed05
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn;
+
+/**
+ * <code>orm.xml</code> virtual column
+ */
+public class GenericOrmVirtualColumn
+ extends AbstractOrmVirtualBaseColumn<OrmVirtualColumn.Owner, Column>
+ implements OrmVirtualColumn
+{
+ protected Integer specifiedLength;
+ protected int defaultLength;
+
+ protected Integer specifiedPrecision;
+ protected int defaultPrecision;
+
+ protected Integer specifiedScale;
+ protected int defaultScale;
+
+
+ public GenericOrmVirtualColumn(JpaContextNode parent, OrmVirtualColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedLength(this.buildSpecifiedLength());
+ this.setDefaultLength(this.buildDefaultLength());
+
+ this.setSpecifiedPrecision(this.buildSpecifiedPrecision());
+ this.setDefaultPrecision(this.buildDefaultPrecision());
+
+ this.setSpecifiedScale(this.buildSpecifiedScale());
+ this.setDefaultScale(this.buildDefaultScale());
+ }
+
+
+ // ********** column **********
+
+ @Override
+ public Column getOverriddenColumn() {
+ return this.owner.resolveOverriddenColumn();
+ }
+
+
+ // ********** length **********
+
+ public int getLength() {
+ return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ protected void setSpecifiedLength(Integer length) {
+ Integer old = this.specifiedLength;
+ this.specifiedLength = length;
+ this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
+ }
+
+ protected Integer buildSpecifiedLength() {
+ return this.getOverriddenColumn().getSpecifiedLength();
+ }
+
+ public int getDefaultLength() {
+ return this.defaultLength;
+ }
+
+ protected void setDefaultLength(int length) {
+ int old = this.defaultLength;
+ this.defaultLength = length;
+ this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
+ }
+
+ protected int buildDefaultLength() {
+ return DEFAULT_LENGTH;
+ }
+
+
+ // ********** precision **********
+
+ public int getPrecision() {
+ return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision;
+ }
+
+ public Integer getSpecifiedPrecision() {
+ return this.specifiedPrecision;
+ }
+
+ protected void setSpecifiedPrecision(Integer precision) {
+ Integer old = this.specifiedPrecision;
+ this.specifiedPrecision = precision;
+ this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
+ }
+
+ protected Integer buildSpecifiedPrecision() {
+ return this.getOverriddenColumn().getSpecifiedPrecision();
+ }
+
+ public int getDefaultPrecision() {
+ return this.defaultPrecision;
+ }
+
+ protected void setDefaultPrecision(int precision) {
+ int old = this.defaultPrecision;
+ this.defaultPrecision = precision;
+ this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision);
+ }
+
+ protected int buildDefaultPrecision() {
+ return DEFAULT_PRECISION;
+ }
+
+
+ // ********** scale **********
+
+ public int getScale() {
+ return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale;
+ }
+
+ public Integer getSpecifiedScale() {
+ return this.specifiedScale;
+ }
+
+ protected void setSpecifiedScale(Integer scale) {
+ Integer old = this.specifiedScale;
+ this.specifiedScale = scale;
+ this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
+ }
+
+ protected Integer buildSpecifiedScale() {
+ return this.getOverriddenColumn().getSpecifiedScale();
+ }
+
+ public int getDefaultScale() {
+ return this.defaultScale;
+ }
+
+ protected void setDefaultScale(int scale) {
+ int old = this.defaultScale;
+ this.defaultScale = scale;
+ this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale);
+ }
+
+ protected int buildDefaultScale() {
+ return DEFAULT_SCALE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
new file mode 100644
index 0000000000..ceaef0bc75
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn;
+
+/**
+ * <code>orm.xml</code> virtual join column
+ */
+public class GenericOrmVirtualJoinColumn
+ extends AbstractOrmVirtualBaseColumn<ReadOnlyJoinColumn.Owner, JoinColumn>
+ implements OrmVirtualJoinColumn
+{
+ protected final JoinColumn overriddenColumn;
+
+ protected String specifiedReferencedColumnName;
+ protected String defaultReferencedColumnName;
+
+
+ public GenericOrmVirtualJoinColumn(JpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn overriddenColumn) {
+ super(parent, owner);
+ this.overriddenColumn = overriddenColumn;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName());
+ this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
+ }
+
+
+ // ********** column **********
+
+ @Override
+ public JoinColumn getOverriddenColumn() {
+ return this.overriddenColumn;
+ }
+
+ public boolean isDefault() {
+ return this.owner.joinColumnIsDefault(this);
+ }
+
+
+ // ********** referenced column name **********
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ protected void setSpecifiedReferencedColumnName(String name) {
+ String old = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = name;
+ this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedReferencedColumnName() {
+ return this.getOverriddenColumn().getSpecifiedReferencedColumnName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String name) {
+ String old = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = name;
+ this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultReferencedColumnName() {
+ return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected String buildDefaultName() {
+ return MappingTools.buildJoinColumnDefaultName(this, this.owner);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
new file mode 100644
index 0000000000..f8211eddf6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmVirtualOverrideJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmVirtualOverrideRelationship2_0;
+
+public class GenericOrmVirtualOverrideRelationship
+ extends AbstractOrmXmlContextNode
+ implements OrmVirtualOverrideRelationship2_0
+{
+ protected OrmVirtualRelationshipStrategy strategy;
+
+ protected final OrmVirtualJoinColumnRelationshipStrategy joinColumnStrategy;
+
+ // JPA 2.0
+ protected final OrmVirtualJoinTableRelationshipStrategy joinTableStrategy;
+
+
+ public GenericOrmVirtualOverrideRelationship(OrmVirtualAssociationOverride parent) {
+ super(parent);
+ this.joinColumnStrategy = this.buildJoinColumnStrategy();
+ this.joinTableStrategy = this.buildJoinTableStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.setStrategy(this.buildStrategy());
+ this.joinColumnStrategy.update();
+ this.joinTableStrategy.update();
+ }
+
+
+ // ********** strategy **********
+
+ public OrmVirtualRelationshipStrategy getStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(OrmVirtualRelationshipStrategy strategy) {
+ OrmVirtualRelationshipStrategy old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected OrmVirtualRelationshipStrategy buildStrategy() {
+ if (this.isJpa2_0Compatible()) {
+ if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) {
+ return this.joinColumnStrategy;
+ }
+ return this.joinTableStrategy;
+ }
+ return this.joinColumnStrategy;
+ }
+
+
+ // ********** join column strategy **********
+
+ public OrmVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return false;
+ }
+
+ protected OrmVirtualJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericOrmVirtualOverrideJoinColumnRelationshipStrategy(this);
+ }
+
+
+ // ********** join table strategy **********
+
+ public OrmVirtualJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
+
+ public boolean strategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public boolean mayHaveDefaultJoinTable() {
+ return this.isVirtual();
+ }
+
+ protected OrmVirtualJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return new GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0(this);
+ }
+
+
+ // ********** conversions **********
+
+ public void initializeOn(Relationship newRelationship) {
+ newRelationship.initializeFromJoinTableRelationship(this);
+ newRelationship.initializeFromJoinColumnRelationship(this);
+ }
+
+ public void initializeOnSpecified(OverrideRelationship specifiedRelationship) {
+ specifiedRelationship.initializeFromVirtualJoinColumnRelationship(this);
+ specifiedRelationship.initializeFromVirtualJoinTableRelationship(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmVirtualAssociationOverride getParent() {
+ return (OrmVirtualAssociationOverride) super.getParent();
+ }
+
+ public OrmVirtualAssociationOverride getAssociationOverride() {
+ return this.getParent();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getAssociationOverride().getContainer().getTypeMapping();
+ }
+
+ public Entity getEntity() {
+ TypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public boolean isVirtual() {
+ return true;
+ }
+
+ public RelationshipMapping getMapping() {
+ return this.getAssociationOverride().getMapping();
+ }
+
+ public Relationship resolveOverriddenRelationship() {
+ return this.getAssociationOverride().resolveOverriddenRelationship();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..d85905fd19
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualNamedColumn;
+
+/**
+ * <code>orm.xml</code> virtual primary key join column
+ */
+public class GenericOrmVirtualPrimaryKeyJoinColumn
+ extends AbstractOrmVirtualNamedColumn<ReadOnlyBaseJoinColumn.Owner, JavaPrimaryKeyJoinColumn>
+ implements OrmVirtualPrimaryKeyJoinColumn
+{
+ protected final JavaPrimaryKeyJoinColumn overriddenColumn;
+
+ protected String specifiedReferencedColumnName;
+ protected String defaultReferencedColumnName;
+
+
+ public GenericOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, ReadOnlyBaseJoinColumn.Owner owner, JavaPrimaryKeyJoinColumn overriddenColumn) {
+ super(parent, owner);
+ this.overriddenColumn = overriddenColumn;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName());
+ this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
+ }
+
+
+ // ********** column **********
+
+ @Override
+ public JavaPrimaryKeyJoinColumn getOverriddenColumn() {
+ return this.overriddenColumn;
+ }
+
+ public boolean isDefault() {
+ return this.owner.joinColumnIsDefault(this);
+ }
+
+
+ // ********** referenced column name **********
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ protected void setSpecifiedReferencedColumnName(String name) {
+ String old = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = name;
+ this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildSpecifiedReferencedColumnName() {
+ return this.getOverriddenColumn().getSpecifiedReferencedColumnName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String name) {
+ String old = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = name;
+ this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name);
+ }
+
+ protected String buildDefaultReferencedColumnName() {
+ return this.buildDefaultName();
+ }
+
+
+ // ********** misc **********
+
+ public String getTable() {
+ return this.owner.getDefaultTableName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
new file mode 100644
index 0000000000..6fe8eb779c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint;
+
+public class GenericOrmVirtualUniqueConstraint
+ extends AbstractOrmReadOnlyUniqueConstraint
+ implements OrmVirtualUniqueConstraint
+{
+ protected final UniqueConstraint overriddenUniqueConstraint;
+
+
+ public GenericOrmVirtualUniqueConstraint(XmlContextNode parent, UniqueConstraint overriddenUniqueConstraint) {
+ super(parent);
+ this.overriddenUniqueConstraint = overriddenUniqueConstraint;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.syncColumnNames();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ public UniqueConstraint getOverriddenUniqueConstraint() {
+ return this.overriddenUniqueConstraint;
+ }
+
+ @Override
+ protected Iterable<String> getResourceColumnNames() {
+ return this.overriddenUniqueConstraint.getColumnNames();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
new file mode 100644
index 0000000000..190e0fa341
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * JPA <code>orm.xml</code> file.
+ */
+public class GenericOrmXml
+ extends AbstractOrmXmlContextNode
+ implements OrmXml
+{
+ /**
+ * If the XML resource's content type changes, the mapping file
+ * ref will throw out its current mapping file.
+ */
+ protected final JpaXmlResource xmlResource; // never null
+
+ /**
+ * The resouce type will only change if the XML file's version changes
+ * (since, if the content type changes, we get garbage-collected).
+ */
+ protected JptResourceType resourceType;
+
+ /**
+ * The root element of the <code>orm.xml</code> file.
+ */
+ protected EntityMappings root;
+
+
+ public GenericOrmXml(MappingFileRef parent, JpaXmlResource xmlResource) {
+ super(parent);
+ this.checkXmlResource(xmlResource);
+ this.xmlResource = xmlResource;
+ this.resourceType = xmlResource.getResourceType();
+
+ XmlEntityMappings xmlEntityMappings = (XmlEntityMappings) xmlResource.getRootObject();
+ if (xmlEntityMappings != null) {
+ this.root = this.buildRoot(xmlEntityMappings);
+ }
+ }
+
+
+ // ********** synchronize/update **********
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml#synchronizeWithResourceModel()
+ */
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ XmlEntityMappings oldXmlEntityMappings = (this.root == null) ? null : this.root.getXmlEntityMappings();
+ XmlEntityMappings newXmlEntityMappings = (XmlEntityMappings) this.xmlResource.getRootObject();
+ JptResourceType newResourceType = this.xmlResource.getResourceType();
+
+ // If the old and new XML entity mappings are different instances,
+ // we scrap the old context entity mappings and rebuild.
+ // (This can happen when the resource model changes drastically,
+ // such as a CVS checkout or an edit reversion.)
+ if ((oldXmlEntityMappings != newXmlEntityMappings) ||
+ (newXmlEntityMappings == null) ||
+ this.valuesAreDifferent(this.resourceType, newResourceType)
+ ) {
+ if (this.root != null) {
+ this.unregisterRootStructureNode();
+ this.root.dispose();
+ this.setRoot(null);
+ }
+ }
+
+ this.resourceType = newResourceType;
+
+ if (newXmlEntityMappings != null) {
+ if (this.root == null) {
+ this.setRoot(this.buildRoot(newXmlEntityMappings));
+ } else {
+ // the context entity mappings already holds the XML entity mappings
+ this.root.synchronizeWithResourceModel();
+ }
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ if (this.root != null) {
+ this.root.update();
+ // this will happen redundantly - need to hold JpaFile?
+ this.registerRootStructureNode();
+ }
+ }
+
+
+ // ********** root **********
+
+ public EntityMappings getRoot() {
+ return this.root;
+ }
+
+ protected void setRoot(EntityMappings root) {
+ EntityMappings old = this.root;
+ this.root = root;
+ this.firePropertyChanged(ROOT_PROPERTY, old, root);
+ }
+
+ protected EntityMappings buildRoot(XmlEntityMappings xmlEntityMappings) {
+ return this.getContextNodeFactory().buildEntityMappings(this, xmlEntityMappings);
+ }
+
+
+ // ********** misc **********
+
+ protected void checkXmlResource(JpaXmlResource resource) {
+ if (resource == null) {
+ throw new NullPointerException();
+ }
+ if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE)) {
+ throw new IllegalArgumentException("Content type is not 'mapping file': " + resource); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public MappingFileRef getParent() {
+ return (MappingFileRef) super.getParent();
+ }
+
+ @Override
+ public IResource getResource() {
+ return this.xmlResource.getFile();
+ }
+
+ @Override
+ public JptResourceType getResourceType() {
+ return this.resourceType;
+ }
+
+ protected JpaFile getJpaFile() {
+ return this.getJpaFile(this.xmlResource.getFile());
+ }
+
+ public boolean isIn(IFolder folder) {
+ IResource member = folder.findMember(this.xmlResource.getFile().getName());
+ IFile file = this.xmlResource.getFile();
+ return Tools.valuesAreEqual(member, file);
+ }
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ // isn't actually displayed, so needs no details page
+ return null;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ if ((this.root != null) && this.root.containsOffset(textOffset)) {
+ return this.root.getStructureNode(textOffset);
+ }
+ return this;
+ }
+
+ // never actually selected
+ public TextRange getSelectionTextRange() {
+ return TextRange.Empty.instance();
+ }
+
+ public void dispose() {
+ if (this.root != null) {
+ JpaFile jpaFile = this.getJpaFile();
+ if (jpaFile != null) {
+ this.unregisterRootStructureNode();
+ }
+ this.root.dispose();
+ }
+ }
+
+ // TODO hold the JpaFile?
+ protected void registerRootStructureNode() {
+ this.getJpaFile().addRootStructureNode(this.xmlResource, this.root);
+ }
+
+ protected void unregisterRootStructureNode() {
+ this.getJpaFile().removeRootStructureNode(this.xmlResource, this.root);
+ }
+
+
+ // ********** MappingFile implementation **********
+
+ public JpaXmlResource getXmlResource() {
+ return this.xmlResource;
+ }
+
+ public OrmPersistentType getPersistentType(String name) {
+ return (this.root == null) ? null : this.root.getPersistentType(name);
+ }
+
+
+ // ********** PersistentTypeContainer implementation **********
+
+ /**
+ * All <code>orm.xml</code> mapping files must be able to generate a static metamodel
+ * because 1.0 <code>orm.xml</code> files can be referenced from 2.0
+ * <code>persistence.xml</code>
+ * files.
+ */
+ public Iterable<OrmPersistentType> getPersistentTypes() {
+ return (this.root != null) ? this.root.getPersistentTypes() : EmptyIterable.<OrmPersistentType>instance();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<DeleteEdit> createDeleteTypeEdits(IType type) {
+ return (this.root != null) ?
+ this.root.createDeleteTypeEdits(type) :
+ EmptyIterable.<DeleteEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return (this.root != null) ?
+ this.root.createRenameTypeEdits(originalType, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return (this.root != null) ?
+ this.root.createMoveTypeEdits(originalType, newPackage) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return (this.root != null) ?
+ this.root.createRenamePackageEdits(originalPackage, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ if (this.root != null) {
+ this.root.validate(messages, reporter);
+ }
+ }
+
+ public TextRange getValidationTextRange() {
+ return TextRange.Empty.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
new file mode 100644
index 0000000000..3a2dbdaa5a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.ArrayList;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEntityDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmMappedSuperclassDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+
+public class GenericOrmXmlDefinition
+ extends AbstractOrmXmlDefinition
+{
+ // singleton
+ private static final OrmXmlDefinition INSTANCE = new GenericOrmXmlDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static OrmXmlDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private GenericOrmXmlDefinition() {
+ super();
+ }
+
+ public JptResourceType getResourceType() {
+ return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
+ }
+
+ public EFactory getResourceNodeFactory() {
+ return OrmFactory.eINSTANCE;
+ }
+
+ @Override
+ protected OrmXmlContextNodeFactory buildContextNodeFactory() {
+ return new GenericOrmXmlContextNodeFactory();
+ }
+
+ @Override
+ protected void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS);
+ }
+
+ /**
+ * Order should not matter here; but we'll use the same order as for Java.
+ * @see GenericJpaPlatformProvider
+ */
+ protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] {
+ OrmEntityDefinition.instance(),
+ OrmEmbeddableDefinition.instance(),
+ OrmMappedSuperclassDefinition.instance()
+ };
+
+ @Override
+ protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ /**
+ * Order should not matter here; but we'll use the same order as for Java.
+ * @see GenericJpaPlatformProvider
+ */
+ protected static final OrmAttributeMappingDefinition[] ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] {
+ OrmTransientMappingDefinition.instance(),
+ OrmIdMappingDefinition.instance(),
+ OrmVersionMappingDefinition.instance(),
+ OrmBasicMappingDefinition.instance(),
+ OrmEmbeddedMappingDefinition.instance(),
+ OrmEmbeddedIdMappingDefinition.instance(),
+ OrmManyToManyMappingDefinition.instance(),
+ OrmManyToOneMappingDefinition.instance(),
+ OrmOneToManyMappingDefinition.instance(),
+ OrmOneToOneMappingDefinition.instance(),
+ NullOrmAttributeMappingDefinition.instance()
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java
new file mode 100644
index 0000000000..c0b5200071
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class NullOrmConverter
+ extends AbstractOrmConverter
+{
+ public NullOrmConverter(OrmAttributeMapping parent) {
+ super(parent);
+ }
+
+ public void initialize() {
+ // NOP
+ }
+
+ public Class<? extends Converter> getType() {
+ return null;
+ }
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return EmptyIterable.instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return EmptyIterable.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
new file mode 100644
index 0000000000..fb9c4fd2b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Used by
+ * {@link org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOneToManyRelationship#buildJoinColumnStrategy()}
+ * in a JPA 1.0 project.
+ */
+public class NullOrmJoinColumnRelationshipStrategy
+ extends AbstractOrmXmlContextNode
+ implements OrmJoinColumnRelationshipStrategy
+{
+ public NullOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** join columns **********
+
+ public ListIterator<OrmJoinColumn> joinColumns() {
+ return EmptyListIterator.<OrmJoinColumn>instance();
+ }
+
+ public int joinColumnsSize() {
+ return 0;
+ }
+
+
+ // ********** specified join columns **********
+
+ public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
+ return EmptyListIterator.<OrmJoinColumn>instance();
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return 0;
+ }
+
+ public boolean hasSpecifiedJoinColumns() {
+ return false;
+ }
+
+ public OrmJoinColumn getSpecifiedJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public OrmJoinColumn addSpecifiedJoinColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ public OrmJoinColumn addSpecifiedJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** default join column **********
+
+ public OrmJoinColumn getDefaultJoinColumn() {
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+
+ public String getColumnTableNotValidDescription() {
+ return null;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmJoinColumnRelationship getParent() {
+ return (OrmJoinColumnRelationship) super.getParent();
+ }
+
+ public OrmJoinColumnRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
+ // NOP
+ }
+
+ public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
+ // NOP
+ }
+
+ public void addStrategy() {
+ // NOP
+ }
+
+ public void removeStrategy() {
+ // NOP
+ }
+
+ public boolean isTargetForeignKey() {
+ return false;
+ }
+
+ public TypeMapping getRelationshipTarget() {
+ return null;
+ }
+
+ public String getTableName() {
+ return null;
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return true;
+ }
+
+ public Table resolveDbTable(String tableName) {
+ return null;
+ }
+
+ public TypeMapping getRelationshipSource() {
+ return this.getRelationshipMapping().getTypeMapping();
+ }
+
+ protected RelationshipMapping getRelationshipMapping() {
+ return this.getRelationship().getMapping();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
new file mode 100644
index 0000000000..1cba7cb9d6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
+
+/**
+ * This will be used in cases where Java-supported attribute mapping types
+ * are not supported by the particular version of the <code>orm.xml</code>
+ * file. For example, EclipseLink supports variable 1:1 mappings, but the
+ * generic <code>orm.xml</code> file does not.
+ */
+public class UnsupportedOrmAttributeMapping
+ extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
+{
+ public UnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) {
+ super(parent, xmlMapping);
+ }
+
+ public String getKey() {
+ //this ends up returning the java attribute mapping key
+ return this.xmlAttributeMapping.getMappingKey();
+ }
+
+ public int getXmlSequence() {
+ return -1;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmAttributeMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ public MetamodelField getMetamodelField() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
new file mode 100644
index 0000000000..96ae45722e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
@@ -0,0 +1,378 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>persistence.xml</code> file
+ * <br>
+ * <code>class</code> element
+ */
+public class GenericClassRef
+ extends AbstractPersistenceXmlContextNode
+ implements ClassRef
+{
+ /**
+ * This is <code>null</code> for a <em>virtual</em> class ref.
+ */
+ protected final XmlJavaClassRef xmlJavaClassRef;
+
+ protected String className;
+
+ /**
+ * The Java persistent type corresponding to the ref's class name;
+ * this can be <code>null</code> if the name is invalid.
+ */
+ protected JavaPersistentType javaPersistentType;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct a <em>specified</em> class ref; i.e. a class ref with
+ * an explicit entry in the <code>persistence.xml</code>.
+ */
+ public GenericClassRef(PersistenceUnit parent, XmlJavaClassRef xmlJavaClassRef) {
+ this(parent, xmlJavaClassRef, xmlJavaClassRef.getJavaClass());
+ }
+
+ /**
+ * Construct an <em>virtual</em> class ref; i.e. a class ref without
+ * an explicit entry in the <code>persistence.xml</code>.
+ */
+ public GenericClassRef(PersistenceUnit parent, String className) {
+ this(parent, null, className);
+ }
+
+ protected GenericClassRef(PersistenceUnit parent, XmlJavaClassRef xmlJavaClassRef, String className) {
+ super(parent);
+ this.xmlJavaClassRef = xmlJavaClassRef;
+ this.className = className;
+ // 'javaPersistentType' is resolved in the update
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ // virtual class refs are matched by name in the persistence unit
+ // so no need to sync it here (also, 'xmlJavaClassRef' is null...)
+ if (this.isNotVirtual()) {
+ // the name probably never changes...
+ this.setClassName_(this.xmlJavaClassRef.getJavaClass());
+ }
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.synchronizeWithResourceModel();
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJavaPersistentType();
+ }
+
+
+ // ********** class name **********
+
+ public String getClassName() {
+ return this.className;
+ }
+
+ public void setClassName(String className) {
+ if (this.isVirtual()) {
+ throw new IllegalStateException("The name of a virtual class ref cannot be changed: " + this); //$NON-NLS-1$
+ }
+ this.setClassName_(className);
+ this.xmlJavaClassRef.setJavaClass(className);
+ }
+
+ protected void setClassName_(String className) {
+ String old = this.className;
+ this.className = className;
+ this.firePropertyChanged(CLASS_NAME_PROPERTY, old, className);
+ }
+
+ /**
+ * Nested classes will be qualified with a '$'; the Java name is qualified
+ * with a '.'. Like <code>className</code>, this can be <code>null</code>.
+ */
+ protected String getJavaClassName() {
+ return StringTools.stringIsEmpty(this.className) ? null : this.className.replace('$', '.');
+ }
+
+
+ // ********** java persistent type **********
+
+ public JavaPersistentType getJavaPersistentType() {
+ return this.javaPersistentType;
+ }
+
+ protected void setJavaPersistentType(JavaPersistentType javaPersistentType) {
+ JavaPersistentType old = this.javaPersistentType;
+ this.javaPersistentType = javaPersistentType;
+ this.firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, old, javaPersistentType);
+ }
+
+ protected void updateJavaPersistentType() {
+ JavaResourcePersistentType resourceType = this.resolveJavaResourcePersistentType();
+ if (resourceType == null) {
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.dispose();
+ this.setJavaPersistentType(null);
+ }
+ } else {
+ if (this.javaPersistentType == null) {
+ this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
+ } else {
+ if (this.javaPersistentType.getResourcePersistentType() == resourceType) {
+ this.javaPersistentType.update();
+ } else {
+ this.javaPersistentType.dispose();
+ this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
+ }
+ }
+ }
+ }
+
+ protected JavaResourcePersistentType resolveJavaResourcePersistentType() {
+ String javaClassName = this.getJavaClassName();
+ return (javaClassName == null) ? null : this.getJpaProject().getJavaResourcePersistentType(javaClassName);
+ }
+
+ protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
+ return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public PersistenceUnit getParent() {
+ return (PersistenceUnit) super.getParent();
+ }
+
+ public XmlJavaClassRef getXmlClassRef() {
+ return this.xmlJavaClassRef;
+ }
+
+ protected boolean isFor(IType type) {
+ return this.isFor(type.getFullyQualifiedName('.'));
+ }
+
+ public boolean isFor(String typeName) {
+ return Tools.valuesAreEqual(typeName, this.getJavaClassName());
+ }
+
+ protected boolean isInPackage(IPackageFragment packageFragment) {
+ return Tools.valuesAreEqual(this.getPackageName(), packageFragment.getElementName());
+ }
+
+ protected String getPackageName() {
+ int lastPeriod = this.className.lastIndexOf('.');
+ return (lastPeriod == -1) ? null : this.className.substring(0, lastPeriod);
+ }
+
+ public boolean isVirtual() {
+ return this.xmlJavaClassRef == null;
+ }
+
+ protected boolean isNotVirtual() {
+ return ! this.isVirtual();
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return this.isNotVirtual() && this.xmlJavaClassRef.containsOffset(textOffset);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getJavaClassName());
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return PersistenceStructureNodes.CLASS_REF_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ return this;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.isVirtual() ? null : this.xmlJavaClassRef.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.dispose();
+ }
+ }
+
+
+ // ********** PersistentType.Owner implementation **********
+
+ public AccessType getOverridePersistentTypeAccess() {
+ // no access type at this level overrides any local access type specification
+ return null;
+ }
+
+ public AccessType getDefaultPersistentTypeAccess() {
+ return this.getPersistenceUnit().getDefaultAccess();
+ }
+
+
+ //*********** refactoring ***********
+
+ public Iterable<DeleteEdit> createDeleteTypeEdits(final IType type) {
+ if (this.isVirtual()) {
+ throw new IllegalStateException();
+ }
+ return this.isFor(type) ?
+ new SingleElementIterable<DeleteEdit>(this.createDeleteEdit()) :
+ EmptyIterable.<DeleteEdit>instance();
+ }
+
+ protected DeleteEdit createDeleteEdit() {
+ return this.xmlJavaClassRef.createDeleteEdit();
+ }
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ if (this.isVirtual()) {
+ throw new IllegalStateException();
+ }
+ return this.isFor(originalType) ?
+ new SingleElementIterable<ReplaceEdit>(this.createReplaceEdit(originalType, newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createReplaceEdit(IType originalType, String newName) {
+ return this.xmlJavaClassRef.createRenameEdit(originalType, newName);
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ if (this.isVirtual()) {
+ throw new IllegalStateException();
+ }
+ return this.isFor(originalType) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ if (this.isVirtual()) {
+ throw new IllegalStateException();
+ }
+ return this.isInPackage(originalPackage) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenamePackageEdit(String newName) {
+ return this.xmlJavaClassRef.createRenamePackageEdit(newName);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ if (StringTools.stringIsEmpty(this.className)) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_CLASS,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ return;
+ }
+
+ if (this.javaPersistentType == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_CLASS,
+ new String[] {this.getJavaClassName()},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ return;
+ }
+
+ // 190062 validate Java class only if this is the only reference to it
+ // i.e. the persistence.xml ref is the only ref - none of the mapping
+ // files reference the same class
+ boolean validateJavaPersistentType = true;
+ for (Iterator<MappingFileRef> stream = this.getPersistenceUnit().mappingFileRefsContaining(this.getJavaClassName()); stream.hasNext(); ) {
+ validateJavaPersistentType = false;
+ MappingFileRef mappingFileRef = stream.next();
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.LOW_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_UNIT_REDUNDANT_CLASS,
+ new String[] {this.getJavaClassName(), mappingFileRef.getFileName()},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+
+ if (validateJavaPersistentType) {
+ this.validateJavaPersistentType(messages, reporter);
+ }
+ }
+
+ protected void validateJavaPersistentType(List<IMessage> messages, IReporter reporter) {
+ try {
+ this.javaPersistentType.validate(messages, reporter);
+ } catch (Throwable t) {
+ JptJpaCorePlugin.log(t);
+ }
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.isVirtual() ? null : this.xmlJavaClassRef.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java
new file mode 100644
index 0000000000..eec257e95c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractJarFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
+
+/**
+ * Context JAR file reference (from the persistence unit)
+ */
+public class GenericJarFileRef
+ extends AbstractJarFileRef
+{
+ public GenericJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
+ super(parent, xmlJarFileRef);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
new file mode 100644
index 0000000000..45e923a079
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * <code>persistence.xml</code> file
+ * <br>
+ * <code>mapping-file</code> element
+ */
+public class GenericMappingFileRef
+ extends AbstractMappingFileRef
+{
+ protected final XmlMappingFileRef xmlMappingFileRef;
+
+
+ public GenericMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
+ super(parent, xmlMappingFileRef.getFileName());
+ this.xmlMappingFileRef = xmlMappingFileRef;
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ // set the file name *before* calling super
+ this.setFileName_(this.xmlMappingFileRef.getFileName());
+ super.synchronizeWithResourceModel();
+ }
+
+
+ // ********** file name **********
+
+ public void setFileName(String fileName) {
+ this.setFileName_(fileName);
+ this.xmlMappingFileRef.setFileName(fileName);
+ }
+
+ protected void setFileName_(String xmlFileName) {
+ String old = this.fileName;
+ this.fileName = xmlFileName;
+ if (this.firePropertyChanged(FILE_NAME_PROPERTY, old, xmlFileName)) {
+ if (this.mappingFile != null) {
+ this.mappingFile.dispose();
+ this.setMappingFile(null);
+ }
+ }
+ }
+
+
+ // ********** misc **********
+
+ public XmlMappingFileRef getXmlMappingFileRef() {
+ return this.xmlMappingFileRef;
+ }
+
+ public boolean isImplied() {
+ return false;
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return this.xmlMappingFileRef.containsOffset(textOffset);
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public TextRange getSelectionTextRange() {
+ return this.xmlMappingFileRef.getSelectionTextRange();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.xmlMappingFileRef.getValidationTextRange();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file) {
+ return this.isFor(file) ?
+ new SingleElementIterable<DeleteEdit>(this.createDeleteEdit()) :
+ EmptyIterable.<DeleteEdit>instance();
+ }
+
+ protected DeleteEdit createDeleteEdit() {
+ return this.xmlMappingFileRef.createDeleteEdit();
+ }
+
+ @Override
+ protected ReplaceEdit createRenameEdit(IFile originalFile, String newName) {
+ return this.xmlMappingFileRef.createRenameEdit(originalFile, newName);
+ }
+
+ public Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName) {
+ return this.isIn(originalFolder) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenameFolderEdit(originalFolder, newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenameFolderEdit(IFolder originalFolder, String newName) {
+ return this.xmlMappingFileRef.createRenameFolderEdit(originalFolder, newName);
+ }
+
+ @Override
+ protected ReplaceEdit createMoveEdit(IFile originalFile, IPath runtineDestination) {
+ return this.xmlMappingFileRef.createMoveEdit(originalFile, runtineDestination);
+ }
+
+ public Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination) {
+ return this.isIn(originalFolder) ?
+ new SingleElementIterable<ReplaceEdit>(this.createMoveEdit(originalFolder, runtimeDestination)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createMoveEdit(IFolder originalFolder, IPath runtimeDestination) {
+ IProject project = originalFolder.getProject();
+ IPath fullPath = originalFolder.getFullPath();
+ IPath originalLocation = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath);
+ return this.createMoveEdit(originalLocation, runtimeDestination);
+ }
+
+ protected ReplaceEdit createMoveEdit(IPath originalLocation, IPath runtineDestination) {
+ return this.xmlMappingFileRef.createMoveEdit(originalLocation, runtineDestination);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
new file mode 100644
index 0000000000..446be61a1a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.Persistence2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * <code>persistence.xml</code> file
+ * <br>
+ * <code>persistence</code> element
+ */
+public class GenericPersistence
+ extends AbstractPersistenceXmlContextNode
+ implements Persistence2_0
+{
+ protected final XmlPersistence xmlPersistence;
+
+ // The implementation here is a single persistence unit, although the API
+ // is for a list. We want to support multiple persistence units someday....
+ protected PersistenceUnit persistenceUnit;
+
+
+ public GenericPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) {
+ super(parent);
+ this.xmlPersistence = xmlPersistence;
+ this.initializePersistenceUnits();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.syncPersistenceUnits();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNodes(this.getPersistenceUnits());
+ }
+
+
+ // ********** persistence units **********
+
+ public ListIterator<PersistenceUnit> persistenceUnits() {
+ return this.getPersistenceUnits().iterator();
+ }
+
+ protected ListIterable<PersistenceUnit> getPersistenceUnits() {
+ return (this.persistenceUnit == null) ? EmptyListIterable.<PersistenceUnit>instance() : this.getPersistenceUnits_();
+ }
+
+ protected ListIterable<PersistenceUnit> getPersistenceUnits_() {
+ return new SingleElementListIterable<PersistenceUnit>(this.persistenceUnit);
+ }
+
+ public int persistenceUnitsSize() {
+ return (this.persistenceUnit == null) ? 0 : 1;
+ }
+
+ public PersistenceUnit addPersistenceUnit() {
+ return this.addPersistenceUnit(this.persistenceUnitsSize());
+ }
+
+ public PersistenceUnit addPersistenceUnit(int index) {
+ if ((index > 0) || (this.persistenceUnit != null)) {
+ throw new IllegalStateException("This implementation does not support multiple persistence units."); //$NON-NLS-1$
+ }
+ XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ this.persistenceUnit = this.buildPersistenceUnit(xmlPersistenceUnit);
+ this.xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
+ this.fireItemAdded(PERSISTENCE_UNITS_LIST, index, this.persistenceUnit);
+ return this.persistenceUnit;
+ }
+
+ public void removePersistenceUnit(PersistenceUnit pu) {
+ if (pu != this.persistenceUnit) {
+ throw new IllegalArgumentException("Invalid persistence unit: " + pu); //$NON-NLS-1$
+ }
+ this.removePersistenceUnit(0);
+ }
+
+ public void removePersistenceUnit(int index) {
+ if ((index > 0) || (this.persistenceUnit == null)) {
+ throw new IndexOutOfBoundsException("index: " + index); //$NON-NLS-1$
+ }
+ PersistenceUnit old = this.persistenceUnit;
+ this.persistenceUnit.dispose();
+ this.persistenceUnit = null;
+ this.xmlPersistence.getPersistenceUnits().remove(index);
+ this.fireItemRemoved(PERSISTENCE_UNITS_LIST, index, old);
+ }
+
+ // only building one here, until we support multiple persistence units...
+ protected void initializePersistenceUnits() {
+ XmlPersistenceUnit xmlPersistenceUnit = this.getXmlPersistenceUnit();
+ if (xmlPersistenceUnit != null) {
+ this.persistenceUnit = this.buildPersistenceUnit(xmlPersistenceUnit);
+ }
+ }
+
+ protected void syncPersistenceUnits() {
+ XmlPersistenceUnit xmlPersistenceUnit = this.getXmlPersistenceUnit();
+ if (this.persistenceUnit == null) {
+ if (xmlPersistenceUnit != null) {
+ this.addPersistenceUnit_(this.buildPersistenceUnit(xmlPersistenceUnit));
+ }
+ } else {
+ if (xmlPersistenceUnit == null) {
+ this.removePersistenceUnit_();
+ } else {
+ if (this.persistenceUnit.getXmlPersistenceUnit() == xmlPersistenceUnit) {
+ this.persistenceUnit.synchronizeWithResourceModel();
+ } else {
+ this.removePersistenceUnit_();
+ this.addPersistenceUnit_(this.buildPersistenceUnit(xmlPersistenceUnit));
+ }
+ }
+ }
+ }
+
+ protected XmlPersistenceUnit getXmlPersistenceUnit() {
+ List<XmlPersistenceUnit> xmlPersistenceUnits = this.xmlPersistence.getPersistenceUnits();
+ return xmlPersistenceUnits.isEmpty() ? null : xmlPersistenceUnits.get(0);
+ }
+
+ protected void addPersistenceUnit_(PersistenceUnit pu) {
+ this.persistenceUnit = pu;
+ this.fireItemAdded(PERSISTENCE_UNITS_LIST, 0, pu);
+ }
+
+ protected void removePersistenceUnit_() {
+ PersistenceUnit old = this.persistenceUnit;
+ this.persistenceUnit = null;
+ old.dispose();
+ this.fireItemRemoved(PERSISTENCE_UNITS_LIST, 0, old);
+ }
+
+ protected PersistenceUnit buildPersistenceUnit(XmlPersistenceUnit xmlPersistenceUnit) {
+ return this.getContextNodeFactory().buildPersistenceUnit(this, xmlPersistenceUnit);
+ }
+
+
+ // ********** metamodel **********
+
+ public void initializeMetamodel() {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ ((PersistenceUnit2_0) pu).initializeMetamodel();
+ }
+ }
+
+ public void synchronizeMetamodel() {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ ((PersistenceUnit2_0) pu).synchronizeMetamodel();
+ }
+ }
+
+ public void disposeMetamodel() {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ ((PersistenceUnit2_0) pu).disposeMetamodel();
+ }
+ }
+
+
+ // ********** Persistence implementation **********
+
+ public XmlPersistence getXmlPersistence() {
+ return this.xmlPersistence;
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return (this.xmlPersistence == null) ? false : this.xmlPersistence.containsOffset(textOffset);
+ }
+
+
+ // ********** XmlContextNode implementation **********
+
+ @Override
+ public PersistenceXml getParent() {
+ return (PersistenceXml) super.getParent();
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.xmlPersistence.getValidationTextRange();
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return PersistenceStructureNodes.PERSISTENCE_ID;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ if (pu.containsOffset(textOffset)) {
+ return pu.getStructureNode(textOffset);
+ }
+ }
+ return this;
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.xmlPersistence.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ pu.dispose();
+ }
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateVersion(messages);
+ this.checkForMultiplePersistenceUnits(messages);
+ this.validatePersistenceUnit(messages, reporter);
+ }
+
+ protected void validateVersion(List<IMessage> messages) {
+ if (! this.getLatestDocumentVersion().equals(this.xmlPersistence.getVersion())) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.LOW_SEVERITY,
+ JpaValidationMessages.XML_VERSION_NOT_LATEST,
+ this,
+ this.xmlPersistence.getVersionTextRange()));
+ }
+ }
+
+ protected String getLatestDocumentVersion() {
+ return this.getJpaPlatform().getMostRecentSupportedResourceType(
+ JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
+ }
+
+ /**
+ * extraneous persistence units can be
+ * accessed through the XmlPersistence resource object
+ */
+ protected void checkForMultiplePersistenceUnits(List<IMessage> messages) {
+ if (this.xmlPersistence.getPersistenceUnits().size() > 1) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ }
+
+ protected void validatePersistenceUnit(List<IMessage> messages, IReporter reporter) {
+ if (this.persistenceUnit == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ return;
+ }
+ this.persistenceUnit.validate(messages, reporter);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java
new file mode 100644
index 0000000000..d7adff868b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+
+/**
+ * generic <code>persistence-unit</code>
+ */
+public class GenericPersistenceUnit
+ extends AbstractPersistenceUnit
+{
+ public GenericPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
+ super(parent, xmlPersistenceUnit);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
new file mode 100644
index 0000000000..4c37d3d4b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Straightforward implementation of the persistence unit property.
+ * Notifies the persistence unit of any changes to the property.
+ */
+public class GenericPersistenceUnitProperty
+ extends AbstractPersistenceXmlContextNode
+ implements PersistenceUnit.Property
+{
+ protected final XmlProperty xmlProperty;
+ protected String name;
+ protected String value;
+
+
+ public GenericPersistenceUnitProperty(PersistenceUnit parent, XmlProperty xmlProperty) {
+ super(parent);
+ this.xmlProperty = xmlProperty;
+ this.name = xmlProperty.getName();
+ this.value = xmlProperty.getValue();
+ }
+
+ @Override
+ public PersistenceUnit getParent() {
+ return (PersistenceUnit) super.getParent();
+ }
+
+ public XmlProperty getXmlProperty() {
+ return this.xmlProperty;
+ }
+
+
+ // ********** synchronize **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setName_(this.xmlProperty.getName());
+ this.setValue_(this.xmlProperty.getValue());
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.setName_(name);
+ this.xmlProperty.setName(name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ if (this.firePropertyChanged(NAME_PROPERTY, old, name)) {
+ this.getParent().propertyNameChanged(old, name, this.value);
+ }
+ }
+
+
+ // ********** value **********
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.setValue_(value);
+ this.xmlProperty.setValue(value);
+ }
+
+ protected void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ if (this.firePropertyChanged(VALUE_PROPERTY, old, value)) {
+ this.getParent().propertyValueChanged(this.name, value);
+ }
+ }
+
+ protected String getValuePackageName() {
+ return (this.value == null) ? null : this.getValuePackageName_();
+ }
+
+ /**
+ * pre-condition: {@link #value} is not <code>null</code>
+ */
+ protected String getValuePackageName_() {
+ int lastPeriod = this.value.lastIndexOf('.');
+ return (lastPeriod == -1) ? null : this.value.substring(0, lastPeriod);
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.xmlProperty.getValidationTextRange();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return Tools.valuesAreEqual(this.value, originalType.getFullyQualifiedName('.')) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenameTypeEdit(originalType, newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenameTypeEdit(IType originalType, String newName) {
+ return this.xmlProperty.createRenameTypeEdit(originalType, newName);
+ }
+
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return Tools.valuesAreEqual(this.value, originalType.getFullyQualifiedName('.')) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return Tools.valuesAreEqual(this.getValuePackageName(), originalPackage.getElementName()) ?
+ new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ protected ReplaceEdit createRenamePackageEdit(String newName) {
+ return this.xmlProperty.createRenamePackageEdit(newName);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ sb.append(" = "); //$NON-NLS-1$
+ sb.append(this.value);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
new file mode 100644
index 0000000000..fda1d6c9bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.Persistence2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * context model <code>persistence.xml</code> file
+ */
+public class GenericPersistenceXml
+ extends AbstractPersistenceXmlContextNode
+ implements PersistenceXml2_0
+{
+ /**
+ * If the XML resource's content type changes, the root context
+ * node will throw out its current persistence XML.
+ */
+ protected final JpaXmlResource xmlResource; // never null
+
+ /**
+ * The resource type will only change if the XML file's version changes
+ * (since, if the content type changes, we get garbage-collected).
+ */
+ protected JptResourceType resourceType;
+
+ /**
+ * The root element of the <code>persistence.xml</code> file.
+ */
+ protected Persistence persistence;
+
+
+ public GenericPersistenceXml(JpaRootContextNode parent, JpaXmlResource xmlResource) {
+ super(parent);
+ this.checkXmlResource(xmlResource);
+ this.xmlResource = xmlResource;
+ this.resourceType = xmlResource.getResourceType();
+
+ XmlPersistence xmlPersistence = (XmlPersistence) xmlResource.getRootObject();
+ if (xmlPersistence != null) {
+ this.persistence = this.buildPersistence(xmlPersistence);
+ }
+ }
+
+
+ // ********** synchronize/update **********
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml#synchronizeWithResourceModel()
+ */
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ XmlPersistence oldXmlPersistence = (this.persistence == null) ? null : this.persistence.getXmlPersistence();
+ XmlPersistence newXmlPersistence = (XmlPersistence) this.xmlResource.getRootObject();
+ JptResourceType newResourceType = this.xmlResource.getResourceType();
+
+ // If the old and new XML persistences are different instances,
+ // we scrap the old context persistence and rebuild.
+ // (This can happen when the resource model changes drastically,
+ // such as a CVS checkout or an edit reversion.)
+ if ((oldXmlPersistence != newXmlPersistence) ||
+ (newXmlPersistence == null) ||
+ this.valuesAreDifferent(this.resourceType, newResourceType)
+ ) {
+ if (this.persistence != null) {
+ this.unregisterRootStructureNode();
+ this.persistence.dispose();
+ this.setPersistence(null);
+ }
+ }
+
+ this.resourceType = newResourceType;
+
+ if (newXmlPersistence != null) {
+ if (this.persistence == null) {
+ this.setPersistence(this.buildPersistence(newXmlPersistence));
+ } else {
+ // the context persistence already holds the XML persistence
+ this.persistence.synchronizeWithResourceModel();
+ }
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ if (this.persistence != null) {
+ this.persistence.update();
+ // this will happen redundantly - need to hold JpaFile?
+ this.registerRootStructureNode();
+ }
+ }
+
+
+ // ********** persistence **********
+
+ public Persistence getPersistence() {
+ return this.persistence;
+ }
+
+ protected void setPersistence(Persistence persistence) {
+ Persistence old = this.persistence;
+ this.persistence = persistence;
+ this.firePropertyChanged(PERSISTENCE_PROPERTY, old, persistence);
+ }
+
+ protected Persistence buildPersistence(XmlPersistence xmlPersistence) {
+ return this.getContextNodeFactory().buildPersistence(this, xmlPersistence);
+ }
+
+
+ // ********** misc **********
+
+ protected void checkXmlResource(JpaXmlResource resource) {
+ if (resource == null) {
+ throw new NullPointerException();
+ }
+ if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
+ throw new IllegalArgumentException("Content type is not 'persistence': " + resource); //$NON-NLS-1$
+ }
+ }
+
+ public JpaXmlResource getXmlResource() {
+ return this.xmlResource;
+ }
+
+ @Override
+ public IResource getResource() {
+ return this.xmlResource.getFile();
+ }
+
+ @Override
+ public JptResourceType getResourceType() {
+ return this.xmlResource.getResourceType();
+ }
+
+ protected JpaFile getJpaFile() {
+ return this.getJpaFile(this.xmlResource.getFile());
+ }
+
+
+ // ********** metamodel **********
+
+ public void initializeMetamodel() {
+ if (this.persistence != null) {
+ ((Persistence2_0) this.persistence).initializeMetamodel();
+ }
+ }
+
+ public void synchronizeMetamodel() {
+ if (this.persistence != null) {
+ ((Persistence2_0) this.persistence).synchronizeMetamodel();
+ }
+ }
+
+ public void disposeMetamodel() {
+ if (this.persistence != null) {
+ ((Persistence2_0) this.persistence).disposeMetamodel();
+ }
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ // isn't actually displayed, so needs no details page
+ return null;
+ }
+
+ public JpaStructureNode getStructureNode(int textOffset) {
+ if (this.persistence.containsOffset(textOffset)) {
+ return this.persistence.getStructureNode(textOffset);
+ }
+ return this;
+ }
+
+ // never actually selected
+ public TextRange getSelectionTextRange() {
+ return TextRange.Empty.instance();
+ }
+
+ public void dispose() {
+ if (this.persistence != null) {
+ JpaFile jpaFile = this.getJpaFile();
+ if (jpaFile != null) {
+ this.unregisterRootStructureNode();
+ }
+ this.persistence.dispose();
+ }
+ }
+
+ // TODO hold the JpaFile?
+ protected void registerRootStructureNode() {
+ this.getJpaFile().addRootStructureNode(this.xmlResource, this.persistence);
+ }
+
+ protected void unregisterRootStructureNode() {
+ this.getJpaFile().removeRootStructureNode(this.xmlResource, this.persistence);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+
+ if (this.persistence == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT,
+ this
+ )
+ );
+ return;
+ }
+
+ this.persistence.validate(messages, reporter);
+ }
+
+ // never actually selected
+ public TextRange getValidationTextRange() {
+ return TextRange.Empty.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
new file mode 100644
index 0000000000..57d9a22b6e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.GenericPersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
+
+public class GenericPersistenceXmlDefinition
+ extends AbstractPersistenceXmlDefinition
+{
+ // singleton
+ private static final PersistenceXmlDefinition INSTANCE = new GenericPersistenceXmlDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static PersistenceXmlDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private GenericPersistenceXmlDefinition() {
+ super();
+ }
+
+ public JptResourceType getResourceType() {
+ return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
+ }
+
+ public EFactory getResourceNodeFactory() {
+ return PersistenceFactory.eINSTANCE;
+ }
+
+ @Override
+ protected PersistenceXmlContextNodeFactory buildContextNodeFactory() {
+ return new GenericPersistenceXmlContextNodeFactory();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
new file mode 100644
index 0000000000..dca36559d9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * Used by the persistence unit for the
+ * <code>META-INF/orm.xml</code> file when it is not explicitly listed
+ * in the <code>persistence.xml</code> file.
+ */
+public class ImpliedMappingFileRef
+ extends AbstractMappingFileRef
+{
+
+ // ********** construction/initialization **********
+
+ public ImpliedMappingFileRef(PersistenceUnit parent, String fileName) {
+ super(parent, fileName);
+ }
+
+
+ // ********** MappingFileRef implementation **********
+
+ public XmlMappingFileRef getXmlMappingFileRef() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isImplied() {
+ return true;
+ }
+
+ public void setFileName(String fileName) {
+ throw new UnsupportedOperationException("Cannot set an implied mapping file ref's 'fileName': " + fileName); //$NON-NLS-1$
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return false;
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public TextRange getSelectionTextRange() {
+ return null;
+ }
+
+
+ // ********** XmlContextNode implementation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getPersistenceUnit().getValidationTextRange();
+ }
+
+
+ // ********** refactoring **********
+
+ public Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file) {
+ throw new IllegalStateException("This reference cannot be deleted - it is implied"); //$NON-NLS-1$
+ }
+
+ public Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName) {
+ throw new IllegalStateException("This reference cannot be moved - it is implied"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected ReplaceEdit createRenameEdit(IFile originalFile, String newName) {
+ return this.createReplaceEdit(this.fileName.substring(0, this.fileName.lastIndexOf('/') + 1) + newName);
+ }
+
+ @Override
+ protected ReplaceEdit createMoveEdit(IFile originalFile, IPath runtimeDestination) {
+ return this.createReplaceEdit(runtimeDestination.append(originalFile.getName()).toString());
+ }
+
+ protected ReplaceEdit createReplaceEdit(String newMappingFileName) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(StringTools.CR);
+ sb.append("\t\t<mapping-file>"); //$NON-NLS-1$
+ sb.append(newMappingFileName);
+ sb.append("</mapping-file>"); //$NON-NLS-1$
+ int offset = this.getPersistenceUnit().findInsertLocationForMappingFileRef();
+ return new ReplaceEdit(offset, 0, sb.toString());
+ }
+
+ public Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination) {
+ throw new IllegalStateException("This reference cannot be moved - it is implied"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
new file mode 100644
index 0000000000..84286b57c7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.AssociationOverride
+ */
+public final class BinaryAssociationOverride1_0Annotation
+ extends BinaryAssociationOverrideAnnotation
+{
+
+ public BinaryAssociationOverride1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
new file mode 100644
index 0000000000..7dbc81b9bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+
+/**
+ * javax.persistence.AssociationOverrides
+ */
+public final class BinaryAssociationOverrides1_0Annotation
+ extends BinaryAssociationOverridesAnnotation
+{
+
+ public BinaryAssociationOverrides1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ @Override
+ protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) {
+ return new BinaryAssociationOverride1_0Annotation(this, (IAnnotation) jdtAssociationOverride);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
new file mode 100644
index 0000000000..f1bd6aac02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+
+/**
+ * javax.persistence.NamedQueries
+ */
+public final class BinaryNamedQueries1_0Annotation
+ extends BinaryNamedQueriesAnnotation
+{
+ public BinaryNamedQueries1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ @Override
+ protected NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery) {
+ return new BinaryNamedQuery1_0Annotation(this, (IAnnotation) jdtQuery);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
new file mode 100644
index 0000000000..3b315898d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.NamedQuery
+ */
+public final class BinaryNamedQuery1_0Annotation
+ extends BinaryNamedQueryAnnotation
+{
+
+ public BinaryNamedQuery1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
new file mode 100644
index 0000000000..0415109916
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.SequenceGenerator
+ */
+public final class BinarySequenceGenerator1_0Annotation
+ extends BinarySequenceGeneratorAnnotation
+{
+
+ public BinarySequenceGenerator1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
new file mode 100644
index 0000000000..529a51a775
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <code>javax.persistence.AssociationOverride</code>
+ */
+public final class SourceAssociationOverride1_0Annotation
+ extends SourceAssociationOverrideAnnotation
+{
+ public SourceAssociationOverride1_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ }
+
+ // ********** static methods **********
+
+ public static SourceAssociationOverride1_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) {
+ return new SourceAssociationOverride1_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static SourceAssociationOverride1_0Annotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
+ return new SourceAssociationOverride1_0Annotation(parent, member, idaa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
new file mode 100644
index 0000000000..f4c8ed5d23
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
+
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+
+/**
+ * <code>javax.persistence.AssociationOverrides</code>
+ */
+public final class SourceAssociationOverrides1_0Annotation
+ extends SourceAssociationOverridesAnnotation
+{
+ public SourceAssociationOverrides1_0Annotation(JavaResourceNode parent, Member member) {
+ super(parent, member);
+ }
+
+ @Override
+ protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceAssociationOverride1_0Annotation.buildNestedAssociationOverride(this.parent, this.annotatedElement, index, this.daa);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
new file mode 100644
index 0000000000..fa1baaabf2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
+
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <code>javax.persistence.NamedQuery</code>
+ */
+public final class SourceNamedQuery1_0Annotation
+ extends SourceNamedQueryAnnotation
+{
+ public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type) {
+ super(parent, type);
+ }
+
+ public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
new file mode 100644
index 0000000000..898364a8d5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
+
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.SequenceGenerator
+ */
+public final class SourceSequenceGenerator1_0Annotation
+ extends SourceSequenceGeneratorAnnotation
+{
+
+ public SourceSequenceGenerator1_0Annotation(JavaResourceNode parent, Member member) {
+ super(parent, member);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
new file mode 100644
index 0000000000..84009a4467
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2;
+
+import java.util.ArrayList;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Access2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.AssociationOverride2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.AssociationOverrides2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Cacheable2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.CollectionTable2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.ElementCollection2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyClass2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyColumn2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyEnumerated2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumn2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumns2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyTemporal2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapsId2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NamedQueries2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NamedQuery2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.SequenceGenerator2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.BasicAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.ColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EntityAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.EnumeratedAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.GeneratedValueAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.IdAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.IdClassAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.InheritanceAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnsAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.JoinTableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.LobAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToManyAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToOneAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.MapKeyAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.OneToManyAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.OneToOneAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.OrderByAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TableAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+
+/**
+ * Support for existing JPA 1.0 annotations, new JPA 2.0 annotations, and
+ * augmented support for annotations changed from 1.0 to 2.0
+ */
+public class Generic2_0JpaAnnotationDefinitionProvider
+ extends AbstractJpaAnnotationDefinitionProvider
+{
+ // singleton
+ private static final JpaAnnotationDefinitionProvider INSTANCE = new Generic2_0JpaAnnotationDefinitionProvider();
+
+ /**
+ * Return the singleton
+ */
+ public static JpaAnnotationDefinitionProvider instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private Generic2_0JpaAnnotationDefinitionProvider() {
+ super();
+ }
+
+ @Override
+ protected void addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS);
+ }
+
+ protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
+ Access2_0AnnotationDefinition.instance(),
+ AssociationOverride2_0AnnotationDefinition.instance(),
+ AssociationOverrides2_0AnnotationDefinition.instance(),
+ AttributeOverrideAnnotationDefinition.instance(),
+ AttributeOverridesAnnotationDefinition.instance(),
+ Cacheable2_0AnnotationDefinition.instance(),
+ DiscriminatorColumnAnnotationDefinition.instance(),
+ DiscriminatorValueAnnotationDefinition.instance(),
+ EmbeddableAnnotationDefinition.instance(),
+ EntityAnnotationDefinition.instance(),
+ IdClassAnnotationDefinition.instance(),
+ InheritanceAnnotationDefinition.instance(),
+ MappedSuperclassAnnotationDefinition.instance(),
+ NamedQuery2_0AnnotationDefinition.instance(),
+ NamedQueries2_0AnnotationDefinition.instance(),
+ NamedNativeQueryAnnotationDefinition.instance(),
+ NamedNativeQueriesAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
+ SecondaryTableAnnotationDefinition.instance(),
+ SecondaryTablesAnnotationDefinition.instance(),
+ SequenceGenerator2_0AnnotationDefinition.instance(),
+ TableAnnotationDefinition.instance(),
+ TableGeneratorAnnotationDefinition.instance()
+ };
+
+ @Override
+ protected void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, TYPE_MAPPING_ANNOTATION_DEFINITIONS);
+ }
+
+ protected static final AnnotationDefinition[] TYPE_MAPPING_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
+ EmbeddableAnnotationDefinition.instance(),
+ EntityAnnotationDefinition.instance(),
+ MappedSuperclassAnnotationDefinition.instance()
+ };
+
+ @Override
+ protected void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS);
+ }
+
+ protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
+ Access2_0AnnotationDefinition.instance(),
+ AssociationOverride2_0AnnotationDefinition.instance(),
+ AssociationOverrides2_0AnnotationDefinition.instance(),
+ AttributeOverrideAnnotationDefinition.instance(),
+ AttributeOverridesAnnotationDefinition.instance(),
+ BasicAnnotationDefinition.instance(),
+ CollectionTable2_0AnnotationDefinition.instance(),
+ ColumnAnnotationDefinition.instance(),
+ ElementCollection2_0AnnotationDefinition.instance(),
+ EmbeddedAnnotationDefinition.instance(),
+ EmbeddedIdAnnotationDefinition.instance(),
+ EnumeratedAnnotationDefinition.instance(),
+ GeneratedValueAnnotationDefinition.instance(),
+ IdAnnotationDefinition.instance(),
+ JoinColumnAnnotationDefinition.instance(),
+ JoinColumnsAnnotationDefinition.instance(),
+ JoinTableAnnotationDefinition.instance(),
+ LobAnnotationDefinition.instance(),
+ ManyToManyAnnotationDefinition.instance(),
+ ManyToOneAnnotationDefinition.instance(),
+ MapsId2_0AnnotationDefinition.instance(),
+ MapKeyAnnotationDefinition.instance(),
+ MapKeyClass2_0AnnotationDefinition.instance(),
+ MapKeyColumn2_0AnnotationDefinition.instance(),
+ MapKeyEnumerated2_0AnnotationDefinition.instance(),
+ MapKeyJoinColumn2_0AnnotationDefinition.instance(),
+ MapKeyJoinColumns2_0AnnotationDefinition.instance(),
+ MapKeyTemporal2_0AnnotationDefinition.instance(),
+ OneToManyAnnotationDefinition.instance(),
+ OneToOneAnnotationDefinition.instance(),
+ OrderByAnnotationDefinition.instance(),
+ OrderColumn2_0AnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
+ SequenceGenerator2_0AnnotationDefinition.instance(),
+ TableGeneratorAnnotationDefinition.instance(),
+ TemporalAnnotationDefinition.instance(),
+ TransientAnnotationDefinition.instance(),
+ VersionAnnotationDefinition.instance()
+ };
+
+ @Override
+ protected void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ // no package annotations
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
new file mode 100644
index 0000000000..fc808c9fa0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2;
+
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
+import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+
+/**
+ * All the state in the JPA platform should be "static" (i.e. unchanging once
+ * it is initialized).
+ */
+public class Generic2_0JpaPlatformFactory
+ implements JpaPlatformFactory
+{
+ /**
+ * zero-argument constructor
+ */
+ public Generic2_0JpaPlatformFactory() {
+ super();
+ }
+
+
+ public JpaPlatform buildJpaPlatform(String id) {
+ return new GenericJpaPlatform(
+ id,
+ this.buildJpaVersion(),
+ new GenericJpaFactory2_0(),
+ new GenericJpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()),
+ Generic2_0JpaPlatformProvider.instance(),
+ this.buildJpaPlatformVariation());
+ }
+
+ private JpaPlatform.Version buildJpaVersion() {
+ return new SimpleVersion(JpaFacet.VERSION_2_0.getVersionString());
+ }
+
+ protected JpaPlatformVariation buildJpaPlatformVariation() {
+ return new JpaPlatformVariation() {
+ //table_per_class inheritance support is optional in the 2.0 spec
+ public Supported getTablePerConcreteClassInheritanceIsSupported() {
+ return Supported.MAYBE;
+ }
+ public boolean isJoinTableOverridable() {
+ return true;
+ }
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
new file mode 100644
index 0000000000..42ae0fa973
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaElementCollectionMappingDefinition2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddedMappingDefinition2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaIdMappingDefinition2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToManyMappingDefinition2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToManyMappingDefinition2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.Generic2_0PersistenceXmlDefinition;
+
+/**
+ * All the state in the JPA platform should be "static" (i.e. unchanging once
+ * it is initialized).
+ */
+public class Generic2_0JpaPlatformProvider
+ extends AbstractJpaPlatformProvider
+{
+ // singleton
+ private static final JpaPlatformProvider INSTANCE = new Generic2_0JpaPlatformProvider();
+
+ /**
+ * Return the singleton
+ */
+ public static JpaPlatformProvider instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private Generic2_0JpaPlatformProvider() {
+ super();
+ }
+
+
+ // ********** resource models **********
+
+ public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
+ if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
+ return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
+ return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
+ return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
+ }
+ else {
+ throw new IllegalArgumentException(contentType.toString());
+ }
+ }
+
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
+ }
+
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance()
+ };
+
+
+ // ********** Java type mappings **********
+
+ @Override
+ protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ JavaEntityDefinition.instance(),
+ JavaEmbeddableDefinition.instance(),
+ JavaMappedSuperclassDefinition.instance()
+ };
+
+
+ // ********** Java attribute mappings **********
+
+ @Override
+ protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ JavaEmbeddedMappingDefinition2_0.instance(),
+ JavaBasicMappingDefinition.instance()
+ };
+
+ @Override
+ protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ JavaTransientMappingDefinition.instance(),
+ JavaElementCollectionMappingDefinition2_0.instance(),
+ JavaIdMappingDefinition2_0.instance(),
+ JavaVersionMappingDefinition.instance(),
+ JavaBasicMappingDefinition.instance(),
+ JavaEmbeddedMappingDefinition2_0.instance(),
+ JavaEmbeddedIdMappingDefinition.instance(),
+ JavaManyToManyMappingDefinition2_0.instance(),
+ JavaManyToOneMappingDefinition2_0.instance(),
+ JavaOneToManyMappingDefinition2_0.instance(),
+ JavaOneToOneMappingDefinition2_0.instance()
+ };
+
+
+ // ********** resource definitions **********
+
+ @Override
+ protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
+ CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
+ }
+
+ protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ GenericPersistenceXmlDefinition.instance(),
+ Generic2_0PersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance(),
+ GenericOrmXml2_0Definition.instance()
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
new file mode 100644
index 0000000000..7556b60b23
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2;
+
+import java.util.Iterator;
+
+import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
+
+/**
+ * Conversions are determined by the <code>delimited-identifiers</code>
+ * flag in <code>orm.xml</code>.
+ * <p>
+ * Assume we are in a JPA 2.0-compatible project.
+ */
+public class GenericJpaDatabaseIdentifierAdapter
+ implements DatabaseIdentifierAdapter
+{
+ private final JpaDataSource dataSource;
+
+ public GenericJpaDatabaseIdentifierAdapter(JpaDataSource dataSource) {
+ super();
+ this.dataSource = dataSource;
+ }
+
+ /**
+ * If the flag is set, "identifiers" are treated as "names".
+ */
+ public String convertIdentifierToName(String identifier, DefaultCallback defaultCallback) {
+ return this.getDefaultDelimitedIdentifiers() ? identifier : defaultCallback.convertIdentifierToName(identifier);
+ }
+
+ /**
+ * If the flag is set, "names" are treated as "identifiers".
+ */
+ public String convertNameToIdentifier(String name, DefaultCallback defaultCallback) {
+ return this.getDefaultDelimitedIdentifiers() ? name : defaultCallback.convertNameToIdentifier(name);
+ }
+
+ protected boolean getDefaultDelimitedIdentifiers() {
+ PersistenceUnit2_0 pu = this.getPersistenceUnit();
+ return (pu != null) && pu.getDefaultDelimitedIdentifiers();
+ }
+
+ protected PersistenceUnit2_0 getPersistenceUnit() {
+ Persistence p = this.getPersistence();
+ if (p == null) {
+ return null;
+ }
+ Iterator<PersistenceUnit> units = this.getPersistence().persistenceUnits();
+ return (PersistenceUnit2_0) (units.hasNext() ? units.next() : null);
+ }
+
+ protected Persistence getPersistence() {
+ PersistenceXml pxml = this.getPersistenceXml();
+ return (pxml == null) ? null : pxml.getPersistence();
+ }
+
+ protected PersistenceXml getPersistenceXml() {
+ // TODO this null check can be removed if the data source is moved to the persistence unit;
+ // the root context node can be null during construction;
+ // this shouldn't be a problem since the default-delimiters flag
+ // is recalculated during the initial, post-project construction, "update"
+ JpaRootContextNode rcn = this.dataSource.getJpaProject().getRootContextNode();
+ return (rcn == null) ? null : rcn.getPersistenceXml();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java
new file mode 100644
index 0000000000..da28b49192
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2;
+
+import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProject.Config;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
+import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOrderable;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaNamedQuery2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrphanRemoval2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaPersistentType2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0;
+import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0.Owner;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
+
+
+/**
+ * Central class that allows extenders to easily replace implementations of
+ * various Dali interfaces.
+ */
+public class GenericJpaFactory2_0
+ extends AbstractJpaFactory
+ implements JpaFactory2_0
+{
+
+ public GenericJpaFactory2_0() {
+ super();
+ }
+
+
+ // ********** Core Model **********
+
+ @Override
+ public JpaProject buildJpaProject(Config config) {
+ if ( ! (config instanceof JpaProject2_0.Config)) {
+ throw new IllegalArgumentException("config must be 2.0-compatible: " + config); //$NON-NLS-1$
+ }
+ return super.buildJpaProject(config);
+ }
+
+ public MetamodelSourceType.Synchronizer buildMetamodelSynchronizer(MetamodelSourceType sourceType) {
+ return new GenericMetamodelSynchronizer(sourceType);
+ }
+
+ public DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter(JpaDataSource dataSource) {
+ return new GenericJpaDatabaseIdentifierAdapter(dataSource);
+ }
+
+
+ // ********** Java Context Model **********
+
+ @Override
+ public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) {
+ return new GenericJavaPersistentType2_0(owner, jrpt);
+ }
+
+ @Override
+ public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
+ return new GenericJavaPersistentAttribute2_0(parent, jrpa);
+ }
+
+ @Override
+ public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation) {
+ return new GenericJavaEmbeddable2_0(parent, embeddableAnnotation);
+ }
+
+ @Override
+ public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation annotation) {
+ return new GenericJavaSequenceGenerator2_0(parent, (SequenceGenerator2_0Annotation) annotation);
+ }
+
+ //The 2.0 JPA spec supports association overrides on an embedded mapping while the 1.0 spec did not
+ public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEmbeddedMapping2_0 parent, JavaAssociationOverrideContainer.Owner owner) {
+ return new GenericJavaAssociationOverrideContainer(parent, owner);
+ }
+
+ public JavaDerivedIdentity2_0 buildJavaDerivedIdentity(JavaSingleRelationshipMapping2_0 parent) {
+ return new GenericJavaDerivedIdentity2_0(parent);
+ }
+
+ public JavaElementCollectionMapping2_0 buildJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
+ return new GenericJavaElementCollectionMapping2_0(parent);
+ }
+
+ public JavaCacheable2_0 buildJavaCacheable(JavaCacheableHolder2_0 parent) {
+ return new GenericJavaCacheable2_0(parent);
+ }
+
+ public JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent) {
+ return new GenericJavaOrphanRemoval2_0(parent);
+ }
+
+ @Override
+ public JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation annotation) {
+ return new GenericJavaNamedQuery2_0(parent, (NamedQuery2_0Annotation) annotation);
+ }
+
+ public JavaCollectionTable2_0 buildJavaCollectionTable(JavaElementCollectionMapping2_0 parent, Table.Owner owner) {
+ return new GenericJavaCollectionTable2_0(parent, owner);
+ }
+
+ public JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner) {
+ return new GenericJavaOrderColumn2_0(parent, owner);
+ }
+
+ public JavaColumn buildJavaMapKeyColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) {
+ return new GenericJavaColumn(parent, owner);
+ }
+
+ public JavaOrderable2_0 buildJavaOrderable(JavaAttributeMapping parent, Owner owner) {
+ return new GenericJavaOrderable(parent, owner);
+ }
+
+ @Override
+ public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
new file mode 100644
index 0000000000..4b1817069d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
@@ -0,0 +1,432 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.utility.BodySourceWriter;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.SimpleStack;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
+
+import com.ibm.icu.text.DateFormat;
+import com.ibm.icu.text.SimpleDateFormat;
+
+/**
+ * For now, the "synchronization" is simple brute-force: we generate the source
+ * code and then compare it with what is already present in the file.
+ * If the new source is different, we replace the file contents; otherwise, we
+ * leave the file unchanged.
+ */
+@SuppressWarnings("nls")
+public class GenericMetamodelSynchronizer
+ implements MetamodelSourceType.Synchronizer
+{
+ protected final MetamodelSourceType sourceType;
+
+
+ public GenericMetamodelSynchronizer(MetamodelSourceType sourceType) {
+ super();
+ this.sourceType = sourceType;
+ }
+
+ public IFile getFile() {
+ return (IFile) this.getPackageFragment().getCompilationUnit(this.getFileName()).getResource();
+ }
+
+
+ // ********** synchronize **********
+
+ public void synchronize(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ try {
+ this.synchronize_(memberTypeTree);
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ protected void synchronize_(Map<String, Collection<MetamodelSourceType>> memberTypeTree) throws JavaModelException {
+ IPackageFragment pkg = this.getPackageFragment();
+ String fileName = this.getFileName();
+
+ ICompilationUnit compilationUnit = pkg.getCompilationUnit(fileName);
+ if (compilationUnit.exists()) {
+ // overwrite existing file if it has changed (ignoring the timestamp)
+ String newSource = this.buildSource(compilationUnit, memberTypeTree);
+ if (newSource != null) {
+ pkg.createCompilationUnit(fileName, newSource, true, null); // true=force
+ }
+ } else {
+ // write a new file, creating the package folders if necessary
+ if ( ! pkg.exists()) {
+ this.getSourceFolder().createPackageFragment(pkg.getElementName(), true, null); // true=force
+ }
+ pkg.createCompilationUnit(fileName, this.buildSource(memberTypeTree), false, null); // false=no force
+ }
+ }
+
+ /**
+ * pre-condition: the compilation unit exists
+ *
+ * return null if the old source is not to be replaced
+ */
+ protected String buildSource(ICompilationUnit compilationUnit, Map<String, Collection<MetamodelSourceType>> memberTypeTree) throws JavaModelException {
+ IFile file = (IFile) compilationUnit.getResource();
+ JavaResourcePersistentType2_0 genType = this.getJpaProject().getGeneratedMetamodelTopLevelType(file);
+ if (genType == null) {
+ return null; // the file exists, but its source is not a generated metamodel top-level class
+ }
+
+ String oldSource = compilationUnit.getSource();
+ int oldLength = oldSource.length();
+
+ String newSource = this.buildSource(memberTypeTree);
+ int newLength = newSource.length();
+ if (newLength != oldLength) {
+ return newSource;
+ }
+
+ String date = genType.getGeneratedAnnotation().getDate(); // if we get here, this will be non-empty
+ int dateBegin = oldSource.indexOf(date);
+ if (dateBegin == -1) {
+ return null; // hmmm...
+ }
+ int dateEnd = dateBegin + date.length();
+ if (dateEnd > oldLength) {
+ return null; // hmmm...
+ }
+
+ if (newSource.regionMatches(0, oldSource, 0, dateBegin) &&
+ newSource.regionMatches(dateEnd, oldSource, dateEnd, oldLength - dateEnd)) {
+ return null;
+ }
+ return newSource;
+ }
+
+
+ // ********** package/file **********
+
+ protected IPackageFragment getPackageFragment() {
+ return this.getSourceFolder().getPackageFragment(this.getPackageName());
+ }
+
+ protected IPackageFragmentRoot getSourceFolder() {
+ return this.getJpaProject().getMetamodelPackageFragmentRoot();
+ }
+
+ protected JpaProject2_0 getJpaProject() {
+ return (JpaProject2_0) this.sourceType.getJpaProject();
+ }
+
+ protected String getPackageName() {
+ return this.buildPackageName(this.sourceType.getName());
+ }
+
+ protected String buildPackageName(String topLevelSourceTypeName) {
+ return this.buildPackageName_(ClassName.getPackageName(topLevelSourceTypeName));
+ }
+
+ // TODO
+ protected String buildPackageName_(String sourcePackageName) {
+ // the default is to store the metamodel class in the same package as the source type
+ return sourcePackageName;
+ }
+
+ protected String getFileName() {
+ return ClassName.getSimpleName(this.getClassName()) + ".java";
+ }
+
+ protected String getClassName() {
+ return this.buildClassName(this.sourceType.getName());
+ }
+
+ protected String buildClassName(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ return this.buildClassName(this.sourceType.getName(), memberTypeTree);
+ }
+
+ protected String buildClassName(String sourceTypeName, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ String current = sourceTypeName;
+ SimpleStack<String> stack = new SimpleStack<String>();
+
+ while (true) {
+ stack.push(ClassName.getSimpleName(current));
+ String declaringTypeName = this.getDeclaringTypeName(current, memberTypeTree);
+ if (declaringTypeName == null) {
+ break;
+ }
+ current = declaringTypeName;
+ }
+
+ StringBuilder sb = new StringBuilder(sourceTypeName.length() + 10);
+ sb.append(this.buildPackageName(current));
+ while ( ! stack.isEmpty()) {
+ sb.append('.');
+ sb.append(this.buildSimpleClassName(stack.pop()));
+ }
+ return sb.toString();
+ }
+
+ protected String buildClassName(String topLevelSourceTypeName) {
+ return this.buildPackageName(topLevelSourceTypeName) + '.' + this.buildSimpleClassName(ClassName.getSimpleName(topLevelSourceTypeName));
+ }
+
+ protected String getSimpleClassName() {
+ return this.buildSimpleClassName(ClassName.getSimpleName(this.sourceType.getName()));
+ }
+
+ // TODO
+ protected String buildSimpleClassName(String simpleSourceTypeName) {
+ // the default is to simply append an underscore to the source type name
+ return simpleSourceTypeName + '_';
+ }
+
+
+ // ********** source code **********
+
+ /**
+ * build the "body" source first; then build the "package" and "imports" source
+ * and concatenate the "body" source to it
+ */
+ protected String buildSource(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ // build the body source first so we can gather up the import statements
+ BodySourceWriter bodySourceWriter = this.buildBodySourceWriter(memberTypeTree);
+
+ StringWriter sw = new StringWriter(bodySourceWriter.getLength() + 2000);
+ PrintWriter pw = new PrintWriter(sw);
+ this.printPackageAndImportsOn(pw, bodySourceWriter);
+ pw.print(bodySourceWriter.getSource());
+ return sw.toString();
+ }
+
+ protected BodySourceWriter buildBodySourceWriter(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ BodySourceWriter pw = new BodySourceWriter(this.getPackageName(), this.getClassName());
+ this.printBodySourceOn(pw, memberTypeTree);
+ return pw;
+ }
+
+ public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ this.printClassDeclarationOn(pw, memberTypeTree);
+ pw.print(" {");
+ pw.println();
+
+ pw.indent();
+ boolean attributesPrinted = this.printAttributesOn(pw);
+ this.printMemberTypesOn(pw, memberTypeTree, attributesPrinted);
+ pw.undent();
+
+ pw.print('}');
+ pw.println(); // EOF
+ }
+
+
+ // ********** class declaration **********
+
+ protected void printClassDeclarationOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ boolean topLevel = this.sourceTypeIsTopLevel(memberTypeTree);
+ if (topLevel) {
+ this.printGeneratedAnnotationOn(pw);
+ }
+ if (this.sourceType.isManaged()) {
+ this.printStaticMetamodelAnnotationOn(pw);
+ }
+
+ pw.print("public ");
+ if ( ! topLevel) {
+ pw.print("static ");
+ }
+ pw.print("class ");
+ pw.print(this.getSimpleClassName()); // this is always the simple name
+ PersistentType superPersistentType = this.sourceType.getSuperPersistentType();
+ if (superPersistentType != null) {
+ pw.print(" extends ");
+ pw.printTypeDeclaration(this.buildClassName(superPersistentType.getName(), memberTypeTree));
+ }
+ }
+
+ /**
+ * Return whether the source type is a top level type.
+ * This can be inferred from the specified member type tree.
+ */
+ protected boolean sourceTypeIsTopLevel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ return this.sourceTypeIsTopLevel(this.sourceType.getName(), memberTypeTree);
+ }
+
+ /**
+ * Return whether the specified source type is a top level type.
+ * This can be inferred from the specified member type tree.
+ */
+ protected boolean sourceTypeIsTopLevel(String sourceTypeName, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ return this.getDeclaringTypeName(sourceTypeName, memberTypeTree) == null;
+ }
+
+ /**
+ * Return the name of the specified source type's declaring type, as
+ * implied by the specified member type tree. Return null if the source
+ * type is a top-level type.
+ */
+ protected String getDeclaringTypeName(String sourceTypeName, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ int lastPeriod = sourceTypeName.lastIndexOf('.');
+ if (lastPeriod == -1) {
+ return null; // default package top-level type
+ }
+ String declaringTypeName = sourceTypeName.substring(0, lastPeriod);
+ return (memberTypeTree.get(declaringTypeName) == null) ? null : declaringTypeName;
+ }
+
+ protected void printGeneratedAnnotationOn(BodySourceWriter pw) {
+ pw.printAnnotation("javax.annotation.Generated");
+ pw.print('(');
+ pw.print("value=");
+ pw.printStringLiteral(JavaResourcePersistentType2_0.METAMODEL_GENERATED_ANNOTATION_VALUE);
+ pw.print(", ");
+ pw.print("date=");
+ pw.printStringLiteral(format(new Date()));
+ pw.print(')');
+ pw.println();
+ }
+
+ protected void printStaticMetamodelAnnotationOn(BodySourceWriter pw) {
+ pw.printAnnotation(JPA2_0.STATIC_METAMODEL);
+ pw.print('(');
+ pw.printTypeDeclaration(this.sourceType.getName());
+ pw.print(".class");
+ pw.print(')');
+ pw.println();
+ }
+
+ /**
+ * {@link SimpleDateFormat} is not thread-safe.
+ */
+ protected static synchronized String format(Date date) {
+ return DATE_FORMAT.format(date);
+ }
+ /**
+ * Recommended date format is ISO 8601.
+ * See javax.annotation.Generated
+ */
+ private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+
+
+ // ********** attributes **********
+
+ /**
+ * Return whether any attributes were printed.
+ */
+ protected boolean printAttributesOn(BodySourceWriter pw) {
+ boolean printed = false;
+ for (Iterator<PersistentAttribute> stream = this.sourceType.attributes(); stream.hasNext(); ) {
+ this.printAttributeOn(stream.next(), pw);
+ printed = true;
+ }
+ return printed;
+ }
+
+ protected void printAttributeOn(PersistentAttribute persistentAttribute, BodySourceWriter pw) {
+ AttributeMapping attributeMapping = persistentAttribute.getMapping();
+ if (attributeMapping != null) { // probably shouldn't be null?
+ this.printAttributeMappingOn(attributeMapping, pw);
+ }
+ }
+
+ protected void printAttributeMappingOn(AttributeMapping attributeMapping, BodySourceWriter pw) {
+ MetamodelField field = ((AttributeMapping2_0) attributeMapping).getMetamodelField();
+ if (field != null) {
+ this.printFieldOn(field, pw);
+ }
+ }
+
+ protected void printFieldOn(MetamodelField field, BodySourceWriter pw) {
+ for (String modifier : field.getModifiers()) {
+ pw.print(modifier);
+ pw.print(' ');
+ }
+ pw.printTypeDeclaration(field.getTypeName());
+ pw.print('<');
+ for (Iterator<String> stream = field.getTypeArgumentNames().iterator(); stream.hasNext(); ) {
+ pw.printTypeDeclaration(stream.next());
+ if (stream.hasNext()) {
+ pw.print(", ");
+ }
+ }
+ pw.print('>');
+ pw.print(' ');
+ pw.print(field.getName());
+ pw.print(';');
+ pw.println();
+ }
+
+
+ // ********** member types **********
+
+ protected void printMemberTypesOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree, boolean attributesPrinted) {
+ Collection<MetamodelSourceType> memberTypes = memberTypeTree.get(this.sourceType.getName());
+ if (memberTypes != null) {
+ if (attributesPrinted) {
+ pw.println();
+ }
+ for (Iterator<MetamodelSourceType> stream = memberTypes.iterator(); stream.hasNext(); ) {
+ stream.next().printBodySourceOn(pw, memberTypeTree);
+ if (stream.hasNext()) {
+ pw.println();
+ }
+ }
+ }
+ }
+
+
+ // ********** package and imports **********
+
+ protected void printPackageAndImportsOn(PrintWriter pw, BodySourceWriter bodySourceWriter) {
+ if (this.getPackageName().length() != 0) {
+ pw.print("package ");
+ pw.print(this.getPackageName());
+ pw.print(';');
+ pw.println();
+ pw.println();
+ }
+
+ for (String import_ : bodySourceWriter.getImports()) {
+ pw.print("import ");
+ pw.print(import_);
+ pw.print(';');
+ pw.println();
+ }
+ pw.println();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.sourceType.getName());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java
new file mode 100644
index 0000000000..a54439ba79
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTableValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
+
+public class CollectionTableValidator extends AbstractTableValidator
+{
+ public CollectionTableValidator(CollectionTable2_0 table, TableTextRangeResolver textRangeResolver) {
+ super(table, textRangeResolver);
+ }
+
+ public CollectionTableValidator(PersistentAttribute persistentAttribute, CollectionTable2_0 table, TableTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, table, textRangeResolver);
+ }
+
+ @Override
+ protected String getUnresolvedCatalogMessage() {
+ return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_CATALOG;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedCatalogMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_CATALOG;
+ }
+
+ @Override
+ protected String getUnresolvedSchemaMessage() {
+ return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_SCHEMA;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedSchemaMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA;
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java
new file mode 100644
index 0000000000..687472f808
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
+
+public class OrderColumnValidator
+ extends AbstractNamedColumnValidator<OrderColumn2_0, NamedColumnTextRangeResolver>
+{
+ public OrderColumnValidator(
+ OrderColumn2_0 column,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ super(column, textRangeResolver);
+ }
+
+ public OrderColumnValidator(
+ PersistentAttribute persistentAttribute,
+ OrderColumn2_0 column,
+ NamedColumnTextRangeResolver textRangeResolver) {
+ super(persistentAttribute, column, textRangeResolver);
+ }
+
+ @Override
+ protected String getUnresolvedNameMessage() {
+ return JpaValidationMessages.ORDER_COLUMN_UNRESOLVED_NAME;
+ }
+
+ @Override
+ protected String getVirtualAttributeUnresolvedNameMessage() {
+ return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java
new file mode 100644
index 0000000000..7720bfbd30
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context;
+
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+
+/**
+ * Straightforward implementation.
+ */
+public class SimpleMetamodelField
+ implements MetamodelField
+{
+ protected final Iterable<String> modifiers;
+ protected final String typeName;
+ protected final Iterable<String> typeArgumentNames;
+ protected final String name;
+
+ public SimpleMetamodelField(
+ Iterable<String> modifiers,
+ String typeName,
+ Iterable<String> typeArgumentNames,
+ String name
+ ) {
+ super();
+ if (modifiers == null) {
+ throw new NullPointerException();
+ }
+ if (typeName == null) {
+ throw new NullPointerException();
+ }
+ if (typeArgumentNames == null) {
+ throw new NullPointerException();
+ }
+ if (name == null) {
+ throw new NullPointerException();
+ }
+ this.modifiers = modifiers;
+ this.typeName = typeName;
+ this.typeArgumentNames = typeArgumentNames;
+ this.name = name;
+ }
+
+ public Iterable<String> getModifiers() {
+ return this.modifiers;
+ }
+
+ public String getTypeName() {
+ return this.typeName;
+ }
+
+ public Iterable<String> getTypeArgumentNames() {
+ return this.typeArgumentNames;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public int hashCode() {
+ return CollectionTools.hashCode(this.modifiers) ^
+ this.typeName.hashCode() ^
+ CollectionTools.hashCode(this.typeArgumentNames) ^
+ this.name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if ( ! (o instanceof MetamodelField)) {
+ return false;
+ }
+ MetamodelField other = (MetamodelField) o;
+ return CollectionTools.elementsAreEqual(this.getModifiers(), other.getModifiers()) &&
+ this.getTypeName().equals(other.getTypeName()) &&
+ CollectionTools.elementsAreEqual(this.getTypeArgumentNames(), other.getTypeArgumentNames()) &&
+ this.getName().equals(other.getName());
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (String modifier : this.modifiers) {
+ sb.append(modifier);
+ sb.append(' ');
+ }
+ sb.append(this.typeName);
+ sb.append('<');
+ for (String typeArgumentName : this.typeArgumentNames) {
+ sb.append(typeArgumentName);
+ sb.append(", "); //$NON-NLS-1$
+ }
+ sb.setLength(sb.length() - 2);
+ sb.append('>');
+ sb.append(' ');
+ sb.append(this.name);
+ return sb.toString();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
new file mode 100644
index 0000000000..48d9c79669
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
@@ -0,0 +1,1530 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.Association;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.CollectionTableValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * JPA 2.0 Frankenstein mapping
+ */
+public abstract class AbstractJavaElementCollectionMapping2_0
+ extends AbstractJavaAttributeMapping<ElementCollection2_0Annotation>
+ implements JavaElementCollectionMapping2_0
+{
+ protected String specifiedTargetClass;
+ protected String defaultTargetClass;
+ protected String fullyQualifiedTargetClass;
+
+ protected FetchType specifiedFetch;
+ protected FetchType defaultFetch;
+
+ protected final JavaOrderable2_0 orderable;
+
+ protected final JavaCollectionTable2_0 collectionTable;
+
+ protected Type valueType;
+ protected final JavaColumn valueColumn;
+ protected JavaConverter converter; // value converter - never null
+ protected final JavaAttributeOverrideContainer valueAttributeOverrideContainer;
+ protected final JavaAssociationOverrideContainer valueAssociationOverrideContainer;
+
+ protected Type keyType;
+
+ //MapKey is not supported by the spec, so this is only for EclipseLink
+ //In the generic case we can handle this with validation and not showing the UI widgets
+ protected String specifiedMapKey;
+ protected boolean noMapKey = false;
+ protected boolean pkMapKey = false;
+ protected boolean customMapKey = false;
+
+ protected String specifiedMapKeyClass;
+ protected String defaultMapKeyClass;
+ protected String fullyQualifiedMapKeyClass;
+
+ protected final JavaColumn mapKeyColumn;
+
+ protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer;
+
+
+ protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] {
+ JavaEnumeratedConverter.Adapter.instance(),
+ JavaTemporalConverter.Adapter.instance(),
+ JavaLobConverter.Adapter.instance()
+ };
+ protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
+ super(parent);
+ this.specifiedTargetClass = this.buildSpecifiedTargetClass();
+ this.specifiedFetch = this.buildSpecifiedFetch();
+ this.orderable = this.buildOrderable();
+ this.collectionTable = this.buildCollectionTable();
+
+ this.valueColumn = this.buildValueColumn();
+ this.converter = this.buildConverter();
+ this.valueAttributeOverrideContainer = this.buildValueAttributeOverrideContainer();
+ this.valueAssociationOverrideContainer = this.buildValueAssociationOverrideContainer();
+
+ this.specifiedMapKey = this.buildSpecifiedMapKey();
+ this.noMapKey = this.buildNoMapKey();
+ this.pkMapKey = this.buildPkMapKey();
+ this.customMapKey = this.buildCustomMapKey();
+ this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
+
+ this.mapKeyColumn = this.buildMapKeyColumn();
+ this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTargetClass_(this.buildSpecifiedTargetClass());
+ this.setSpecifiedFetch_(this.buildSpecifiedFetch());
+ this.orderable.synchronizeWithResourceModel();
+ this.collectionTable.synchronizeWithResourceModel();
+
+ this.valueColumn.synchronizeWithResourceModel();
+ this.syncConverter();
+ this.valueAttributeOverrideContainer.synchronizeWithResourceModel();
+ this.valueAssociationOverrideContainer.synchronizeWithResourceModel();
+
+ this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
+ this.setNoMapKey_(this.buildNoMapKey());
+ this.setPkMapKey_(this.buildPkMapKey());
+ this.setCustomMapKey_(this.buildCustomMapKey());
+ this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
+
+ this.mapKeyColumn.synchronizeWithResourceModel();
+ this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ this.setDefaultTargetClass(this.buildDefaultTargetClass());
+ this.setFullyQualifiedTargetClass(this.buildFullyQualifiedTargetClass());
+ this.setDefaultFetch(this.buildDefaultFetch());
+
+ this.orderable.update();
+ this.collectionTable.update();
+
+ this.setValueType(this.buildValueType());
+ this.valueColumn.update();
+ this.converter.update();
+ this.valueAttributeOverrideContainer.update();
+ this.valueAssociationOverrideContainer.update();
+
+ this.setKeyType(this.buildKeyType());
+ this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
+ this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass());
+
+ this.mapKeyColumn.update();
+ this.mapKeyAttributeOverrideContainer.update();
+ }
+
+
+ // ********** target class **********
+
+ public String getTargetClass() {
+ return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass;
+ }
+
+ public String getSpecifiedTargetClass() {
+ return this.specifiedTargetClass;
+ }
+
+ public void setSpecifiedTargetClass(String targetClass) {
+ if (this.valuesAreDifferent(targetClass, this.specifiedTargetClass)) {
+ this.getAnnotationForUpdate().setTargetClass(targetClass);
+ this.setSpecifiedTargetClass_(targetClass);
+ }
+ }
+
+ protected void setSpecifiedTargetClass_(String targetClass) {
+ String old = this.specifiedTargetClass;
+ this.specifiedTargetClass = targetClass;
+ this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
+ }
+
+ protected String buildSpecifiedTargetClass() {
+ ElementCollection2_0Annotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getTargetClass();
+ }
+
+ public String getDefaultTargetClass() {
+ return this.defaultTargetClass;
+ }
+
+ protected void setDefaultTargetClass(String targetClass) {
+ String old = this.defaultTargetClass;
+ this.defaultTargetClass = targetClass;
+ this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass);
+ }
+
+ protected String buildDefaultTargetClass() {
+ return this.getPersistentAttribute().getMultiReferenceTargetTypeName();
+ }
+
+ public String getFullyQualifiedTargetClass() {
+ return this.fullyQualifiedTargetClass;
+ }
+
+ protected void setFullyQualifiedTargetClass(String targetClass) {
+ String old = this.fullyQualifiedTargetClass;
+ this.fullyQualifiedTargetClass = targetClass;
+ this.firePropertyChanged(FULLY_QUALIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
+ }
+
+ protected String buildFullyQualifiedTargetClass() {
+ return (this.specifiedTargetClass == null) ?
+ this.defaultTargetClass :
+ this.getMappingAnnotation().getFullyQualifiedTargetClassName();
+ }
+
+ public char getTargetClassEnclosingTypeSeparator() {
+ return '.';
+ }
+
+
+ // ********** resolved target type/embeddable/entity **********
+
+ public PersistentType getResolvedTargetType() {
+ return this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetClass);
+ }
+
+ protected Embeddable getResolvedTargetEmbeddable() {
+ return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedTargetClass);
+ }
+
+ protected Entity getResolvedTargetEntity() {
+ return this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetClass);
+ }
+
+
+ // ********** fetch **********
+
+ public FetchType getFetch() {
+ return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType fetch) {
+ if (this.valuesAreDifferent(fetch, this.specifiedFetch)) {
+ this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch));
+ this.setSpecifiedFetch_(fetch);
+ }
+ }
+
+ protected void setSpecifiedFetch_(FetchType fetch) {
+ FetchType old = this.specifiedFetch;
+ this.specifiedFetch = fetch;
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildSpecifiedFetch() {
+ ElementCollection2_0Annotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch());
+ }
+
+ public FetchType getDefaultFetch() {
+ return this.defaultFetch;
+ }
+
+ protected void setDefaultFetch(FetchType fetch) {
+ FetchType old = this.defaultFetch;
+ this.defaultFetch = fetch;
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+
+ // ********** orderable **********
+
+ public JavaOrderable2_0 getOrderable() {
+ return this.orderable;
+ }
+
+ protected JavaOrderable2_0 buildOrderable() {
+ return this.getJpaFactory().buildJavaOrderable(this, this.buildOrderableOwner());
+ }
+
+ protected Orderable2_0.Owner buildOrderableOwner() {
+ return new OrderableOwner();
+ }
+
+ protected class OrderableOwner
+ implements Orderable2_0.Owner
+ {
+ public String getTableName() {
+ return this.getCollectionTable().getName();
+ }
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return this.getCollectionTable().getDbTable();
+ }
+ protected JavaCollectionTable2_0 getCollectionTable() {
+ return AbstractJavaElementCollectionMapping2_0.this.getCollectionTable();
+ }
+ }
+
+
+ // ********** collection table **********
+
+ public JavaCollectionTable2_0 getCollectionTable() {
+ return this.collectionTable;
+ }
+
+ protected JavaCollectionTable2_0 buildCollectionTable() {
+ return this.getJpaFactory().buildJavaCollectionTable(this, this.buildCollectionTableOwner());
+ }
+
+ protected Table.Owner buildCollectionTableOwner() {
+ return new CollectionTableOwner();
+ }
+
+ protected class CollectionTableOwner
+ implements Table.Owner
+ {
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return new CollectionTableValidator((CollectionTable2_0) table, textRangeResolver);
+ }
+ }
+
+
+ // ********** value type **********
+
+ public Type getValueType() {
+ return this.valueType;
+ }
+
+ protected void setValueType(Type valueType) {
+ Type old = this.valueType;
+ this.valueType = valueType;
+ this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType);
+ }
+
+ protected Type buildValueType() {
+ if (this.getResolvedTargetEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getResolvedTargetEntity() != null) {
+ return Type.ENTITY_TYPE;
+ }
+ if (this.getTargetClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+
+ // ********** value column **********
+
+ public JavaColumn getValueColumn() {
+ return this.valueColumn;
+ }
+
+ protected JavaColumn buildValueColumn() {
+ return this.getJpaFactory().buildJavaColumn(this, this.buildValueColumnOwner());
+ }
+
+ protected JavaColumn.Owner buildValueColumnOwner() {
+ return new ValueColumnOwner();
+ }
+
+ protected ColumnAnnotation getValueColumnAnnotation() {
+ return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removeValueColumnAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** converter **********
+
+ public JavaConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ this.converter.dispose();
+ JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.retainConverterAnnotation(converterAdapter);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ }
+ }
+
+ protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getJpaFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(JavaConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ /**
+ * Clear all the converter annotations <em>except</em> for the annotation
+ * corresponding to the specified adapter. If the specified adapter is
+ * <code>null</code>, remove <em>all</em> the converter annotations.
+ */
+ protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter != converterAdapter) {
+ adapter.removeConverterAnnotation(resourceAttribute);
+ }
+ }
+ }
+
+ protected JavaConverter buildConverter() {
+ JpaFactory jpaFactory = this.getJpaFactory();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory);
+ if (javaConverter != null) {
+ return javaConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ Association<JavaConverter.Adapter, Annotation> assoc = this.getConverterAnnotation();
+ if (assoc == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ JavaConverter.Adapter adapter = assoc.getKey();
+ Annotation annotation = assoc.getValue();
+ if ((this.converter.getType() == adapter.getConverterType()) &&
+ (this.converter.getConverterAnnotation() == annotation)) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first converter annotation we find along with its corresponding
+ * adapter. Return <code>null</code> if there are no converter annotations.
+ */
+ protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
+ JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
+ if (annotation != null) {
+ return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation);
+ }
+ }
+ return null;
+ }
+
+ protected JavaConverter buildNullConverter() {
+ return new NullJavaConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected JavaConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<JavaConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** value attribute override container **********
+
+ public JavaAttributeOverrideContainer getValueAttributeOverrideContainer() {
+ return this.valueAttributeOverrideContainer;
+ }
+
+ protected JavaAttributeOverrideContainer buildValueAttributeOverrideContainer() {
+ return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildValueAttributeOverrideContainerOwner());
+ }
+
+ protected JavaAttributeOverrideContainer.Owner buildValueAttributeOverrideContainerOwner() {
+ return new ValueAttributeOverrideContainerOwner();
+ }
+
+
+ // ********** value association override container **********
+
+ public JavaAssociationOverrideContainer getValueAssociationOverrideContainer() {
+ return this.valueAssociationOverrideContainer;
+ }
+
+ protected JavaAssociationOverrideContainer buildValueAssociationOverrideContainer() {
+ return this.getJpaFactory().buildJavaAssociationOverrideContainer(this, this.buildValueAssociationOverrideContainerOwner());
+ }
+
+ protected JavaAssociationOverrideContainer.Owner buildValueAssociationOverrideContainerOwner() {
+ return new ValueAssociationOverrideContainerOwner();
+ }
+
+
+ // ********** key type **********
+
+ public Type getKeyType() {
+ return this.keyType;
+ }
+
+ protected void setKeyType(Type keyType) {
+ Type old = this.keyType;
+ this.keyType = keyType;
+ this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType);
+ }
+
+ protected Type buildKeyType() {
+ if (this.getResolvedMapKeyEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getResolvedMapKeyEntity() != null) {
+ return Type.ENTITY_TYPE;
+ }
+ if (this.getMapKeyClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+
+ // ********** map key **********
+
+ public String getMapKey() {
+ if (this.noMapKey) {
+ return null;
+ }
+ if (this.pkMapKey) {
+ // the target is either embeddable or basic, so a key will have to be specified
+ return null;
+ }
+ if (this.customMapKey) {
+ return this.specifiedMapKey;
+ }
+ throw new IllegalStateException("unknown map key"); //$NON-NLS-1$
+ }
+
+
+ // ********** specified map key **********
+
+ public String getSpecifiedMapKey() {
+ return this.specifiedMapKey;
+ }
+
+ public void setSpecifiedMapKey(String mapKey) {
+ if (mapKey != null) {
+ this.getMapKeyAnnotationForUpdate().setName(mapKey);
+
+ this.setSpecifiedMapKey_(mapKey);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(true);
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setSpecifiedMapKey_(String mapKey) {
+ String old = this.specifiedMapKey;
+ this.specifiedMapKey = mapKey;
+ this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
+ }
+
+ protected String buildSpecifiedMapKey() {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation == null) ? null : mapKeyAnnotation.getName();
+ }
+
+
+ // ********** no map key **********
+
+ public boolean isNoMapKey() {
+ return this.noMapKey;
+ }
+
+ public void setNoMapKey(boolean noMapKey) {
+ if (noMapKey) {
+ if (this.getMapKeyAnnotation() != null) {
+ this.removeMapKeyAnnotation();
+ }
+
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(true);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(false);
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setNoMapKey_(boolean noMapKey) {
+ boolean old = this.noMapKey;
+ this.noMapKey = noMapKey;
+ this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
+ }
+
+ protected boolean buildNoMapKey() {
+ return this.getMapKeyAnnotation() == null;
+ }
+
+
+ // ********** pk map key **********
+
+ public boolean isPkMapKey() {
+ return this.pkMapKey;
+ }
+
+ public void setPkMapKey(boolean pkMapKey) {
+ if (pkMapKey) {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ if (mapKeyAnnotation == null) {
+ mapKeyAnnotation = this.addMapKeyAnnotation();
+ } else {
+ mapKeyAnnotation.setName(null);
+ }
+
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(true);
+ this.setCustomMapKey_(false);
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setPkMapKey_(boolean pkMapKey) {
+ boolean old = this.pkMapKey;
+ this.pkMapKey = pkMapKey;
+ this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
+ }
+
+ protected boolean buildPkMapKey() {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() == null);
+ }
+
+
+ // ********** custom map key **********
+
+ public boolean isCustomMapKey() {
+ return this.customMapKey;
+ }
+
+ public void setCustomMapKey(boolean customMapKey) {
+ if (customMapKey) {
+ this.setSpecifiedMapKey(""); //$NON-NLS-1$
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setCustomMapKey_(boolean customMapKey) {
+ boolean old = this.customMapKey;
+ this.customMapKey = customMapKey;
+ this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
+ }
+
+ protected boolean buildCustomMapKey() {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() != null);
+ }
+
+
+ // ********** map key annotation **********
+
+ protected MapKeyAnnotation getMapKeyAnnotation() {
+ return (MapKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ }
+
+ protected MapKeyAnnotation getMapKeyAnnotationForUpdate() {
+ MapKeyAnnotation annotation = this.getMapKeyAnnotation();
+ return (annotation != null ) ? annotation : this.addMapKeyAnnotation();
+ }
+
+ protected MapKeyAnnotation addMapKeyAnnotation() {
+ return (MapKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ }
+
+ protected void removeMapKeyAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ }
+
+ protected boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) {
+ MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
+ return (mapKeyAnnotation != null) && mapKeyAnnotation.nameTouches(pos, astRoot);
+ }
+
+
+ // ********** map key class **********
+
+ public String getMapKeyClass() {
+ return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass;
+ }
+
+ public String getSpecifiedMapKeyClass() {
+ return this.specifiedMapKeyClass;
+ }
+
+ public void setSpecifiedMapKeyClass(String mapKeyClass) {
+ if (this.valuesAreDifferent(mapKeyClass, this.specifiedMapKeyClass)) {
+ MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation();
+ if (mapKeyClass == null) {
+ if (annotation != null) {
+ this.removeMapKeyClassAnnotation();
+ }
+ } else {
+ if (annotation == null) {
+ annotation = this.addMapKeyClassAnnotation();
+ }
+ annotation.setValue(mapKeyClass);
+ }
+
+ this.setSpecifiedMapKeyClass_(mapKeyClass);
+ }
+ }
+
+ protected void setSpecifiedMapKeyClass_(String mapKeyClass) {
+ String old = this.specifiedMapKeyClass;
+ this.specifiedMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildSpecifiedMapKeyClass() {
+ MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation();
+ return (annotation == null) ? null : annotation.getValue();
+ }
+
+ public String getDefaultMapKeyClass() {
+ return this.defaultMapKeyClass;
+ }
+
+ protected void setDefaultMapKeyClass(String mapKeyClass) {
+ String old = this.defaultMapKeyClass;
+ this.defaultMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildDefaultMapKeyClass() {
+ return this.getPersistentAttribute().getMultiReferenceMapKeyTypeName();
+ }
+
+ public String getFullyQualifiedMapKeyClass() {
+ return this.fullyQualifiedMapKeyClass;
+ }
+
+ protected void setFullyQualifiedMapKeyClass(String mapKeyClass) {
+ String old = this.fullyQualifiedMapKeyClass;
+ this.fullyQualifiedMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(FULLY_QUALIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildFullyQualifiedMapKeyClass() {
+ return (this.specifiedMapKeyClass == null) ?
+ this.defaultMapKeyClass :
+ this.getMapKeyClassAnnotation().getFullyQualifiedClassName();
+ }
+
+ public char getMapKeyClassEnclosingTypeSeparator() {
+ return '.';
+ }
+
+
+ // ********** resolved map key embeddable/entity **********
+
+ protected Embeddable getResolvedMapKeyEmbeddable() {
+ return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedMapKeyClass);
+ }
+
+ protected Entity getResolvedMapKeyEntity() {
+ return this.getPersistenceUnit().getEntity(this.fullyQualifiedMapKeyClass);
+ }
+
+
+ // ********** map key class annotation **********
+
+ protected MapKeyClass2_0Annotation getMapKeyClassAnnotation() {
+ return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() {
+ return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected void removeMapKeyClassAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** map key column **********
+
+ public JavaColumn getMapKeyColumn() {
+ return this.mapKeyColumn;
+ }
+
+ protected JavaColumn buildMapKeyColumn() {
+ return this.getJpaFactory().buildJavaMapKeyColumn(this, this.buildMapKeyColumnOwner());
+ }
+
+ protected JavaColumn.Owner buildMapKeyColumnOwner() {
+ return new MapKeyColumnOwner();
+ }
+
+ protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation() {
+ return (MapKeyColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+ protected void removeMapKeyColumnAnnotation() {
+ this.getResourcePersistentAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** map key attribute override container **********
+
+ public JavaAttributeOverrideContainer getMapKeyAttributeOverrideContainer() {
+ return this.mapKeyAttributeOverrideContainer;
+ }
+
+ protected JavaAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() {
+ return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner());
+ }
+
+ protected JavaAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() {
+ return new MapKeyAttributeOverrideContainerOwner();
+ }
+
+
+ // ********** embedded mappings **********
+
+ public Iterator<String> candidateMapKeyNames() {
+ return this.allTargetEmbeddableAttributeNames();
+ }
+
+ protected Iterator<String> allTargetEmbeddableAttributeNames() {
+ return new CompositeIterator<String>(this.allTargetEmbeddableAttributeNamesLists());
+ }
+
+ /**
+ * Return a list of lists; each nested list holds the names for one of the
+ * embedded mapping's target embeddable type mapping's attribute mappings
+ * (attribute or association mappings, depending on the specified transformer).
+ */
+ protected Iterator<Iterator<String>> allTargetEmbeddableAttributeNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.allTargetEmbeddableAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<AttributeMapping> allTargetEmbeddableAttributeMappings() {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return (targetEmbeddable != null) ? targetEmbeddable.allAttributeMappings() : EmptyIterator.<AttributeMapping> instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterator<String> allMappingNames() {
+ return new CompositeIterator<String>(super.allMappingNames(), this.allEmbeddableAttributeMappingNames());
+ }
+
+ protected Iterator<String> allEmbeddableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ @Override
+ public Iterator<String> allOverridableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ @Override
+ public Iterator<String> allOverridableAssociationMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<String> qualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<String, String>(this.embeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
+ }
+
+ protected Iterator<String> embeddableOverridableMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new CompositeIterator<String>(this.embeddableOverridableMappingNamesLists(transformer));
+ }
+
+ /**
+ * Return a list of lists; each nested list holds the names for one of the
+ * embedded mapping's target embeddable type mapping's attribute mappings
+ * (attribute or association mappings, depending on the specified transformer).
+ */
+ protected Iterator<Iterator<String>> embeddableOverridableMappingNamesLists(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings(), transformer);
+ }
+
+ @Override
+ public AttributeMapping resolveAttributeMapping(String attributeName) {
+ AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ // recurse into the embeddable mappings
+ for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) {
+ resolvedMapping = mapping.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ }
+ return null;
+ }
+
+ protected Iterator<AttributeMapping> embeddableAttributeMappings() {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return ((targetEmbeddable != null) && (targetEmbeddable != this.getTypeMapping())) ?
+ targetEmbeddable.attributeMappings() :
+ EmptyIterator.<AttributeMapping>instance();
+ }
+
+ @Override
+ public Column resolveOverriddenColumn(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AttributeOverride override = this.valueAttributeOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName);
+ }
+
+ protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenColumn(attributeName);
+ }
+
+ @Override
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AssociationOverride override = this.valueAssociationOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getRelationship() : this.resolveRelationshipInTargetEmbeddable(attributeName);
+ }
+
+ protected Relationship resolveRelationshipInTargetEmbeddable(String attributeName) {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenRelationship(attributeName);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ protected JpaFactory2_0 getJpaFactory() {
+ return (JpaFactory2_0) super.getJpaFactory();
+ }
+
+ public String getKey() {
+ return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return ElementCollection2_0Annotation.ANNOTATION_NAME;
+ }
+
+ public Entity getEntity() {
+ TypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.collectionTable.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.valueColumn.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.converter.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.orderable.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.valueAttributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.valueAssociationOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.mapKeyNameTouches(pos, astRoot)) {
+ return this.javaCandidateMapKeyNames(filter);
+ }
+ result = this.mapKeyColumn.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.mapKeyAttributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+ protected Iterator<String> javaCandidateMapKeyNames(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(this.candidateMapKeyNames(filter));
+ }
+
+ protected Iterator<String> candidateMapKeyNames(Filter<String> filter) {
+ return new FilteringIterator<String>(this.candidateMapKeyNames(), filter);
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ protected String getMetamodelFieldTypeName() {
+ return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName();
+ }
+
+ @Override
+ public String getMetamodelTypeName() {
+ return (this.fullyQualifiedTargetClass != null) ? this.fullyQualifiedTargetClass : MetamodelField.DEFAULT_TYPE_NAME;
+ }
+
+ @Override
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames);
+ super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ }
+
+ protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) {
+ String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName();
+ if (keyTypeName != null) {
+ typeArgumentNames.add(keyTypeName);
+ }
+ }
+
+ public String getMetamodelFieldMapKeyTypeName() {
+ return MappingTools.getMetamodelFieldMapKeyTypeName(this);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateTargetClass(messages, astRoot);
+ this.validateMapKeyClass(messages, astRoot);
+ this.orderable.validate(messages, reporter, astRoot);
+ this.collectionTable.validate(messages, reporter, astRoot);
+ this.validateValue(messages, reporter, astRoot);
+ this.validateMapKey(messages, reporter, astRoot);
+ }
+
+ protected void validateTargetClass(List<IMessage> messages, CompilationUnit astRoot) {
+ if (this.getTargetClass() == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED,
+ EMPTY_STRING_ARRAY,
+ this,
+ this.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ //TODO this does not give an error for unmapped, unlisted types that aren't basic - bug 310464
+ if (this.getResolvedTargetType() != null) {
+ if (this.getResolvedTargetEmbeddable() == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE,
+ new String[] {this.getTargetClass()},
+ this,
+ this.getTargetClassTextRange(astRoot)
+ )
+ );
+ }
+ }
+ }
+
+ protected TextRange getTargetClassTextRange(CompilationUnit astRoot) {
+ ElementCollection2_0Annotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : this.getTextRange(annotation.getTargetClassTextRange(astRoot), astRoot);
+ }
+
+ protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) {
+ return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
+ }
+
+ protected void validateMapKeyClass(List<IMessage> messages, CompilationUnit astRoot) {
+ if (this.getPersistentAttribute().getJpaContainerDefinition().isMap()) {
+ this.validateMapKeyClass_(messages, astRoot);
+ }
+ }
+
+ protected void validateMapKeyClass_(List<IMessage> messages, CompilationUnit astRoot) {
+ if (this.getMapKeyClass() == null) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED,
+ EMPTY_STRING_ARRAY,
+ this,
+ this.getValidationTextRange(astRoot)
+ )
+ );
+ }
+ }
+
+ protected void validateValue(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ //TODO should we handle validation when the type is embeddable,
+ //but a value column is specified, or things like that if that is invalid?
+ switch (this.valueType) {
+ case BASIC_TYPE :
+ this.valueColumn.validate(messages, reporter, astRoot);
+ this.converter.validate(messages, reporter, astRoot);
+ break;
+ case EMBEDDABLE_TYPE :
+ this.valueAttributeOverrideContainer.validate(messages, reporter, astRoot);
+ this.valueAssociationOverrideContainer.validate(messages, reporter, astRoot);
+ break;
+ default :
+ break;
+ }
+ }
+
+ protected void validateMapKey(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ if (this.getMapKey() == null) {
+ this.validateMapKey_(messages, reporter, astRoot);
+ } else {
+ //TODO validate that the map key refers to an existing attribute
+ }
+ }
+
+ protected void validateMapKey_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ switch (this.keyType) {
+ case BASIC_TYPE :
+ this.mapKeyColumn.validate(messages, reporter, astRoot);
+ //validate map key converter
+ break;
+ case ENTITY_TYPE :
+ //validate map key join columns
+ break;
+ case EMBEDDABLE_TYPE :
+ this.mapKeyAttributeOverrideContainer.validate(messages, reporter, astRoot);
+ //validate map key association overrides
+ break;
+ default :
+ break;
+ }
+ }
+
+
+ // ********** abstract owner **********
+
+ /**
+ * the various (column and override) owners have lots of common
+ * interactions with the mapping
+ */
+ protected abstract class AbstractOwner
+ {
+ public JavaResourcePersistentMember getResourcePersistentMember() {
+ return AbstractJavaElementCollectionMapping2_0.this.getResourcePersistentAttribute();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return AbstractJavaElementCollectionMapping2_0.this.getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ return this.getCollectionTable().getName();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ JavaCollectionTable2_0 table = this.getCollectionTable();
+ return Tools.valuesAreEqual(table.getName(), tableName) ? table.getDbTable() : null;
+ }
+
+ public java.util.Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ /**
+ * If there is a specified table name it needs to be the same
+ * the default table name. the table is always the collection table
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return AbstractJavaElementCollectionMapping2_0.this.getValidationTextRange(astRoot);
+ }
+
+ protected String getMappingName() {
+ return AbstractJavaElementCollectionMapping2_0.this.getName();
+ }
+
+ protected JavaCollectionTable2_0 getCollectionTable() {
+ return AbstractJavaElementCollectionMapping2_0.this.getCollectionTable();
+ }
+ }
+
+
+ // ********** value column owner **********
+
+ protected class ValueColumnOwner
+ extends AbstractOwner
+ implements JavaColumn.Owner
+ {
+ public CompleteColumnAnnotation getColumnAnnotation() {
+ return AbstractJavaElementCollectionMapping2_0.this.getValueColumnAnnotation();
+ }
+
+ public void removeColumnAnnotation() {
+ AbstractJavaElementCollectionMapping2_0.this.removeValueColumnAnnotation();
+ }
+
+ public String getDefaultColumnName() {
+ return this.getMappingName();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+
+
+ // ********** map key column owner **********
+
+ protected class MapKeyColumnOwner
+ extends AbstractOwner
+ implements JavaColumn.Owner
+ {
+ public MapKeyColumn2_0Annotation getColumnAnnotation() {
+ return AbstractJavaElementCollectionMapping2_0.this.getMapKeyColumnAnnotation();
+ }
+
+ public void removeColumnAnnotation() {
+ AbstractJavaElementCollectionMapping2_0.this.removeMapKeyColumnAnnotation();
+ }
+
+ public String getDefaultColumnName() {
+ return this.getMappingName() + "_KEY"; //$NON-NLS-1$
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+
+
+ // ********** value override container owner **********
+
+ protected abstract class ValueOverrideContainerOwner
+ extends AbstractOwner
+ {
+ protected static final String POSSIBLE_PREFIX = "value"; //$NON-NLS-1$
+
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractJavaElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public String getPossiblePrefix() {
+ return POSSIBLE_PREFIX;
+ }
+
+ public String getWritePrefix() {
+ return this.getPersistentAttribute().getJpaContainerDefinition().isMap() ? this.getPossiblePrefix() : null;
+ }
+
+ //return false if the override is prefixed with "key.", these will be part of the MapKeyAttributeOverrideContainer.
+ //a prefix of "value." or no prefix at all is relevant. If the type is not a Map then return true since all attribute overrides
+ //need to apply to the value.
+ public boolean isRelevant(String overrideName) {
+ if (AbstractJavaElementCollectionMapping2_0.this.getKeyType() != Type.EMBEDDABLE_TYPE) {
+ return true;
+ }
+ return ! overrideName.startsWith(MapKeyAttributeOverrideContainerOwner.RELEVANT_PREFIX_);
+ }
+
+ protected JavaPersistentAttribute getPersistentAttribute() {
+ return AbstractJavaElementCollectionMapping2_0.this.getPersistentAttribute();
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+ }
+
+
+ // ********** value attribute override container owner **********
+
+ protected class ValueAttributeOverrideContainerOwner
+ extends ValueOverrideContainerOwner
+ implements JavaAttributeOverrideContainer.Owner
+ {
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.<String>instance();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ @Override
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ @Override
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+
+
+ // ********** value association override container owner **********
+
+ protected class ValueAssociationOverrideContainerOwner
+ extends ValueOverrideContainerOwner
+ implements JavaAssociationOverrideContainer.Owner
+ {
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.<String>instance();
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ @Override
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ @Override
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+
+ @Override
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+
+ @Override
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+
+ @Override
+ public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+ }
+
+
+ // ********** map key attribute override container owner **********
+
+ protected class MapKeyAttributeOverrideContainerOwner
+ extends AbstractOwner
+ implements JavaAttributeOverrideContainer.Owner
+ {
+ protected static final String POSSIBLE_PREFIX = "key"; //$NON-NLS-1$
+ protected static final String RELEVANT_PREFIX_ = "key."; //$NON-NLS-1$
+
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractJavaElementCollectionMapping2_0.this.getResolvedMapKeyEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.<String>instance();
+ }
+
+ public String getPossiblePrefix() {
+ return POSSIBLE_PREFIX;
+ }
+
+ public String getWritePrefix() {
+ return this.getPossiblePrefix();
+ }
+
+ // the only relevant overrides are those that start with "key.";
+ // no prefix will be a value attribute override
+ public boolean isRelevant(String overrideName) {
+ if (AbstractJavaElementCollectionMapping2_0.this.getValueType() != Type.EMBEDDABLE_TYPE) {
+ return true;
+ }
+ return overrideName.startsWith(RELEVANT_PREFIX_);
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java
new file mode 100644
index 0000000000..afa599982c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+public abstract class AbstractJavaElementCollectionMappingDefinition2_0
+ implements JavaAttributeMappingDefinition
+{
+ protected AbstractJavaElementCollectionMappingDefinition2_0() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return ElementCollection2_0Annotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ AssociationOverrideAnnotation.ANNOTATION_NAME,
+ AssociationOverridesAnnotation.ANNOTATION_NAME,
+ AttributeOverrideAnnotation.ANNOTATION_NAME,
+ AttributeOverridesAnnotation.ANNOTATION_NAME,
+ CollectionTable2_0Annotation.ANNOTATION_NAME,
+ ColumnAnnotation.ANNOTATION_NAME,
+ EnumeratedAnnotation.ANNOTATION_NAME,
+ LobAnnotation.ANNOTATION_NAME,
+ MapKeyAnnotation.ANNOTATION_NAME,
+ MapKeyClass2_0Annotation.ANNOTATION_NAME,
+ MapKeyColumn2_0Annotation.ANNOTATION_NAME,
+ MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
+ MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
+ MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME,
+ MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
+ OrderByAnnotation.ANNOTATION_NAME,
+ OrderColumn2_0Annotation.ANNOTATION_NAME,
+ TemporalAnnotation.ANNOTATION_NAME
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return ((JpaFactory2_0) factory).buildJavaElementCollectionMapping2_0(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java
new file mode 100644
index 0000000000..72615562d6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaIdMappingDefinition;
+
+/**
+ * JPA 2.0 Id mapping
+ */
+public abstract class AbstractJavaIdMappingDefinition2_0
+ extends AbstractJavaIdMappingDefinition
+{
+ protected AbstractJavaIdMappingDefinition2_0() {
+ super();
+ }
+
+ /**
+ * Return the annotation only if it is not "derived".
+ */
+ @Override
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ boolean idSpecified = super.isSpecified(persistentAttribute);
+ return idSpecified && ! this.isDerivedId(persistentAttribute);
+ }
+
+ /**
+ * Return whether the specified attribute's <code>Id</code> annotation is
+ * a supporting annotation for M-1 or 1-1 mapping, as opposed to a primary
+ * mapping annotation.
+ * <p>
+ * This might produce confusing behavior if the annotations look something
+ * like:<pre>
+ * @Id @Basic @ManyToOne private int foo;
+ * </pre>
+ */
+ protected boolean isDerivedId(JavaPersistentAttribute persistentAttribute) {
+ return this.attributeHasManyToOneMapping(persistentAttribute) ||
+ this.attributeHasOneToOneMapping(persistentAttribute);
+ }
+
+ protected boolean attributeHasManyToOneMapping(JavaPersistentAttribute persistentAttribute) {
+ return JavaManyToOneMappingDefinition2_0.instance().isSpecified(persistentAttribute);
+ }
+
+ protected boolean attributeHasOneToOneMapping(JavaPersistentAttribute persistentAttribute) {
+ return JavaOneToOneMappingDefinition2_0.instance().isSpecified(persistentAttribute);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
new file mode 100644
index 0000000000..0220fc6606
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java cacheable
+ */
+public class GenericJavaCacheable2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaCacheable2_0
+{
+ protected Boolean specifiedCacheable;
+ protected boolean defaultCacheable;
+
+
+ public GenericJavaCacheable2_0(JavaCacheableHolder2_0 parent) {
+ super(parent);
+ this.specifiedCacheable = this.buildSpecifiedCacheable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedCacheable_(this.buildSpecifiedCacheable());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultCacheable(this.buildDefaultCacheable());
+ }
+
+
+ // ********** cacheable **********
+
+ public boolean isCacheable() {
+ return (this.specifiedCacheable != null) ? this.specifiedCacheable.booleanValue() : this.defaultCacheable;
+ }
+
+ public Boolean getSpecifiedCacheable() {
+ return this.specifiedCacheable;
+ }
+
+ public void setSpecifiedCacheable(Boolean cacheable) {
+ if (this.valuesAreDifferent(cacheable, this.specifiedCacheable)) {
+ if (cacheable == null) {
+ this.removeCacheableAnnotation();
+ } else {
+ Cacheable2_0Annotation annotation = this.getCacheableAnnotationForUpdate();
+ Boolean value = annotation.getValue();
+ if (cacheable.booleanValue()) {
+ if ((value != null) && ! value.booleanValue()) { // @Cacheable(false)
+ annotation.setValue(null); // set to @Cacheable
+ }
+ } else {
+ annotation.setValue(Boolean.FALSE);
+ }
+ }
+
+ this.setSpecifiedCacheable_(cacheable);
+ }
+ }
+
+ protected void setSpecifiedCacheable_(Boolean cacheable) {
+ Boolean old = this.specifiedCacheable;
+ this.specifiedCacheable = cacheable;
+ this.firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, old, cacheable);
+ }
+
+ private Boolean buildSpecifiedCacheable() {
+ Cacheable2_0Annotation annotation = this.getCacheableAnnotation();
+ if (annotation == null) {
+ return null;
+ }
+ Boolean value = annotation.getValue();
+ // @Cacheable is equivalent to @Cacheable(true)
+ return (value != null) ? value : Boolean.TRUE;
+ }
+
+ public boolean isDefaultCacheable() {
+ return this.defaultCacheable;
+ }
+
+ protected void setDefaultCacheable(boolean cacheable) {
+ boolean old = this.defaultCacheable;
+ this.defaultCacheable = cacheable;
+ this.firePropertyChanged(DEFAULT_CACHEABLE_PROPERTY, old, cacheable);
+ }
+
+ protected boolean buildDefaultCacheable() {
+ return this.getCacheableHolder().calculateDefaultCacheable();
+ }
+
+
+ // ********** cacheable annotation **********
+
+ /**
+ * Return <code>null</code> if the annotation does not exists.
+ */
+ protected Cacheable2_0Annotation getCacheableAnnotation() {
+ return (Cacheable2_0Annotation) this.getResourcePersistentType().getAnnotation(this.getCacheableAnnotationName());
+ }
+
+ /**
+ * Build the annotation if it does not exist.
+ */
+ protected Cacheable2_0Annotation getCacheableAnnotationForUpdate() {
+ Cacheable2_0Annotation annotation = this.getCacheableAnnotation();
+ return (annotation != null) ? annotation : this.buildCacheableAnnotation();
+ }
+
+ protected Cacheable2_0Annotation buildCacheableAnnotation() {
+ return (Cacheable2_0Annotation) this.getResourcePersistentType().addAnnotation(this.getCacheableAnnotationName());
+ }
+
+ protected void removeCacheableAnnotation() {
+ this.getResourcePersistentType().removeAnnotation(this.getCacheableAnnotationName());
+ }
+
+ protected String getCacheableAnnotationName() {
+ return Cacheable2_0Annotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaCacheableHolder2_0 getParent() {
+ return (JavaCacheableHolder2_0) super.getParent();
+ }
+
+ protected JavaCacheableHolder2_0 getCacheableHolder() {
+ return this.getParent();
+ }
+
+ protected JavaResourcePersistentType getResourcePersistentType() {
+ return this.getCacheableHolder().getResourcePersistentType();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ Cacheable2_0Annotation annotation = this.getCacheableAnnotation();
+ return (annotation == null) ? null : annotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
new file mode 100644
index 0000000000..2efb54baa2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaReferenceTable;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
+
+/**
+ * Java collection table
+ */
+public class GenericJavaCollectionTable2_0
+ extends GenericJavaReferenceTable<CollectionTable2_0Annotation>
+ implements JavaCollectionTable2_0
+{
+ public GenericJavaCollectionTable2_0(JavaElementCollectionMapping2_0 parent, Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ protected JavaJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+
+ // ********** table annotation **********
+
+ @Override
+ public CollectionTable2_0Annotation getTableAnnotation() {
+ return (CollectionTable2_0Annotation) this.getElementCollectionMapping().getResourcePersistentAttribute().getNonNullAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ protected void removeTableAnnotation() {
+ this.getElementCollectionMapping().getResourcePersistentAttribute().removeAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** misc **********
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getElementCollectionMapping().getPersistentAttribute();
+ }
+
+ @Override
+ public JavaElementCollectionMapping2_0 getParent() {
+ return (JavaElementCollectionMapping2_0) super.getParent();
+ }
+
+ protected JavaElementCollectionMapping2_0 getElementCollectionMapping() {
+ return this.getParent();
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return MappingTools.buildCollectionTableDefaultName(this.getElementCollectionMapping());
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.getElementCollectionMapping().validatesAgainstDatabase();
+ }
+
+
+ // ********** join column owner **********
+
+ /**
+ * owner for "back-pointer" join columns;
+ * these point at the source/owning entity
+ */
+ protected class JoinColumnOwner
+ implements JavaJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getTypeMapping();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return Tools.valuesAreEqual(GenericJavaCollectionTable2_0.this.getName(), tableName) ?
+ GenericJavaCollectionTable2_0.this.getDbTable() :
+ null;
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ /**
+ * by default, the join column is, obviously, in the collection table;
+ * not sure whether it can be anywhere else...
+ */
+ public String getDefaultTableName() {
+ return GenericJavaCollectionTable2_0.this.getName();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return GenericJavaCollectionTable2_0.this.getValidationTextRange(astRoot);
+ }
+
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ return this.getTypeMapping().getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericJavaCollectionTable2_0.this.getDefaultJoinColumn() == joinColumn;
+ }
+
+ /**
+ * If there is a specified table name it needs to be the same
+ * the default table name. The table is always the collection table.
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return ! StringTools.stringsAreEqual(this.getDefaultTableName(), tableName);
+ }
+
+ /**
+ * the join column can only be on the collection table itself
+ */
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Entity getRelationshipTarget() {
+ return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getEntity();
+ }
+
+ public String getAttributeName() {
+ return null; //I *think* this is correct
+ //return GenericJavaCollectionTable2_0.this.getParent().getName();
+ }
+
+ public PersistentAttribute getPersistentAttribute() {
+ return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getPersistentAttribute();
+ }
+
+ public int joinColumnsSize() {
+ return GenericJavaCollectionTable2_0.this.joinColumnsSize();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
new file mode 100644
index 0000000000..0816a1f901
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaDerivedIdentity2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaDerivedIdentity2_0
+{
+ protected DerivedIdentityStrategy2_0 strategy;
+
+ protected final JavaIdDerivedIdentityStrategy2_0 idStrategy;
+
+ protected final JavaMapsIdDerivedIdentityStrategy2_0 mapsIdStrategy;
+
+
+ public GenericJavaDerivedIdentity2_0(JavaSingleRelationshipMapping2_0 parent) {
+ super(parent);
+ this.idStrategy = this.buildIdStrategy();
+ this.mapsIdStrategy = this.buildMapsIdStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.idStrategy.synchronizeWithResourceModel();
+ this.mapsIdStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.idStrategy.update();
+ this.mapsIdStrategy.update();
+ this.updateStrategy();
+ }
+
+
+ // ********** predominant strategy **********
+
+ public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(DerivedIdentityStrategy2_0 strategy) {
+ DerivedIdentityStrategy2_0 old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected void updateStrategy() {
+ this.setStrategy(this.buildStrategy());
+ }
+
+ protected DerivedIdentityStrategy2_0 buildStrategy() {
+ if (this.mapsIdStrategy.isSpecified()) {
+ return this.mapsIdStrategy;
+ }
+ if (this.idStrategy.isSpecified()) {
+ return this.idStrategy;
+ }
+ return null;
+ }
+
+
+ // ********** null strategy **********
+
+ public boolean usesNullDerivedIdentityStrategy() {
+ return this.strategy == null;
+ }
+
+ public void setNullDerivedIdentityStrategy() {
+ this.mapsIdStrategy.removeStrategy();
+ this.idStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+
+ // ********** ID strategy **********
+
+ public JavaIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() {
+ return this.idStrategy;
+ }
+
+ public void setIdDerivedIdentityStrategy() {
+ this.idStrategy.addStrategy();
+ this.mapsIdStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public void unsetIdDerivedIdentityStrategy() {
+ this.idStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean usesIdDerivedIdentityStrategy() {
+ return this.strategy == this.idStrategy;
+ }
+
+ protected JavaIdDerivedIdentityStrategy2_0 buildIdStrategy() {
+ return new GenericJavaIdDerivedIdentityStrategy2_0(this);
+ }
+
+
+ // ********** maps ID strategy **********
+
+ public JavaMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() {
+ return this.mapsIdStrategy;
+ }
+
+ public void setMapsIdDerivedIdentityStrategy() {
+ this.mapsIdStrategy.addStrategy();
+ this.idStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public void unsetMapsIdDerivedIdentityStrategy() {
+ this.mapsIdStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean usesMapsIdDerivedIdentityStrategy() {
+ return this.strategy == this.mapsIdStrategy;
+ }
+
+ protected JavaMapsIdDerivedIdentityStrategy2_0 buildMapsIdStrategy() {
+ return new GenericJavaMapsIdDerivedIdentityStrategy2_0(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaSingleRelationshipMapping2_0 getParent() {
+ return (JavaSingleRelationshipMapping2_0) super.getParent();
+ }
+
+ public JavaSingleRelationshipMapping2_0 getMapping() {
+ return this.getParent();
+ }
+
+
+ // ********** java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.mapsIdStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.idStrategy.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.idStrategy.validate(messages, reporter, astRoot);
+ this.mapsIdStrategy.validate(messages, reporter, astRoot);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getMapping().getValidationTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
new file mode 100644
index 0000000000..acaed18545
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+
+public class GenericJavaElementCollectionMapping2_0
+ extends AbstractJavaElementCollectionMapping2_0
+{
+ public GenericJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java
new file mode 100644
index 0000000000..2635174885
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddable;
+import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+
+/**
+ * JPA 2.0
+ * Java embeddable type mapping
+ */
+public class GenericJavaEmbeddable2_0
+ extends AbstractJavaEmbeddable
+{
+ public GenericJavaEmbeddable2_0(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ }
+
+ @Override
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
+ }
+
+ public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS =
+ new String[] {
+ MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..9f5ec69202
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaIdDerivedIdentityStrategy2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaIdDerivedIdentityStrategy2_0
+{
+ protected boolean value;
+
+
+ public GenericJavaIdDerivedIdentityStrategy2_0(JavaDerivedIdentity2_0 parent) {
+ super(parent);
+ this.value = this.buildValue();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** value **********
+
+ public boolean getValue() {
+ return this.value;
+ }
+
+ public void setValue(boolean value) {
+ if (value != this.value) {
+ if (value) {
+ this.addAnnotation();
+ } else {
+ this.removeAnnotation();
+ }
+ this.setValue_(value);
+ }
+ }
+
+ protected void setValue_(boolean value) {
+ boolean old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ protected boolean buildValue() {
+ return this.getAnnotation() != null;
+ }
+
+
+ // ********** annotation **********
+
+ protected IdAnnotation getAnnotation() {
+ return (IdAnnotation) this.getResourceAttribute().getAnnotation(this.getAnnotationName());
+ }
+
+ protected void addAnnotation() {
+ this.getResourceAttribute().addAnnotation(this.getAnnotationName());
+ }
+
+ protected void removeAnnotation() {
+ this.getResourceAttribute().removeAnnotation(this.getAnnotationName());
+ }
+
+ protected String getAnnotationName() {
+ return IdAnnotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaDerivedIdentity2_0 getParent() {
+ return (JavaDerivedIdentity2_0) super.getParent();
+ }
+
+ protected JavaDerivedIdentity2_0 getDerivedIdentity() {
+ return this.getParent();
+ }
+
+ protected JavaSingleRelationshipMapping2_0 getMapping() {
+ return this.getDerivedIdentity().getMapping();
+ }
+
+ protected JavaResourcePersistentAttribute getResourceAttribute() {
+ return this.getMapping().getPersistentAttribute().getResourcePersistentAttribute();
+ }
+
+ public boolean isSpecified() {
+ return this.value;
+ }
+
+ public void addStrategy() {
+ this.setValue(true);
+ }
+
+ public void removeStrategy() {
+ this.setValue(false);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ // no validation rules
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ IdAnnotation annotation = this.getAnnotation();
+ return (annotation == null) ? null : annotation.getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..df745d2cca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericJavaMapsIdDerivedIdentityStrategy2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaMapsIdDerivedIdentityStrategy2_0
+{
+ protected String specifiedValue;
+ protected String defaultValue;
+
+
+ public GenericJavaMapsIdDerivedIdentityStrategy2_0(JavaDerivedIdentity2_0 parent) {
+ super(parent);
+ this.specifiedValue = this.buildSpecifiedValue();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedValue_(this.buildSpecifiedValue());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultValue(this.buildDefaultValue());
+ }
+
+
+ // ********** value **********
+
+ public String getValue() {
+ return (this.specifiedValue != null) ? this.specifiedValue : this.defaultValue;
+ }
+
+ public String getSpecifiedValue() {
+ return this.specifiedValue;
+ }
+
+ public void setSpecifiedValue(String value) {
+ if (this.valuesAreDifferent(value, this.specifiedValue)) {
+ this.getAnnotation().setValue(value);
+ this.setSpecifiedValue_(value);
+ }
+ }
+
+ protected void setSpecifiedValue_(String value) {
+ String old = this.specifiedValue;
+ this.specifiedValue = value;
+ this.firePropertyChanged(SPECIFIED_VALUE_PROPERTY, old, value);
+ }
+
+ protected String buildSpecifiedValue() {
+ return this.getAnnotation().getValue();
+ }
+
+ public String getDefaultValue() {
+ return this.defaultValue;
+ }
+
+ protected void setDefaultValue(String value) {
+ String old = this.defaultValue;
+ this.defaultValue = value;
+ this.firePropertyChanged(SPECIFIED_VALUE_PROPERTY, old, value);
+ }
+
+ protected String buildDefaultValue() {
+ Iterator<AttributeMapping> stream = this.getIdAttributeMappings().iterator();
+ if (stream.hasNext()) {
+ AttributeMapping mapping = stream.next();
+ // return null if we have more than one id mapping
+ return stream.hasNext() ? null : mapping.getName();
+ }
+ return null; // empty
+ }
+
+ public boolean usesDefaultValue() {
+ return true;
+ }
+
+
+ // ********** annotation **********
+
+ /**
+ * Do <em>not</em> return <code>null</code>.
+ */
+ protected MapsId2_0Annotation getAnnotation() {
+ return (MapsId2_0Annotation) this.getResourceAttribute().getNonNullAnnotation(this.getAnnotationName());
+ }
+
+ /**
+ * Return <code>null</code> if the annotation is not present.
+ */
+ protected MapsId2_0Annotation getAnnotationOrNull() {
+ return (MapsId2_0Annotation) this.getResourceAttribute().getAnnotation(this.getAnnotationName());
+ }
+
+ protected void addAnnotation() {
+ this.getResourceAttribute().addAnnotation(this.getAnnotationName());
+ }
+
+ protected void removeAnnotation() {
+ this.getResourceAttribute().removeAnnotation(this.getAnnotationName());
+ }
+
+ protected String getAnnotationName() {
+ return MapsId2_0Annotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaDerivedIdentity2_0 getParent() {
+ return (JavaDerivedIdentity2_0) super.getParent();
+ }
+
+ protected JavaDerivedIdentity2_0 getDerivedIdentity() {
+ return this.getParent();
+ }
+
+ protected JavaSingleRelationshipMapping2_0 getMapping() {
+ return this.getDerivedIdentity().getMapping();
+ }
+
+ protected JavaPersistentAttribute getPersistentAttribute() {
+ return this.getMapping().getPersistentAttribute();
+ }
+
+ protected JavaResourcePersistentAttribute getResourceAttribute() {
+ return this.getPersistentAttribute().getResourcePersistentAttribute();
+ }
+
+ protected Iterable<AttributeMapping> getAllAttributeMappings() {
+ return CollectionTools.collection(this.getPersistentAttribute().getOwningTypeMapping().allAttributeMappings());
+ }
+
+ public Iterable<String> getSortedValueChoices() {
+ return CollectionTools.sort(this.getAllAttributeMappingChoiceNames());
+ }
+
+ protected Iterable<String> getAllAttributeMappingChoiceNames() {
+ return new TransformationIterable<AttributeMapping, String>(this.getAllAttributeMappingChoices()) {
+ @Override
+ protected String transform(AttributeMapping mapping) {
+ return mapping.getName();
+ }
+ };
+ }
+
+ protected Iterable<AttributeMapping> getAllAttributeMappingChoices() {
+ return this.buildAttributeMappingChoices(this.getAllAttributeMappings());
+ }
+
+ protected Iterable<AttributeMapping> buildAttributeMappingChoices(Iterable<AttributeMapping> attributeMappings) {
+ return new CompositeIterable<AttributeMapping>(this.getAttributeMappingChoiceIterables(attributeMappings));
+ }
+
+ /**
+ * @see #getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping)
+ */
+ protected Iterable<Iterable<AttributeMapping>> getAttributeMappingChoiceIterables(Iterable<AttributeMapping> availableMappings) {
+ return new TransformationIterable<AttributeMapping, Iterable<AttributeMapping>>(availableMappings) {
+ @Override
+ protected Iterable<AttributeMapping> transform(AttributeMapping mapping) {
+ if (Tools.valuesAreEqual(mapping.getKey(), MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)) {
+ return GenericJavaMapsIdDerivedIdentityStrategy2_0.this.getEmbeddedIdMappingChoiceIterable((EmbeddedIdMapping) mapping);
+ }
+ return new SingleElementIterable<AttributeMapping>(mapping);
+ }
+ };
+ }
+
+ /**
+ * Convert the specified mapping into a collection of its "mappings".
+ * Typically, this collection will include just the mapping itself;
+ * but, if the mapping is an embedded ID, this collection will include
+ * the mapping itself plus all the mappings of its target embeddable.
+ */
+ protected Iterable<AttributeMapping> getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping mapping) {
+ Embeddable embeddable = mapping.getTargetEmbeddable();
+ if (embeddable == null) {
+ return new SingleElementIterable<AttributeMapping>(mapping);
+ }
+ return new CompositeIterable<AttributeMapping>(
+ mapping,
+ CollectionTools.collection(embeddable.allAttributeMappings())
+ );
+ }
+
+ public AttributeMapping getResolvedAttributeMappingValue() {
+ String value = this.getValue();
+ if (value != null) {
+ for (AttributeMapping mapping : this.getAllAttributeMappingChoices()) {
+ if (value.equals(mapping.getName())) {
+ return mapping;
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isSpecified() {
+ return this.getAnnotationOrNull() != null;
+ }
+
+ public void addStrategy() {
+ if (this.getAnnotationOrNull() == null) {
+ this.addAnnotation();
+ }
+ }
+
+ public void removeStrategy() {
+ if (this.getAnnotationOrNull() != null) {
+ this.removeAnnotation();
+ }
+ }
+
+
+ // ********** Java completion proposals **********
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.getAnnotation().valueTouches(pos, astRoot)) {
+ result = this.sortedJavaValueChoices(filter);
+ }
+ return result;
+ }
+
+ protected Iterator<String> sortedJavaValueChoices(Filter<String> filter) {
+ return StringTools.convertToJavaStringLiterals(new FilteringIterator<String>(this.getSortedValueChoices(), filter));
+ }
+
+
+ // ********** ID mappings **********
+
+ protected Iterable<AttributeMapping> getIdAttributeMappings() {
+ return new FilteringIterable<AttributeMapping>(this.getAllAttributeMappings()) {
+ @Override
+ protected boolean accept(AttributeMapping mapping) {
+ return GenericJavaMapsIdDerivedIdentityStrategy2_0.this.mappingIsIdMapping(mapping);
+ }
+ };
+ }
+
+ protected boolean mappingIsIdMapping(AttributeMapping mapping) {
+ return CollectionTools.contains(this.getIdMappingKeys(), mapping.getKey());
+ }
+
+ protected Iterable<String> getIdMappingKeys() {
+ return ID_MAPPING_KEYS;
+ }
+
+ protected static final String[] ID_MAPPING_KEYS_ARRAY = new String[] {
+ MappingKeys.ID_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY
+ };
+
+ protected static final Iterable<String> ID_MAPPING_KEYS = new ArrayIterable<String>(ID_MAPPING_KEYS_ARRAY);
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateMapsId(messages, astRoot);
+ }
+
+ protected void validateMapsId(List<IMessage> messages, CompilationUnit astRoot) {
+ if (this.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy()) {
+ this.validateMapsId_(messages, astRoot);
+ }
+ }
+
+ protected void validateMapsId_(List<IMessage> messages, CompilationUnit astRoot) {
+ // test whether value can be resolved
+ AttributeMapping attributeMapping = this.getResolvedAttributeMappingValue();
+ if (attributeMapping == null) {
+ // if value is not specified, use that message
+ if (this.specifiedValue == null) {
+ messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_NOT_SPECIFIED, EMPTY_STRING_ARRAY, astRoot));
+ } else {
+ messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_NOT_RESOLVED, new String[] {this.getValue()}, astRoot));
+ }
+ } else {
+ // test whether attribute mapping is allowable
+ if ( ! CollectionTools.contains(this.getValidAttributeMappingChoices(), attributeMapping)) {
+ messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_INVALID, new String[] {this.getValue()}, astRoot));
+ }
+ }
+ }
+
+ protected Iterable<AttributeMapping> getValidAttributeMappingChoices() {
+ return this.buildAttributeMappingChoices(this.getIdAttributeMappings());
+ }
+
+ protected IMessage buildMessage(String msgID, String[] parms, CompilationUnit astRoot) {
+ String attributeDescription = NLS.bind(JpaValidationDescriptionMessages.ATTRIBUTE_DESC, this.getPersistentAttribute().getName());
+ parms = ArrayTools.add(parms, 0, attributeDescription);
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ parms,
+ this,
+ this.getValidationTextRange(astRoot)
+ );
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getAnnotation().getTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
new file mode 100644
index 0000000000..5b168c306e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
+import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaNamedQuery2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
+
+/**
+ * JPA 2.0
+ * Java named query
+ */
+public class GenericJavaNamedQuery2_0
+ extends AbstractJavaQuery<NamedQuery2_0Annotation>
+ implements JavaNamedQuery2_0
+{
+ protected LockModeType2_0 specifiedLockMode;
+ protected LockModeType2_0 defaultLockMode;
+
+
+ public GenericJavaNamedQuery2_0(JavaJpaContextNode parent, NamedQuery2_0Annotation queryAnnotation) {
+ super(parent, queryAnnotation);
+ this.specifiedLockMode = this.buildSpecifiedLockMode();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedLockMode_(this.buildSpecifiedLockMode());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultLockMode(this.buildDefaultLockMode());
+ }
+
+
+ // ********** lock mode **********
+
+ public LockModeType2_0 getLockMode() {
+ return (this.specifiedLockMode != null) ? this.specifiedLockMode : this.defaultLockMode;
+ }
+
+ public LockModeType2_0 getSpecifiedLockMode() {
+ return this.specifiedLockMode;
+ }
+
+ public void setSpecifiedLockMode(LockModeType2_0 lockMode) {
+ this.queryAnnotation.setLockMode(LockModeType2_0.toJavaResourceModel(lockMode));
+ this.setSpecifiedLockMode_(lockMode);
+ }
+
+ protected void setSpecifiedLockMode_(LockModeType2_0 lockMode) {
+ LockModeType2_0 old = this.specifiedLockMode;
+ this.specifiedLockMode = lockMode;
+ this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode);
+ }
+
+ protected LockModeType2_0 buildSpecifiedLockMode() {
+ return LockModeType2_0.fromJavaResourceModel(this.queryAnnotation.getLockMode());
+ }
+
+ public LockModeType2_0 getDefaultLockMode() {
+ return this.defaultLockMode;
+ }
+
+ protected void setDefaultLockMode(LockModeType2_0 lockMode) {
+ LockModeType2_0 old = this.defaultLockMode;
+ this.defaultLockMode = lockMode;
+ this.firePropertyChanged(DEFAULT_LOCK_MODE_PROPERTY, old, lockMode);
+ }
+
+ protected LockModeType2_0 buildDefaultLockMode() {
+ return LockModeType2_0.NONE;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
new file mode 100644
index 0000000000..3d727384a0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * Java order column
+ */
+public class GenericJavaOrderColumn2_0
+ extends AbstractJavaNamedColumn<OrderColumn2_0Annotation, JavaNamedColumn.Owner>
+ implements JavaOrderColumn2_0
+{
+ protected Boolean specifiedNullable;
+ protected boolean defaultNullable;
+
+ protected Boolean specifiedInsertable;
+ protected boolean defaultInsertable;
+
+ protected Boolean specifiedUpdatable;
+ protected boolean defaultUpdatable;
+
+ // JPA 1.0
+ protected OrderColumn2_0Annotation nullColumnAnnotation;
+
+
+ public GenericJavaOrderColumn2_0(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner) {
+ super(parent, owner);
+ this.specifiedNullable = this.buildSpecifiedNullable();
+ this.specifiedInsertable = this.buildSpecifiedInsertable();
+ this.specifiedUpdatable = this.buildSpecifiedUpdatable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedNullable_(this.buildSpecifiedNullable());
+ this.setSpecifiedInsertable_(this.buildSpecifiedInsertable());
+ this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultNullable(this.buildDefaultNullable());
+ this.setDefaultInsertable(this.buildDefaultInsertable());
+ this.setDefaultUpdatable(this.buildDefaultUpdatable());
+ }
+
+
+ // ********** column annotation **********
+
+ /**
+ * If we are in a JPA 1.0 project, return a null annotation.
+ */
+ @Override
+ public OrderColumn2_0Annotation getColumnAnnotation() {
+ // hmmmm...
+ return this.isJpa2_0Compatible() ?
+ (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME) :
+ this.getNullColumnAnnotation();
+ }
+
+ protected OrderColumn2_0Annotation getNullColumnAnnotation() {
+ if (this.nullColumnAnnotation == null) {
+ this.nullColumnAnnotation = this.buildNullColumnAnnotation();
+ }
+ return this.nullColumnAnnotation;
+ }
+
+ protected OrderColumn2_0Annotation buildNullColumnAnnotation() {
+ // hmmmm...
+ return (OrderColumn2_0Annotation) OrderColumn2_0AnnotationDefinition.instance().buildNullAnnotation(this.getResourcePersistentAttribute());
+ }
+
+ @Override
+ protected void removeColumnAnnotation() {
+ if (this.isJpa2_0Compatible()) {
+ this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+
+ // ********** nullable **********
+
+ public boolean isNullable() {
+ return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable();
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean nullable) {
+ if (this.valuesAreDifferent(this.specifiedNullable, nullable)) {
+ this.getColumnAnnotation().setNullable(nullable);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedNullable_(nullable);
+ }
+ }
+
+ protected void setSpecifiedNullable_(Boolean nullable) {
+ Boolean old = this.specifiedNullable;
+ this.specifiedNullable = nullable;
+ this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected Boolean buildSpecifiedNullable() {
+ return this.getColumnAnnotation().getNullable();
+ }
+
+ public boolean isDefaultNullable() {
+ return this.defaultNullable;
+ }
+
+ protected void setDefaultNullable(boolean nullable) {
+ boolean old = this.defaultNullable;
+ this.defaultNullable = nullable;
+ this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected boolean buildDefaultNullable() {
+ return DEFAULT_NULLABLE;
+ }
+
+
+ // ********** insertable **********
+
+ public boolean isInsertable() {
+ return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable();
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean insertable) {
+ if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) {
+ this.getColumnAnnotation().setInsertable(insertable);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedInsertable_(insertable);
+ }
+ }
+
+ protected void setSpecifiedInsertable_(Boolean insertable) {
+ Boolean old = this.specifiedInsertable;
+ this.specifiedInsertable = insertable;
+ this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected Boolean buildSpecifiedInsertable() {
+ return this.getColumnAnnotation().getInsertable();
+ }
+
+ public boolean isDefaultInsertable() {
+ return this.defaultInsertable;
+ }
+
+ protected void setDefaultInsertable(boolean insertable) {
+ boolean old = this.defaultInsertable;
+ this.defaultInsertable = insertable;
+ this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected boolean buildDefaultInsertable() {
+ return DEFAULT_INSERTABLE;
+ }
+
+
+ // ********** updatable **********
+
+ public boolean isUpdatable() {
+ return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable();
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean updatable) {
+ if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) {
+ this.getColumnAnnotation().setUpdatable(updatable);
+ this.removeColumnAnnotationIfUnset();
+ this.setSpecifiedUpdatable_(updatable);
+ }
+ }
+
+ protected void setSpecifiedUpdatable_(Boolean updatable) {
+ Boolean old = this.specifiedUpdatable;
+ this.specifiedUpdatable = updatable;
+ this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected Boolean buildSpecifiedUpdatable() {
+ return this.getColumnAnnotation().getUpdatable();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return this.defaultUpdatable;
+ }
+
+ protected void setDefaultUpdatable(boolean updatable) {
+ boolean old = this.defaultUpdatable;
+ this.defaultUpdatable = updatable;
+ this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected boolean buildDefaultUpdatable() {
+ return DEFAULT_UPDATABLE;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaOrderable2_0 getParent() {
+ return (JavaOrderable2_0) super.getParent();
+ }
+
+ protected JavaOrderable2_0 getOrderable() {
+ return this.getParent();
+ }
+
+ protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
+ return this.getOrderable().getResourcePersistentAttribute();
+ }
+
+ @Override
+ public String getTable() {
+ return this.getOrderable().getDefaultTableName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
new file mode 100644
index 0000000000..c48a4acdc5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OwningRelationshipMapping2_0Annotation;
+
+/**
+ * Java orphan removal
+ */
+public class GenericJavaOrphanRemoval2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaOrphanRemovable2_0
+{
+ protected Boolean specifiedOrphanRemoval;
+ protected boolean defaultOrphanRemoval;
+
+
+ public GenericJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) {
+ super(parent);
+ this.specifiedOrphanRemoval = this.buildSpecifiedOrphanRemoval();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedOrphanRemoval_(this.buildSpecifiedOrphanRemoval());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultOrphanRemoval(this.buildDefaultOrphanRemoval());
+ }
+
+
+ // ********** orphan removal **********
+
+ public boolean isOrphanRemoval() {
+ return (this.specifiedOrphanRemoval != null) ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval;
+ }
+
+ public Boolean getSpecifiedOrphanRemoval() {
+ return this.specifiedOrphanRemoval;
+ }
+
+ public void setSpecifiedOrphanRemoval(Boolean orphanRemoval) {
+ if (this.valuesAreDifferent(orphanRemoval, this.specifiedOrphanRemoval)) {
+ this.getMappingAnnotationForUpdate().setOrphanRemoval(orphanRemoval);
+ this.setSpecifiedOrphanRemoval_(orphanRemoval);
+ }
+ }
+
+ protected void setSpecifiedOrphanRemoval_(Boolean orphanRemoval) {
+ Boolean old = this.specifiedOrphanRemoval;
+ this.specifiedOrphanRemoval = orphanRemoval;
+ this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
+ }
+
+ protected Boolean buildSpecifiedOrphanRemoval() {
+ OwningRelationshipMapping2_0Annotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getOrphanRemoval();
+ }
+
+ public boolean isDefaultOrphanRemoval() {
+ return this.defaultOrphanRemoval;
+ }
+
+ protected void setDefaultOrphanRemoval(boolean orphanRemoval) {
+ boolean old = this.defaultOrphanRemoval;
+ this.defaultOrphanRemoval = orphanRemoval;
+ this.firePropertyChanged(DEFAULT_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
+ }
+
+ protected boolean buildDefaultOrphanRemoval() {
+ return DEFAULT_ORPHAN_REMOVAL;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaOrphanRemovalHolder2_0 getParent() {
+ return (JavaOrphanRemovalHolder2_0) super.getParent();
+ }
+
+ protected JavaAttributeMapping getMapping() {
+ return (JavaAttributeMapping) this.getParent();
+ }
+
+ protected OwningRelationshipMapping2_0Annotation getMappingAnnotation() {
+ return (OwningRelationshipMapping2_0Annotation) this.getMapping().getMappingAnnotation();
+ }
+
+ protected OwningRelationshipMapping2_0Annotation getMappingAnnotationForUpdate() {
+ return (OwningRelationshipMapping2_0Annotation) this.getMapping().getAnnotationForUpdate();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ OwningRelationshipMapping2_0Annotation annotation = this.getMappingAnnotation();
+ return (annotation == null) ? null : annotation.getOrphanRemovalTextRange(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java
new file mode 100644
index 0000000000..c484111d2d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideRelationship2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+public class GenericJavaOverrideJoinTableRelationshipStrategy2_0
+ extends AbstractJavaJoinTableRelationshipStrategy
+{
+ public GenericJavaOverrideJoinTableRelationshipStrategy2_0(JavaOverrideRelationship2_0 parent) {
+ super(parent);
+ }
+
+
+ // ********** join table annotation **********
+
+ public JoinTableAnnotation getJoinTableAnnotation() {
+ return this.getOverrideAnnotation().getNonNullJoinTable();
+ }
+
+ @Override
+ protected JoinTableAnnotation addJoinTableAnnotation() {
+ return this.getOverrideAnnotation().addJoinTable();
+ }
+
+ @Override
+ protected void removeJoinTableAnnotation() {
+ this.getOverrideAnnotation().removeJoinTable();
+ }
+
+ protected AssociationOverride2_0Annotation getOverrideAnnotation() {
+ // only JPA 2.0 association overrides can have a join table (join strategy)
+ return (AssociationOverride2_0Annotation) this.getAssociationOverride().getOverrideAnnotation();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaOverrideRelationship2_0 getParent() {
+ return (JavaOverrideRelationship2_0) super.getParent();
+ }
+
+ @Override
+ public JavaOverrideRelationship2_0 getRelationship() {
+ return this.getParent();
+ }
+
+ protected JavaAssociationOverride getAssociationOverride() {
+ return this.getRelationship().getAssociationOverride();
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.getRelationship().getTypeMapping().validatesAgainstDatabase();
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getRelationship().getValidationTextRange(astRoot);
+ }
+
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinTableValidator(this.getRelationship().getAssociationOverride(), (JoinTable) table, textRangeResolver);
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(this.getRelationship().getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideInverseJoinColumnValidator(this.getRelationship().getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java
new file mode 100644
index 0000000000..e4eea90893
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * JPA 2.0 Java persistent attribute
+ */
+public class GenericJavaPersistentAttribute2_0
+ extends AbstractJavaPersistentAttribute
+{
+ protected AccessType specifiedAccess;
+
+
+ public GenericJavaPersistentAttribute2_0(PersistentType parent, JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ super(parent, resourcePersistentAttribute);
+ this.specifiedAccess = this.buildSpecifiedAccess();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedAccess_(this.buildSpecifiedAccess());
+ }
+
+
+ // ********** access **********
+
+ @Override
+ public AccessType getSpecifiedAccess() {
+ return this.specifiedAccess;
+ }
+
+ /**
+ * Don't support changing to specified access on a java persistent attribute, this
+ * involves a larger process of moving the annotations to the corresponding field/property
+ * which may or may not exist or might need to be created.
+ */
+ public void setSpecifiedAccess(AccessType specifiedAccess) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void setSpecifiedAccess_(AccessType access) {
+ AccessType old = this.specifiedAccess;
+ this.specifiedAccess = access;
+ this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildSpecifiedAccess() {
+ Access2_0Annotation accessAnnotation = this.getAccessAnnotation();
+ return (accessAnnotation == null) ? null : AccessType.fromJavaResourceModel(accessAnnotation.getValue());
+ }
+
+ protected Access2_0Annotation getAccessAnnotation() {
+ return (Access2_0Annotation) this.resourcePersistentAttribute.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected JptValidator buildAttibuteValidator(CompilationUnit astRoot) {
+ return new GenericPersistentAttributeValidator(this, this, buildTextRangeResolver(astRoot));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
new file mode 100644
index 0000000000..284b7c5b0c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.common.core.utility.BodySourceWriter;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * JPA 2.0 Java persistent type.
+ * Support for specified access and metamodel generation.
+ */
+public class GenericJavaPersistentType2_0
+ extends AbstractJavaPersistentType
+ implements JavaPersistentType2_0
+{
+ protected String declaringTypeName;
+
+ protected final MetamodelSourceType.Synchronizer metamodelSynchronizer;
+
+
+ public GenericJavaPersistentType2_0(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
+ super(parent, jrpt);
+ this.declaringTypeName = this.buildDeclaringTypeName();
+ this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setDeclaringTypeName(this.buildDeclaringTypeName());
+ }
+
+
+ // ********** access annotation **********
+
+ protected Access2_0Annotation getAccessAnnotation() {
+ return (Access2_0Annotation) this.resourcePersistentType.getNonNullAnnotation(this.getAccessAnnotationName());
+ }
+
+ protected void removeAccessAnnotationIfUnset() {
+ if (this.getAccessAnnotation().isUnset()) {
+ this.removeAccessAnnotation();
+ }
+ }
+
+ protected void removeAccessAnnotation() {
+ this.resourcePersistentType.removeAnnotation(this.getAccessAnnotationName());
+ }
+
+ protected String getAccessAnnotationName() {
+ return Access2_0Annotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** access **********
+
+ public void setSpecifiedAccess(AccessType access) {
+ if (this.valuesAreDifferent(this.specifiedAccess, access)) {
+ this.getAccessAnnotation().setValue(AccessType.toJavaResourceModel(access));
+ this.removeAccessAnnotationIfUnset();
+ this.setSpecifiedAccess_(access);
+ }
+ }
+
+ @Override
+ protected AccessType buildSpecifiedAccess() {
+ return AccessType.fromJavaResourceModel(this.getAccessAnnotation().getValue());
+ }
+
+
+ // ********** attributes **********
+
+ // suppress type-safety warning
+ @Override
+ public ListIterator<JavaPersistentAttribute> attributes() {
+ return super.attributes();
+ }
+
+ @Override
+ protected Iterator<JavaResourcePersistentAttribute> resourceAttributes() {
+ return (this.specifiedAccess == null) ?
+ super.resourceAttributes() :
+ this.resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(this.specifiedAccess));
+ }
+
+
+ // ********** declaring type name **********
+
+ public String getDeclaringTypeName() {
+ return this.declaringTypeName;
+ }
+
+ protected void setDeclaringTypeName(String declaringTypeName) {
+ String old = this.declaringTypeName;
+ this.declaringTypeName = declaringTypeName;
+ this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, declaringTypeName);
+ }
+
+ protected String buildDeclaringTypeName() {
+ return this.resourcePersistentType.getDeclaringTypeName();
+ }
+
+
+ // ********** metamodel **********
+
+ public IFile getMetamodelFile() {
+ return this.metamodelSynchronizer.getFile();
+ }
+
+ public void initializeMetamodel() {
+ // do nothing - probably shouldn't be called...
+ }
+
+ public boolean isManaged() {
+ return true;
+ }
+
+ public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ this.metamodelSynchronizer.synchronize(memberTypeTree);
+ }
+
+ public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
+ this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree);
+ }
+
+ public void disposeMetamodel() {
+ // do nothing - probably shouldn't be called...
+ }
+
+ protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() {
+ return this.getJpaFactory2_0().buildMetamodelSynchronizer(this);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java
new file mode 100644
index 0000000000..8b1e0c2f73
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSequenceGenerator2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
+
+/**
+ * JPA 2.0
+ * Java sequence generator
+ */
+public class GenericJavaSequenceGenerator2_0
+ extends AbstractJavaSequenceGenerator<SequenceGenerator2_0Annotation>
+ implements JavaSequenceGenerator2_0
+{
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+
+ public GenericJavaSequenceGenerator2_0(JavaJpaContextNode parent, SequenceGenerator2_0Annotation generatorAnnotation) {
+ super(parent, generatorAnnotation);
+ this.specifiedCatalog = generatorAnnotation.getCatalog();
+ this.specifiedSchema = generatorAnnotation.getSchema();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedCatalog_(this.generatorAnnotation.getCatalog());
+ this.setSpecifiedSchema_(this.generatorAnnotation.getSchema());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.setDefaultSchema(this.buildDefaultSchema());
+ }
+
+
+ // ********** catalog **********
+
+ @Override
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ this.generatorAnnotation.setCatalog(catalog);
+ this.setSpecifiedCatalog_(catalog);
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** schema **********
+
+ @Override
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ this.generatorAnnotation.setSchema(schema);
+ this.setSpecifiedSchema_(schema);
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java
new file mode 100644
index 0000000000..2a4d21001e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+
+public class GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaVirtualJoinTableRelationshipStrategy
+{
+ protected JavaVirtualJoinTable joinTable;
+
+
+ public GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0(JavaVirtualJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinTable();
+ }
+
+
+ // ********** join table **********
+
+ public JavaVirtualJoinTable getJoinTable() {
+ return this.joinTable;
+ }
+
+ protected void setJoinTable(JavaVirtualJoinTable joinTable) {
+ JavaVirtualJoinTable old = this.joinTable;
+ this.joinTable = joinTable;
+ this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable);
+ }
+
+ protected void updateJoinTable() {
+ JoinTable overriddenJoinTable = this.getOverriddenJoinTable();
+ if (overriddenJoinTable == null) {
+ if (this.joinTable != null) {
+ this.setJoinTable(null);
+ }
+ } else {
+ if ((this.joinTable != null) && (this.joinTable.getOverriddenTable() == overriddenJoinTable)) {
+ this.joinTable.update();
+ } else {
+ this.setJoinTable(this.buildJoinTable(overriddenJoinTable));
+ }
+ }
+ }
+
+ protected JoinTable getOverriddenJoinTable() {
+ JoinTableRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
+ return (overriddenStrategy == null) ? null : overriddenStrategy.getJoinTable();
+ }
+
+ protected JavaVirtualJoinTable buildJoinTable(JoinTable overriddenJoinTable) {
+ return this.getJpaFactory().buildJavaVirtualJoinTable(this, overriddenJoinTable);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaVirtualJoinTableRelationship getParent() {
+ return (JavaVirtualJoinTableRelationship) super.getParent();
+ }
+
+ public JavaVirtualJoinTableRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected JoinTableRelationshipStrategy getOverriddenStrategy() {
+ JoinTableRelationship relationship = this.getOverriddenJoinTableRelationship();
+ return (relationship == null) ? null : relationship.getJoinTableStrategy();
+ }
+
+ protected JoinTableRelationship getOverriddenJoinTableRelationship() {
+ Relationship relationship = this.resolveOverriddenRelationship();
+ return (relationship instanceof JoinTableRelationship) ? (JoinTableRelationship) relationship : null;
+ }
+
+ protected Relationship resolveOverriddenRelationship() {
+ return this.getRelationship().resolveOverriddenRelationship();
+ }
+
+ public String getTableName() {
+ return this.joinTable.getName();
+ }
+
+ public String getJoinTableDefaultName() {
+ return MappingTools.buildJoinTableDefaultName(this.getRelationship());
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
new file mode 100644
index 0000000000..d9ebeaaca5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaElementCollectionMappingDefinition2_0
+ extends AbstractJavaElementCollectionMappingDefinition2_0
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaElementCollectionMappingDefinition2_0();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaElementCollectionMappingDefinition2_0() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
new file mode 100644
index 0000000000..acbb6cc15e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+
+public class JavaEmbeddedMappingDefinition2_0
+ extends AbstractJavaEmbeddedMappingDefinition
+{
+ // singleton
+ private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedMappingDefinition2_0();
+
+ /**
+ * Return the singleton.
+ */
+ public static DefaultJavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaEmbeddedMappingDefinition2_0() {
+ super();
+ }
+
+ @Override
+ public Iterable<String> getSupportingAnnotationNames() {
+ return COMBINED_SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
+ AssociationOverrideAnnotation.ANNOTATION_NAME,
+ AssociationOverridesAnnotation.ANNOTATION_NAME,
+ };
+
+ protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate(
+ SUPPORTING_ANNOTATION_NAMES_ARRAY,
+ SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0
+ );
+ protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
new file mode 100644
index 0000000000..b2732da58c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+
+public class JavaIdMappingDefinition2_0
+ extends AbstractJavaIdMappingDefinition2_0
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaIdMappingDefinition2_0();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaIdMappingDefinition2_0() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
new file mode 100644
index 0000000000..b1d12687bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+
+public class JavaManyToManyMappingDefinition2_0
+ extends AbstractJavaManyToManyMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToManyMappingDefinition2_0();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaManyToManyMappingDefinition2_0() {
+ super();
+ }
+
+ @Override
+ public Iterable<String> getSupportingAnnotationNames() {
+ return COMBINED_SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
+ AttributeOverrideAnnotation.ANNOTATION_NAME,
+ AttributeOverridesAnnotation.ANNOTATION_NAME,
+ MapKeyClass2_0Annotation.ANNOTATION_NAME,
+ MapKeyColumn2_0Annotation.ANNOTATION_NAME,
+ MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
+ MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
+ MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME,
+ MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
+ OrderColumn2_0Annotation.ANNOTATION_NAME
+ };
+
+ protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate(
+ SUPPORTING_ANNOTATION_NAMES_ARRAY,
+ SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0
+ );
+ protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java
new file mode 100644
index 0000000000..6c60879a41
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+
+public class JavaManyToOneMappingDefinition2_0
+ extends AbstractJavaManyToOneMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToOneMappingDefinition2_0();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaManyToOneMappingDefinition2_0() {
+ super();
+ }
+
+ @Override
+ public Iterable<String> getSupportingAnnotationNames() {
+ return COMBINED_SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
+ IdAnnotation.ANNOTATION_NAME,
+ MapsId2_0Annotation.ANNOTATION_NAME
+ };
+
+ protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate(
+ SUPPORTING_ANNOTATION_NAMES_ARRAY,
+ SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0
+ );
+ protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
new file mode 100644
index 0000000000..381acd5d74
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+
+public class JavaOneToManyMappingDefinition2_0
+ extends AbstractJavaOneToManyMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToManyMappingDefinition2_0();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaOneToManyMappingDefinition2_0() {
+ super();
+ }
+
+ @Override
+ public Iterable<String> getSupportingAnnotationNames() {
+ return COMBINED_SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
+ AttributeOverrideAnnotation.ANNOTATION_NAME,
+ AttributeOverridesAnnotation.ANNOTATION_NAME,
+ MapKeyClass2_0Annotation.ANNOTATION_NAME,
+ MapKeyColumn2_0Annotation.ANNOTATION_NAME,
+ MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
+ MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
+ MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME,
+ MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
+ OrderColumn2_0Annotation.ANNOTATION_NAME
+ };
+
+ protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate(
+ SUPPORTING_ANNOTATION_NAMES_ARRAY,
+ SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0
+ );
+ protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java
new file mode 100644
index 0000000000..7beb0679bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+
+public class JavaOneToOneMappingDefinition2_0
+ extends AbstractJavaOneToOneMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToOneMappingDefinition2_0();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaOneToOneMappingDefinition2_0() {
+ super();
+ }
+
+ @Override
+ public Iterable<String> getSupportingAnnotationNames() {
+ return COMBINED_SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
+ IdAnnotation.ANNOTATION_NAME,
+ MapsId2_0Annotation.ANNOTATION_NAME
+ };
+
+ protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate(
+ SUPPORTING_ANNOTATION_NAMES_ARRAY,
+ SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0
+ );
+ protected static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
new file mode 100644
index 0000000000..275358b747
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
+
+/**
+ * null Java cacheable
+ */
+public class NullJavaCacheable2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaCacheable2_0
+{
+ public NullJavaCacheable2_0(JavaCacheableHolder2_0 parent) {
+ super(parent);
+ }
+
+
+ // ********** cacheable **********
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public Boolean getSpecifiedCacheable() {
+ return null;
+ }
+
+ public void setSpecifiedCacheable(Boolean cacheable) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefaultCacheable() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java
new file mode 100644
index 0000000000..b03515ecd4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.java.JavaSingleRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
+
+public class NullJavaDerivedIdentity2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaDerivedIdentity2_0
+{
+ public NullJavaDerivedIdentity2_0(JavaSingleRelationshipMapping mapping) {
+ super(mapping);
+ }
+
+
+ // ********** predominant derived identity strategy **********
+
+ public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() {
+ return null;
+ }
+
+
+ // ********** null derived identity strategy **********
+
+ public boolean usesNullDerivedIdentityStrategy() {
+ return true;
+ }
+
+ public void setNullDerivedIdentityStrategy() {
+ // NOP
+ }
+
+
+ // ********** ID derived identity strategy **********
+
+ public JavaIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() {
+ return null;
+ }
+
+ public boolean usesIdDerivedIdentityStrategy() {
+ return false;
+ }
+
+ public void setIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+ public void unsetIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+
+ // ********** maps ID derived identity strategy **********
+
+ public JavaMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() {
+ return null;
+ }
+
+ public boolean usesMapsIdDerivedIdentityStrategy() {
+ return false;
+ }
+
+ public void setMapsIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+ public void unsetMapsIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+
+ // ********** misc **********
+
+ public JavaSingleRelationshipMapping2_0 getMapping() {
+ return null;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
new file mode 100644
index 0000000000..10f019ee07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaMultiRelationshipMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ *
+ */
+public class NullJavaMapKeyColumn2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaColumn
+{
+ public NullJavaMapKeyColumn2_0(JavaMultiRelationshipMapping parent) {
+ super(parent);
+ }
+
+
+ // ********** column annotation **********
+
+ public ColumnAnnotation getColumnAnnotation() {
+ return (ColumnAnnotation) this.getParent().getPersistentAttribute().getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ }
+
+
+ // ********** name **********
+
+ public String getName() {
+ return null;
+ }
+
+ public String getSpecifiedName() {
+ return null;
+ }
+
+ public void setSpecifiedName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultName() {
+ return null;
+ }
+
+
+ // ********** column definition **********
+
+ public String getColumnDefinition() {
+ return null;
+ }
+
+ public void setColumnDefinition(String columnDefinition) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** table **********
+
+ public String getTable() {
+ return null;
+ }
+
+ public String getSpecifiedTable() {
+ return null;
+ }
+
+ public void setSpecifiedTable(String table) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultTable() {
+ return null;
+ }
+
+
+ // ********** unique **********
+
+ public boolean isUnique() {
+ return false;
+ }
+
+ public Boolean getSpecifiedUnique() {
+ return null;
+ }
+
+ public void setSpecifiedUnique(Boolean unique) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefaultUnique() {
+ return false;
+ }
+
+
+ // ********** nullable **********
+
+ public boolean isNullable() {
+ return false;
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return null;
+ }
+
+ public void setSpecifiedNullable(Boolean nullable) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefaultNullable() {
+ return false;
+ }
+
+
+ // ********** insertable **********
+
+ public boolean isInsertable() {
+ return false;
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return null;
+ }
+
+ public void setSpecifiedInsertable(Boolean insertable) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefaultInsertable() {
+ return false;
+ }
+
+
+ // ********** updatable **********
+
+ public boolean isUpdatable() {
+ return false;
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return null;
+ }
+
+ public void setSpecifiedUpdatable(Boolean updatable) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return false;
+ }
+
+
+ // ********** length **********
+
+ public int getLength() {
+ return 0;
+ }
+
+ public Integer getSpecifiedLength() {
+ return null;
+ }
+
+ public void setSpecifiedLength(Integer length) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getDefaultLength() {
+ return 0;
+ }
+
+
+ // ********** precision **********
+
+ public int getPrecision() {
+ return 0;
+ }
+
+ public Integer getSpecifiedPrecision() {
+ return null;
+ }
+
+ public void setSpecifiedPrecision(Integer precision) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getDefaultPrecision() {
+ return 0;
+ }
+
+
+ // ********** scale **********
+
+ public int getScale() {
+ return 0;
+ }
+
+ public Integer getSpecifiedScale() {
+ return null;
+ }
+
+ public void setSpecifiedScale(Integer scale) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getDefaultScale() {
+ return 0;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public JavaMultiRelationshipMapping getParent() {
+ return (JavaMultiRelationshipMapping) super.getParent();
+ }
+
+ public void initializeFrom(ReadOnlyColumn oldColumn) {
+ // NOP
+ }
+
+ public void initializeFromVirtual(ReadOnlyColumn virtualColumn) {
+ // NOP
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+
+ // ********** database stuff **********
+
+ public org.eclipse.jpt.jpa.db.Column getDbColumn() {
+ return null;
+ }
+
+ public Table getDbTable() {
+ return null;
+ }
+
+ public boolean isResolved() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public TextRange getTableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean tableNameIsInvalid() {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java
new file mode 100644
index 0000000000..e2fd32bc54
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
+
+/**
+ * Null Java orphan removal
+ */
+public class NullJavaOrphanRemoval2_0
+ extends AbstractJavaJpaContextNode
+ implements JavaOrphanRemovable2_0
+{
+ public NullJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) {
+ super(parent);
+ }
+
+
+ // ********** orphan removal **********
+
+ public boolean isOrphanRemoval() {
+ return false;
+ }
+
+ public Boolean getSpecifiedOrphanRemoval() {
+ return null;
+ }
+
+ public boolean isDefaultOrphanRemoval() {
+ return false;
+ }
+
+ public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
new file mode 100644
index 0000000000..7bdf59840d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
@@ -0,0 +1,1592 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.AttributeOverride;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.BaseColumn;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.Converter;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.FetchType;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.OverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Override_;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.CollectionTableValidator;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
+import org.eclipse.jpt.jpa.core.resource.orm.MapKey;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * JPA 2.0 Frankenstein mapping
+ */
+public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElementCollection>
+ extends AbstractOrmAttributeMapping<X>
+ implements OrmElementCollectionMapping2_0
+{
+ protected String specifiedTargetClass;
+ protected String defaultTargetClass;
+
+ protected FetchType specifiedFetch;
+ protected FetchType defaultFetch;
+
+ protected final OrmOrderable2_0 orderable;
+
+ protected final OrmCollectionTable2_0 collectionTable;
+
+ protected Type valueType;
+ protected final OrmColumn valueColumn;
+ protected OrmConverter converter; // value converter - never null
+ protected final OrmAttributeOverrideContainer valueAttributeOverrideContainer;
+ protected final OrmAssociationOverrideContainer valueAssociationOverrideContainer;
+
+ protected Type keyType;
+
+ protected String specifiedMapKey;
+ protected boolean noMapKey = false;
+ protected boolean pkMapKey = false;
+ protected boolean customMapKey = false;
+
+ protected String specifiedMapKeyClass;
+ protected String defaultMapKeyClass;
+
+ protected final OrmColumn mapKeyColumn;
+
+ protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer;
+
+
+ protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
+ OrmEnumeratedConverter.Adapter.instance(),
+ OrmTemporalConverter.Adapter.instance(),
+ OrmLobConverter.Adapter.instance()
+ };
+ protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
+
+
+ protected AbstractOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, X xmlMapping) {
+ super(parent, xmlMapping);
+ this.specifiedTargetClass = xmlMapping.getTargetClass();
+ this.specifiedFetch = this.buildSpecifiedFetch();
+ this.orderable = this.buildOrderable();
+ this.collectionTable = this.buildCollectionTable();
+
+ this.valueColumn = this.buildValueColumn();
+ this.converter = this.buildConverter();
+ this.valueAttributeOverrideContainer = this.buildValueAttributeOverrideContainer();
+ this.valueAssociationOverrideContainer = this.buildValueAssociationOverrideContainer();
+
+ this.specifiedMapKey = this.buildSpecifiedMapKey();
+ this.noMapKey = this.buildNoMapKey();
+ this.pkMapKey = this.buildPkMapKey();
+ this.customMapKey = this.buildCustomMapKey();
+ this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
+
+ this.mapKeyColumn = this.buildMapKeyColumn();
+ this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedTargetClass_(this.xmlAttributeMapping.getTargetClass());
+ this.setSpecifiedFetch_(this.buildSpecifiedFetch());
+ this.orderable.synchronizeWithResourceModel();
+ this.collectionTable.synchronizeWithResourceModel();
+
+ this.valueColumn.synchronizeWithResourceModel();
+ this.syncConverter();
+ this.valueAttributeOverrideContainer.synchronizeWithResourceModel();
+ this.valueAssociationOverrideContainer.synchronizeWithResourceModel();
+
+ this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
+ this.setNoMapKey_(this.buildNoMapKey());
+ this.setPkMapKey_(this.buildPkMapKey());
+ this.setCustomMapKey_(this.buildCustomMapKey());
+ this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
+
+ this.mapKeyColumn.synchronizeWithResourceModel();
+ this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultTargetClass(this.buildDefaultTargetClass());
+ this.setDefaultFetch(this.buildDefaultFetch());
+ this.orderable.update();
+ this.collectionTable.update();
+
+ this.setValueType(this.buildValueType());
+ this.valueColumn.update();
+ this.converter.update();
+ this.valueAttributeOverrideContainer.update();
+ this.valueAssociationOverrideContainer.update();
+
+ this.setKeyType(this.buildKeyType());
+ this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
+
+ this.mapKeyColumn.update();
+ this.mapKeyAttributeOverrideContainer.update();
+ }
+
+
+ // ********** target class **********
+
+ public String getTargetClass() {
+ return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass;
+ }
+
+ public String getSpecifiedTargetClass() {
+ return this.specifiedTargetClass;
+ }
+
+ public void setSpecifiedTargetClass(String targetClass) {
+ this.setSpecifiedTargetClass_(targetClass);
+ this.xmlAttributeMapping.setTargetClass(targetClass);
+ }
+
+ protected void setSpecifiedTargetClass_(String targetClass) {
+ String old = this.specifiedTargetClass;
+ this.specifiedTargetClass = targetClass;
+ this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
+ }
+
+ public String getDefaultTargetClass() {
+ return this.defaultTargetClass;
+ }
+
+ protected void setDefaultTargetClass(String targetClass) {
+ String old = this.defaultTargetClass;
+ this.defaultTargetClass = targetClass;
+ this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass);
+ }
+
+ protected String buildDefaultTargetClass() {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ return (javaAttribute == null) ? null : javaAttribute.getMultiReferenceTargetTypeName();
+ }
+
+ public char getTargetClassEnclosingTypeSeparator() {
+ return '$';
+ }
+
+
+ // ********** resolved target type/embeddable/entity **********
+
+ public PersistentType getResolvedTargetType() {
+ return this.resolvePersistentType(this.getTargetClass());
+ }
+
+ protected Embeddable getResolvedTargetEmbeddable() {
+ TypeMapping typeMapping = this.getResolvedTargetTypeMapping();
+ return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
+ }
+
+ protected Entity getResolvedTargetEntity() {
+ TypeMapping typeMapping = this.getResolvedTargetTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ protected TypeMapping getResolvedTargetTypeMapping() {
+ PersistentType resolvedTargetType = this.getResolvedTargetType();
+ return (resolvedTargetType == null) ? null : resolvedTargetType.getMapping();
+ }
+
+
+ // ********** fetch **********
+
+ public FetchType getFetch() {
+ return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType fetch) {
+ this.setSpecifiedFetch_(fetch);
+ this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch));
+ }
+
+ protected void setSpecifiedFetch_(FetchType fetch) {
+ FetchType old = this.specifiedFetch;
+ this.specifiedFetch = fetch;
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildSpecifiedFetch() {
+ return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch());
+ }
+
+ public FetchType getDefaultFetch() {
+ return this.defaultFetch;
+ }
+
+ protected void setDefaultFetch(FetchType fetch) {
+ FetchType old = this.defaultFetch;
+ this.defaultFetch = fetch;
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ }
+
+ protected FetchType buildDefaultFetch() {
+ return DEFAULT_FETCH_TYPE;
+ }
+
+
+ // ********** orderable **********
+
+ public OrmOrderable getOrderable() {
+ return this.orderable;
+ }
+
+ protected OrmOrderable2_0 buildOrderable() {
+ return this.getContextNodeFactory2_0().buildOrmOrderable(this, this.buildOrderableOwner());
+ }
+
+ protected Orderable2_0.Owner buildOrderableOwner() {
+ return new OrderableOwner();
+ }
+
+ protected class OrderableOwner
+ implements Orderable2_0.Owner
+ {
+ public String getTableName() {
+ return this.getCollectionTable().getName();
+ }
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return this.getCollectionTable().getDbTable();
+ }
+ protected OrmCollectionTable2_0 getCollectionTable() {
+ return AbstractOrmElementCollectionMapping2_0.this.getCollectionTable();
+ }
+ }
+
+
+ // ********** collection table **********
+
+ public OrmCollectionTable2_0 getCollectionTable() {
+ return this.collectionTable;
+ }
+
+ protected OrmCollectionTable2_0 buildCollectionTable() {
+ return this.getContextNodeFactory2_0().buildOrmCollectionTable(this, this.buildCollectionTableOwner());
+ }
+
+ protected Table.Owner buildCollectionTableOwner() {
+ return new CollectionTableOwner();
+ }
+
+ public XmlCollectionTable getResourceCollectionTable() {
+ return this.xmlAttributeMapping.getCollectionTable();
+ }
+
+ protected class CollectionTableOwner
+ implements Table.Owner
+ {
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return new CollectionTableValidator(AbstractOrmElementCollectionMapping2_0.this.getPersistentAttribute(), (CollectionTable2_0) table, textRangeResolver);
+ }
+ }
+
+
+ // ********** value type **********
+
+ public Type getValueType() {
+ return this.valueType;
+ }
+
+ protected void setValueType(Type valueType) {
+ Type old = this.valueType;
+ this.valueType = valueType;
+ this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType);
+ }
+
+ protected Type buildValueType() {
+ if (this.getResolvedTargetEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getTargetClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+
+ // ********** value column **********
+
+ public OrmColumn getValueColumn() {
+ return this.valueColumn;
+ }
+
+ protected OrmColumn buildValueColumn() {
+ return this.getContextNodeFactory().buildOrmColumn(this, this.buildValueColumnOwner());
+ }
+
+ protected OrmColumn.Owner buildValueColumnOwner() {
+ return new ValueColumnOwner();
+ }
+
+
+ // ********** converter **********
+
+ public OrmConverter getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(Class<? extends Converter> converterType) {
+ if (this.converter.getType() != converterType) {
+ // note: we may also clear the XML value we want;
+ // but if we leave it, the resulting sync will screw things up...
+ this.clearXmlConverterValues();
+ OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
+ this.setConverter_(this.buildConverter(converterAdapter));
+ this.converter.initialize();
+ }
+ }
+
+ protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
+ return (converterAdapter != null) ?
+ converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
+ this.buildNullConverter();
+ }
+
+ protected void setConverter_(OrmConverter converter) {
+ Converter old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ protected void clearXmlConverterValues() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ adapter.clearXmlValue(this.xmlAttributeMapping);
+ }
+ }
+
+ protected OrmConverter buildConverter() {
+ OrmXmlContextNodeFactory factory = this.getContextNodeFactory();
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ OrmConverter ormConverter = adapter.buildConverter(this, factory);
+ if (ormConverter != null) {
+ return ormConverter;
+ }
+ }
+ return this.buildNullConverter();
+ }
+
+ protected void syncConverter() {
+ OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
+ if (adapter == null) {
+ if (this.converter.getType() != null) {
+ this.setConverter_(this.buildNullConverter());
+ }
+ } else {
+ if (this.converter.getType() == adapter.getConverterType()) {
+ this.converter.synchronizeWithResourceModel();
+ } else {
+ this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory()));
+ }
+ }
+ }
+
+ /**
+ * Return the first adapter whose converter value is set in the XML mapping.
+ * Return <code>null</code> if there are no converter values in the XML.
+ */
+ protected OrmConverter.Adapter getXmlConverterAdapter() {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.isActive(this.xmlAttributeMapping)) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected OrmConverter buildNullConverter() {
+ return new NullOrmConverter(this);
+ }
+
+
+ // ********** converter adapters **********
+
+ /**
+ * Return the converter adapter for the specified converter type.
+ */
+ protected OrmConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
+ for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
+ if (adapter.getConverterType() == converterType) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ protected Iterable<OrmConverter.Adapter> getConverterAdapters() {
+ return CONVERTER_ADAPTERS;
+ }
+
+
+ // ********** value attribute override container **********
+
+ public OrmAttributeOverrideContainer getValueAttributeOverrideContainer() {
+ return this.valueAttributeOverrideContainer;
+ }
+
+ protected OrmAttributeOverrideContainer buildValueAttributeOverrideContainer() {
+ return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildValueAttributeOverrideContainerOwner());
+ }
+
+ protected OrmAttributeOverrideContainer.Owner buildValueAttributeOverrideContainerOwner() {
+ return new ValueAttributeOverrideContainerOwner();
+ }
+
+
+ // ********** value association override container **********
+
+ public OrmAssociationOverrideContainer getValueAssociationOverrideContainer() {
+ return this.valueAssociationOverrideContainer;
+ }
+
+ protected OrmAssociationOverrideContainer buildValueAssociationOverrideContainer() {
+ return this.getContextNodeFactory().buildOrmAssociationOverrideContainer(this, this.buildValueAssociationOverrideContainerOwner());
+ }
+
+ protected OrmAssociationOverrideContainer.Owner buildValueAssociationOverrideContainerOwner() {
+ return new ValueAssociationOverrideContainerOwner();
+ }
+
+
+ // ********** key type **********
+
+ public Type getKeyType() {
+ return this.keyType;
+ }
+
+ protected void setKeyType(Type keyType) {
+ Type old = this.keyType;
+ this.keyType = keyType;
+ this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType);
+ }
+
+ protected Type buildKeyType() {
+ if (this.getResolvedMapKeyEmbeddable() != null) {
+ return Type.EMBEDDABLE_TYPE;
+ }
+ if (this.getResolvedMapKeyEntity() != null) {
+ return Type.ENTITY_TYPE;
+ }
+ if (this.getMapKeyClass() == null) {
+ return Type.NO_TYPE;
+ }
+ return Type.BASIC_TYPE;
+ }
+
+
+ // ********** map key **********
+
+ public String getMapKey() {
+ if (this.noMapKey) {
+ return null;
+ }
+ if (this.pkMapKey) {
+ // the target is either embeddable or basic, so a key will have to be specified
+ return null;
+ }
+ if (this.customMapKey) {
+ return this.specifiedMapKey;
+ }
+ throw new IllegalStateException("unknown map key"); //$NON-NLS-1$
+ }
+
+
+ // ********** specified map key **********
+
+ public String getSpecifiedMapKey() {
+ return this.specifiedMapKey;
+ }
+
+ public void setSpecifiedMapKey(String mapKey) {
+ if (mapKey != null) {
+ this.setSpecifiedMapKey_(mapKey);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(true);
+
+ MapKey xmlMapKey = this.getXmlMapKey();
+ if (xmlMapKey == null) {
+ xmlMapKey = this.buildXmlMapKey();
+ }
+ xmlMapKey.setName(mapKey);
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setSpecifiedMapKey_(String mapKey) {
+ String old = this.specifiedMapKey;
+ this.specifiedMapKey = mapKey;
+ this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
+ }
+
+ protected String buildSpecifiedMapKey() {
+ MapKey xmlMapKey = this.getXmlMapKey();
+ return (xmlMapKey == null) ? null : xmlMapKey.getName();
+ }
+
+
+ // ********** no map key **********
+
+ public boolean isNoMapKey() {
+ return this.noMapKey;
+ }
+
+ public void setNoMapKey(boolean noMapKey) {
+ if (noMapKey) {
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(true);
+ this.setPkMapKey_(false);
+ this.setCustomMapKey_(false);
+
+ if (this.getXmlMapKey() != null) {
+ this.removeXmlMapKey();
+ }
+ } else {
+ this.setPkMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setNoMapKey_(boolean noMapKey) {
+ boolean old = this.noMapKey;
+ this.noMapKey = noMapKey;
+ this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
+ }
+
+ protected boolean buildNoMapKey() {
+ return this.getXmlMapKey() == null;
+ }
+
+
+ // ********** pk map key **********
+
+ public boolean isPkMapKey() {
+ return this.pkMapKey;
+ }
+
+ public void setPkMapKey(boolean pkMapKey) {
+ if (pkMapKey) {
+ this.setSpecifiedMapKey_(null);
+ this.setNoMapKey_(false);
+ this.setPkMapKey_(true);
+ this.setCustomMapKey_(false);
+
+ MapKey xmlMapKey = this.getXmlMapKey();
+ if (xmlMapKey == null) {
+ this.buildXmlMapKey();
+ } else {
+ xmlMapKey.setName(null);
+ }
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setPkMapKey_(boolean pkMapKey) {
+ boolean old = this.pkMapKey;
+ this.pkMapKey = pkMapKey;
+ this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
+ }
+
+ protected boolean buildPkMapKey() {
+ MapKey xmlMapKey = this.getXmlMapKey();
+ return (xmlMapKey != null) && (xmlMapKey.getName() == null);
+ }
+
+
+ // ********** custom map key **********
+
+ public boolean isCustomMapKey() {
+ return this.customMapKey;
+ }
+
+ public void setCustomMapKey(boolean customMapKey) {
+ if (customMapKey) {
+ this.setSpecifiedMapKey(""); //$NON-NLS-1$
+ } else {
+ this.setNoMapKey(true); // hmmm...
+ }
+ }
+
+ protected void setCustomMapKey_(boolean customMapKey) {
+ boolean old = this.customMapKey;
+ this.customMapKey = customMapKey;
+ this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
+ }
+
+ protected boolean buildCustomMapKey() {
+ MapKey xmlMapKey = this.getXmlMapKey();
+ return (xmlMapKey != null) && (xmlMapKey.getName() != null);
+ }
+
+
+ // ********** xml map key **********
+
+ protected MapKey getXmlMapKey() {
+ return this.xmlAttributeMapping.getMapKey();
+ }
+
+ protected MapKey buildXmlMapKey() {
+ MapKey mapKey = OrmFactory.eINSTANCE.createMapKey();
+ this.xmlAttributeMapping.setMapKey(mapKey);
+ return mapKey;
+ }
+
+ protected void removeXmlMapKey() {
+ this.xmlAttributeMapping.setMapKey(null);
+ }
+
+
+ // ********** map key class **********
+
+ public String getMapKeyClass() {
+ return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass;
+ }
+
+ public String getSpecifiedMapKeyClass() {
+ return this.specifiedMapKeyClass;
+ }
+
+ public void setSpecifiedMapKeyClass(String mapKeyClass) {
+ if (this.setSpecifiedMapKeyClass_(mapKeyClass)) {
+ XmlClassReference xmlMapKeyClassRef = this.xmlAttributeMapping.getMapKeyClass();
+ if (mapKeyClass == null) {
+ if (xmlMapKeyClassRef != null) {
+ this.xmlAttributeMapping.setMapKeyClass(null);
+ }
+ } else {
+ if (xmlMapKeyClassRef == null) {
+ xmlMapKeyClassRef = this.buildXmlMapKeyClassReference();
+ }
+ xmlMapKeyClassRef.setClassName(mapKeyClass);
+ }
+ }
+ }
+
+ protected boolean setSpecifiedMapKeyClass_(String mapKeyClass) {
+ String old = this.specifiedMapKeyClass;
+ this.specifiedMapKeyClass = mapKeyClass;
+ return this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected XmlClassReference buildXmlMapKeyClassReference() {
+ XmlClassReference mapKeyClass = OrmFactory.eINSTANCE.createXmlClassReference();
+ this.xmlAttributeMapping.setMapKeyClass(mapKeyClass);
+ return mapKeyClass;
+ }
+
+ protected String buildSpecifiedMapKeyClass() {
+ XmlClassReference xmlClassRef = this.xmlAttributeMapping.getMapKeyClass();
+ return (xmlClassRef == null) ? null : xmlClassRef.getClassName();
+ }
+
+ public String getDefaultMapKeyClass() {
+ return this.defaultMapKeyClass;
+ }
+
+ protected void setDefaultMapKeyClass(String mapKeyClass) {
+ String old = this.defaultMapKeyClass;
+ this.defaultMapKeyClass = mapKeyClass;
+ this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ }
+
+ protected String buildDefaultMapKeyClass() {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ return (javaAttribute == null) ? null : javaAttribute.getMultiReferenceMapKeyTypeName();
+ }
+
+ public char getMapKeyClassEnclosingTypeSeparator() {
+ return '$';
+ }
+
+
+ // ********** resolved map key embeddable/entity **********
+
+ protected Embeddable getResolvedMapKeyEmbeddable() {
+ TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping();
+ return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
+ }
+
+ protected Entity getResolvedMapKeyEntity() {
+ TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ protected TypeMapping getResolvedMapKeyTypeMapping() {
+ PersistentType resolvedMapKeyType = this.getResolvedMapKeyType();
+ return (resolvedMapKeyType == null) ? null : resolvedMapKeyType.getMapping();
+ }
+
+ protected PersistentType getResolvedMapKeyType() {
+ return this.resolvePersistentType(this.getMapKeyClass());
+ }
+
+
+ // ********** map key column **********
+
+ public OrmColumn getMapKeyColumn() {
+ return this.mapKeyColumn;
+ }
+
+ protected OrmColumn buildMapKeyColumn() {
+ return this.getContextNodeFactory().buildOrmColumn(this, this.buildMapKeyColumnOwner());
+ }
+
+ protected OrmColumn.Owner buildMapKeyColumnOwner() {
+ return new MapKeyColumnOwner();
+ }
+
+
+ // ********** map key attribute override container **********
+
+ public OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer() {
+ return this.mapKeyAttributeOverrideContainer;
+ }
+
+ protected OrmAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() {
+ return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner());
+ }
+
+ protected OrmAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() {
+ return new MapKeyAttributeOverrideContainerOwner();
+ }
+
+
+ // ********** Java override lookups **********
+
+ protected JavaAttributeOverride getSpecifiedJavaValueAttributeOverrideNamed(String attributeName) {
+ JavaElementCollectionMapping2_0 javaMapping = this.getJavaElementCollectionMapping();
+ return (javaMapping == null) ? null :
+ javaMapping.getValueAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName);
+ }
+
+ protected JavaAssociationOverride getSpecifiedJavaValueAssociationOverrideNamed(String attributeName) {
+ JavaElementCollectionMapping2_0 javaMapping = this.getJavaElementCollectionMapping();
+ return (javaMapping == null) ? null :
+ javaMapping.getValueAssociationOverrideContainer().getSpecifiedOverrideNamed(attributeName);
+ }
+
+ protected JavaAttributeOverride getSpecifiedJavaMapKeyAttributeOverrideNamed(String attributeName) {
+ JavaElementCollectionMapping2_0 javaMapping = this.getJavaElementCollectionMapping();
+ return (javaMapping == null) ? null :
+ javaMapping.getMapKeyAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName);
+ }
+
+ protected JavaElementCollectionMapping2_0 getJavaElementCollectionMapping() {
+ AttributeMapping javaAttributeMapping = this.getJavaAttributeMapping();
+ return (javaAttributeMapping instanceof JavaElementCollectionMapping2_0) ?
+ (JavaElementCollectionMapping2_0) javaAttributeMapping :
+ null;
+ }
+
+ protected JavaAttributeMapping getJavaAttributeMapping() {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ return (javaAttribute == null) ? null : javaAttribute.getMapping();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmPersistentAttribute2_0 getParent() {
+ return (OrmPersistentAttribute2_0) super.getParent();
+ }
+
+ @Override
+ public OrmPersistentAttribute2_0 getPersistentAttribute() {
+ return (OrmPersistentAttribute2_0) super.getPersistentAttribute();
+ }
+
+ public String getKey() {
+ return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public int getXmlSequence() {
+ return 75;
+ }
+
+ public Entity getEntity() {
+ OrmTypeMapping typeMapping = this.getTypeMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+ public void initializeOn(OrmAttributeMapping newMapping) {
+ newMapping.initializeFromOrmAttributeMapping(this);
+ }
+
+ public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
+ resourceAttributes.getElementCollections().add(this.xmlAttributeMapping);
+ }
+
+ public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
+ resourceAttributes.getElementCollections().remove(this.xmlAttributeMapping);
+ }
+
+
+ // ********** metamodel **********
+
+ @Override
+ protected String getMetamodelFieldTypeName() {
+ return this.getPersistentAttribute().getMetamodelContainerFieldTypeName();
+ }
+
+ @Override
+ public String getMetamodelTypeName() {
+ if (this.valueType == Type.BASIC_TYPE) {
+ return this.getTargetClass();
+ }
+ PersistentType targetType = this.getResolvedTargetType();
+ if (targetType == null) {
+ return MetamodelField.DEFAULT_TYPE_NAME;
+ }
+ String targetTypeName = targetType.getName();
+ return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME;
+ }
+
+ @Override
+ protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
+ this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames);
+ super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
+ }
+
+ protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList<String> typeArgumentNames) {
+ String keyTypeName = this.getPersistentAttribute().getMetamodelContainerFieldMapKeyTypeName();
+ if (keyTypeName != null) {
+ typeArgumentNames.add(keyTypeName);
+ }
+ }
+
+ public String getMetamodelFieldMapKeyTypeName() {
+ return MappingTools.getMetamodelFieldMapKeyTypeName(this);
+ }
+
+
+ // ********** embedded mappings **********
+
+ public Iterator<String> candidateMapKeyNames() {
+ return new CompositeIterator<String>(this.allTargetEmbeddableAttributeNamesLists());
+ }
+
+ /**
+ * Return a list of lists; each nested list holds the names for one of the
+ * embedded mapping's target embeddable type mapping's attribute mappings
+ * (attribute or association mappings, depending on the specified transformer).
+ */
+ protected Iterator<Iterator<String>> allTargetEmbeddableAttributeNamesLists() {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.allTargetEmbeddableAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<AttributeMapping> allTargetEmbeddableAttributeMappings() {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return (targetEmbeddable != null) ? targetEmbeddable.allAttributeMappings() : EmptyIterator.<AttributeMapping> instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterator<String> allMappingNames() {
+ return new CompositeIterator<String>(super.allMappingNames(), this.allEmbeddableAttributeMappingNames());
+ }
+
+ protected Iterator<String> allEmbeddableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ @Override
+ public Iterator<String> allOverridableAttributeMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ @Override
+ public Iterator<String> allOverridableAssociationMappingNames() {
+ return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
+ }
+
+ protected Iterator<String> qualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<String, String>(this.embeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
+ }
+
+ protected Iterator<String> embeddableOverridableMappingNames(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new CompositeIterator<String>(this.embeddableOverridableMappingNamesLists(transformer));
+ }
+
+ /**
+ * Return a list of lists; each nested list holds the names for one of the
+ * embedded mapping's target embeddable type mapping's attribute mappings
+ * (attribute or association mappings, depending on the specified transformer).
+ */
+ protected Iterator<Iterator<String>> embeddableOverridableMappingNamesLists(Transformer<AttributeMapping, Iterator<String>> transformer) {
+ return new TransformationIterator<AttributeMapping, Iterator<String>>(this.embeddableAttributeMappings(), transformer);
+ }
+
+ @Override
+ public AttributeMapping resolveAttributeMapping(String attributeName) {
+ AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ // recurse into the embeddable mappings
+ for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) {
+ resolvedMapping = mapping.resolveAttributeMapping(attributeName);
+ if (resolvedMapping != null) {
+ return resolvedMapping;
+ }
+ }
+ return null;
+ }
+
+ protected Iterator<AttributeMapping> embeddableAttributeMappings() {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return ((targetEmbeddable != null) && (targetEmbeddable != this.getTypeMapping())) ?
+ targetEmbeddable.attributeMappings() :
+ EmptyIterator.<AttributeMapping>instance();
+ }
+
+ @Override
+ public Column resolveOverriddenColumn(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AttributeOverride override = this.valueAttributeOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName);
+ }
+
+ protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenColumn(attributeName);
+ }
+
+ @Override
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ attributeName = this.unqualify(attributeName);
+ if (attributeName == null) {
+ return null;
+ }
+ AssociationOverride override = this.valueAssociationOverrideContainer.getSpecifiedOverrideNamed(attributeName);
+ // recurse into the target embeddable if necessary
+ return (override != null) ? override.getRelationship() : this.resolveOverriddenRelationshipInTargetEmbeddable(attributeName);
+ }
+
+ protected Relationship resolveOverriddenRelationshipInTargetEmbeddable(String attributeName) {
+ Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
+ return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenRelationship(attributeName);
+ }
+
+
+ //*********** refactoring ***********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenameTypeEdits(originalType, newName),
+ this.createMapKeyClassRenameTypeEdits(originalType, newName),
+ this.createTargetClassRenameTypeEdits(originalType, newName),
+ this.createConverterRenameTypeEdits(originalType, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createMapKeyClassRenameTypeEdits(IType originalType, String newName) {
+ if (this.specifiedMapKeyClass != null) {
+ PersistentType mapKeyType = this.getResolvedMapKeyType();
+ if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.createRenameMapKeyClassEdit(originalType, newName));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected ReplaceEdit createRenameMapKeyClassEdit(IType originalType, String newName) {
+ return this.xmlAttributeMapping.createRenameMapKeyClassEdit(originalType, newName);
+ }
+
+ protected Iterable<ReplaceEdit> createTargetClassRenameTypeEdits(IType originalType, String newName) {
+ if (this.specifiedTargetClass != null) {
+ PersistentType targetType = this.getResolvedTargetType();
+ if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.xmlAttributeMapping.createRenameTargetClassEdit(originalType, newName));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenameTypeEdits(IType originalType, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenameTypeEdits(originalType, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createMoveTypeEdits(originalType, newPackage),
+ this.createMapKeyClassMoveTypeEdits(originalType, newPackage),
+ this.createTargetClassMoveTypeEdits(originalType, newPackage),
+ this.createConverterMoveTypeEdits(originalType, newPackage)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createMapKeyClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ if (this.specifiedMapKeyClass != null) {
+ PersistentType mapKeyType = this.getResolvedMapKeyType();
+ if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.createMapKeyClassRenamePackageEdit(newPackage.getElementName()));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected Iterable<ReplaceEdit> createTargetClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ if (this.specifiedTargetClass != null) {
+ PersistentType targetType = this.getResolvedTargetType();
+ if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
+ return new SingleElementIterable<ReplaceEdit>(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newPackage.getElementName()));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected Iterable<ReplaceEdit> createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
+ return (this.converter != null) ?
+ this.converter.createMoveTypeEdits(originalType, newPackage) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return new CompositeIterable<ReplaceEdit>(
+ super.createRenamePackageEdits(originalPackage, newName),
+ this.createMapKeyClassRenamePackageEdits(originalPackage, newName),
+ this.createTargetClassRenamePackageEdits(originalPackage, newName),
+ this.createConverterRenamePackageEdits(originalPackage, newName)
+ );
+ }
+
+ protected Iterable<ReplaceEdit> createMapKeyClassRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ if (this.specifiedMapKeyClass != null) {
+ PersistentType mapKeyType = this.getResolvedMapKeyType();
+ if ((mapKeyType != null) && mapKeyType.isIn(originalPackage)) {
+ return new SingleElementIterable<ReplaceEdit>(this.createMapKeyClassRenamePackageEdit(newName));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected ReplaceEdit createMapKeyClassRenamePackageEdit(String newName) {
+ return this.xmlAttributeMapping.createRenameMapKeyClassPackageEdit(newName);
+ }
+
+ protected Iterable<ReplaceEdit> createTargetClassRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ if (this.specifiedTargetClass != null) {
+ PersistentType targetType = this.getResolvedTargetType();
+ if ((targetType != null) && targetType.isIn(originalPackage)) {
+ return new SingleElementIterable<ReplaceEdit>(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newName));
+ }
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected Iterable<ReplaceEdit> createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) {
+ return (this.converter != null) ?
+ this.converter.createRenamePackageEdits(originalPackage, newName) :
+ EmptyIterable.<ReplaceEdit>instance();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateTargetClass(messages);
+ this.validateMapKeyClass(messages);
+ this.orderable.validate(messages, reporter);
+ this.collectionTable.validate(messages, reporter);
+ this.validateValue(messages, reporter);
+ this.validateMapKey(messages, reporter);
+ }
+
+ protected void validateTargetClass(List<IMessage> messages) {
+ if (this.getTargetClass() == null) {
+ if (this.isVirtual()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED,
+ new String[] {this.name},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ } else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED,
+ EMPTY_STRING_ARRAY,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ }
+ //TODO this does not give an error for unmapped, unlisted types that aren't basic - bug 310464
+ if (this.getResolvedTargetType() != null) {
+ if (this.getResolvedTargetEmbeddable() == null) {
+ if (this.isVirtual()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE,
+ new String[] {this.name, this.getTargetClass()},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ } else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE,
+ new String[] {this.getTargetClass(), this.name},
+ this,
+ this.getTargetClassTextRange()
+ )
+ );
+ }
+ }
+ }
+ }
+
+ protected TextRange getTargetClassTextRange() {
+ return this.xmlAttributeMapping.getTargetClassTextRange();
+ }
+
+ protected void validateMapKeyClass(List<IMessage> messages) {
+ JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
+ if ((javaAttribute != null) && ! javaAttribute.getJpaContainerDefinition().isMap()) {
+ return;
+ }
+ if (this.getMapKeyClass() == null) {
+ if (this.isVirtual()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED,
+ new String[] {this.name},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ } else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED,
+ EMPTY_STRING_ARRAY,
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
+ }
+ }
+
+ public void validateValue(List<IMessage> messages, IReporter reporter) {
+ //TODO should we handle validation when the type is embeddable,
+ //but a value column is specified, or things like that if that is invalid?
+ switch (this.valueType) {
+ case BASIC_TYPE :
+ this.valueColumn.validate(messages, reporter);
+ this.converter.validate(messages, reporter);
+ break;
+ case EMBEDDABLE_TYPE :
+ this.valueAttributeOverrideContainer.validate(messages, reporter);
+ this.valueAssociationOverrideContainer.validate(messages, reporter);
+ break;
+ default :
+ break;
+ }
+ }
+
+ protected void validateMapKey(List<IMessage> messages, IReporter reporter) {
+ if (this.getMapKey() == null) {
+ this.validateMapKey_(messages, reporter);
+ } else {
+ //TODO validate that the map key refers to an existing attribute
+ }
+ }
+
+ protected void validateMapKey_(List<IMessage> messages, IReporter reporter) {
+ switch (this.keyType) {
+ case BASIC_TYPE :
+ this.mapKeyColumn.validate(messages, reporter);
+ //validate map key converter
+ break;
+ case ENTITY_TYPE :
+ //validate map key join columns
+ break;
+ case EMBEDDABLE_TYPE :
+ this.mapKeyAttributeOverrideContainer.validate(messages, reporter);
+ //validate map key association overrides
+ break;
+ default :
+ break;
+ }
+ }
+
+
+ // ********** abstract owner **********
+
+ /**
+ * the various (column and override) owners have lots of common
+ * interactions with the mapping
+ */
+ protected abstract class AbstractOwner
+ {
+ public OrmTypeMapping getTypeMapping() {
+ return AbstractOrmElementCollectionMapping2_0.this.getTypeMapping();
+ }
+
+ public String getDefaultTableName() {
+ return this.getCollectionTable().getName();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ OrmCollectionTable2_0 table = this.getCollectionTable();
+ return table.getName().equals(tableName) ? table.getDbTable() : null;
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ /**
+ * If there is a specified table name it needs to be the same
+ * the default table name. the table is always the collection table
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
+ }
+
+ public TextRange getValidationTextRange() {
+ return AbstractOrmElementCollectionMapping2_0.this.getValidationTextRange();
+ }
+
+ protected String getMappingName() {
+ return AbstractOrmElementCollectionMapping2_0.this.getName();
+ }
+
+ protected boolean mappingIsVirtual() {
+ return AbstractOrmElementCollectionMapping2_0.this.isVirtual();
+ }
+
+ protected OrmCollectionTable2_0 getCollectionTable() {
+ return AbstractOrmElementCollectionMapping2_0.this.getCollectionTable();
+ }
+
+ protected OrmPersistentAttribute2_0 getPersistentAttribute() {
+ return AbstractOrmElementCollectionMapping2_0.this.getPersistentAttribute();
+ }
+
+ protected XmlElementCollection getXmlMapping() {
+ return AbstractOrmElementCollectionMapping2_0.this.getXmlAttributeMapping();
+ }
+ }
+
+
+ // ********** value column owner **********
+
+ protected class ValueColumnOwner
+ extends AbstractOwner
+ implements OrmColumn.Owner
+ {
+ public XmlColumn getXmlColumn() {
+ return this.getXmlMapping().getColumn();
+ }
+
+ public XmlColumn buildXmlColumn() {
+ XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
+ this.getXmlMapping().setColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ public void removeXmlColumn() {
+ this.getXmlMapping().setColumn(null);
+ }
+
+ public String getDefaultColumnName() {
+ return this.getMappingName();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+
+
+ // ********** map key column owner **********
+
+ protected class MapKeyColumnOwner
+ extends AbstractOwner
+ implements OrmColumn.Owner
+ {
+ public XmlColumn getXmlColumn() {
+ return this.getXmlMapping().getMapKeyColumn();
+ }
+
+ public XmlColumn buildXmlColumn() {
+ XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn();
+ this.getXmlMapping().setMapKeyColumn(xmlColumn);
+ return xmlColumn;
+ }
+
+ public void removeXmlColumn() {
+ this.getXmlMapping().setMapKeyColumn(null);
+ }
+
+ public String getDefaultColumnName() {
+ return this.getMappingName() + "_KEY"; //$NON-NLS-1$
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+
+
+ // ********** value association override container owner **********
+
+ protected class ValueAssociationOverrideContainerOwner
+ extends AbstractOwner
+ implements OrmAssociationOverrideContainer.Owner
+ {
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractOrmElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.<String>instance();
+ }
+
+ public EList<XmlAssociationOverride> getXmlOverrides() {
+ return this.getXmlMapping().getAssociationOverrides();
+ }
+
+ public Relationship resolveOverriddenRelationship(String attributeName) {
+ if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) {
+ JavaAssociationOverride override = AbstractOrmElementCollectionMapping2_0.this.getSpecifiedJavaValueAssociationOverrideNamed(attributeName);
+ if (override != null) {
+ return override.getRelationship();
+ }
+ }
+ return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AssociationOverrideValidator(this.getPersistentAttribute(), (AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+
+ public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) {
+ throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$
+ }
+ }
+
+
+ // ********** value attribute override container owner **********
+
+ protected class ValueAttributeOverrideContainerOwner
+ extends AbstractOwner
+ implements OrmAttributeOverrideContainer.Owner
+ {
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractOrmElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.<String>instance();
+ }
+
+ public EList<XmlAttributeOverride> getXmlOverrides() {
+ return this.getXmlMapping().getAttributeOverrides();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) {
+ JavaAttributeOverride override = AbstractOrmElementCollectionMapping2_0.this.getSpecifiedJavaValueAttributeOverrideNamed(attributeName);
+ if (override != null) {
+ return override.getColumn();
+ }
+ }
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+
+
+ // ********** map key attribute override container owner **********
+
+ protected class MapKeyAttributeOverrideContainerOwner
+ extends AbstractOwner
+ implements OrmAttributeOverrideContainer.Owner
+ {
+ public TypeMapping getOverridableTypeMapping() {
+ return AbstractOrmElementCollectionMapping2_0.this.getResolvedMapKeyEmbeddable();
+ }
+
+ public Iterator<String> allOverridableNames() {
+ TypeMapping typeMapping = this.getOverridableTypeMapping();
+ return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.<String>instance();
+ }
+
+ public EList<XmlAttributeOverride> getXmlOverrides() {
+ return this.getXmlMapping().getMapKeyAttributeOverrides();
+ }
+
+ public Column resolveOverriddenColumn(String attributeName) {
+ if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) {
+ JavaAttributeOverride override = AbstractOrmElementCollectionMapping2_0.this.getSpecifiedJavaMapKeyAttributeOverrideNamed(attributeName);
+ if (override != null) {
+ return override.getColumn();
+ }
+ }
+ return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
+ }
+
+ public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
+ }
+
+ public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
+ return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
new file mode 100644
index 0000000000..e3b01a30f2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
+
+/**
+ * <code>orm.xml</code> cacheable
+ */
+public class GenericOrmCacheable2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmCacheable2_0
+{
+ protected Boolean specifiedCacheable;
+ protected boolean defaultCacheable;
+
+
+ public GenericOrmCacheable2_0(OrmCacheableHolder2_0 parent) {
+ super(parent);
+ this.specifiedCacheable = this.getXmlCacheable().getCacheable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedCacheable_(this.getXmlCacheable().getCacheable());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultCacheable(this.buildDefaultCacheable());
+ }
+
+
+ // ********** cacheable **********
+
+ public boolean isCacheable() {
+ return (this.specifiedCacheable != null) ? this.specifiedCacheable.booleanValue() : this.defaultCacheable;
+ }
+
+ public Boolean getSpecifiedCacheable() {
+ return this.specifiedCacheable;
+ }
+
+ public void setSpecifiedCacheable(Boolean cacheable) {
+ this.setSpecifiedCacheable_(cacheable);
+ this.getXmlCacheable().setCacheable(cacheable);
+ }
+
+ protected void setSpecifiedCacheable_(Boolean cacheable) {
+ Boolean old = this.specifiedCacheable;
+ this.specifiedCacheable = cacheable;
+ this.firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, old, cacheable);
+ }
+
+ public boolean isDefaultCacheable() {
+ return this.defaultCacheable;
+ }
+
+ protected void setDefaultCacheable(boolean cacheable) {
+ boolean old = this.defaultCacheable;
+ this.defaultCacheable = cacheable;
+ this.firePropertyChanged(DEFAULT_CACHEABLE_PROPERTY, old, cacheable);
+ }
+
+ protected boolean buildDefaultCacheable() {
+ return this.getCacheableHolder().calculateDefaultCacheable();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmCacheableHolder2_0 getParent() {
+ return (OrmCacheableHolder2_0) super.getParent();
+ }
+
+ protected OrmCacheableHolder2_0 getCacheableHolder() {
+ return this.getParent();
+ }
+
+ protected XmlCacheable_2_0 getXmlCacheable() {
+ return this.getCacheableHolder().getXmlCacheable();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getXmlCacheable().getCacheableTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
new file mode 100644
index 0000000000..9e8b3ffbdc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmReferenceTable;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+
+/**
+ * <code>orm.xml</code> collection table
+ */
+public class GenericOrmCollectionTable2_0
+ extends GenericOrmReferenceTable<XmlCollectionTable>
+ implements OrmCollectionTable2_0
+{
+ public GenericOrmCollectionTable2_0(OrmElementCollectionMapping2_0 parent, Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ protected OrmJoinColumn.Owner buildJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+
+ // ********** XML table **********
+
+ @Override
+ protected XmlCollectionTable getXmlTable() {
+ return this.getXmlAttributeMapping().getCollectionTable();
+ }
+
+ @Override
+ protected XmlCollectionTable buildXmlTable() {
+ XmlCollectionTable xmlCollectionTable = OrmFactory.eINSTANCE.createXmlCollectionTable();
+ this.getXmlAttributeMapping().setCollectionTable(xmlCollectionTable);
+ return xmlCollectionTable;
+ }
+
+ @Override
+ protected void removeXmlTable() {
+ this.getXmlAttributeMapping().setCollectionTable(null);
+ }
+
+ protected XmlElementCollection getXmlAttributeMapping() {
+ return this.getElementCollectionMapping().getXmlAttributeMapping();
+ }
+
+
+ // ********** misc **********
+
+ public PersistentAttribute getPersistentAttribute() {
+ return this.getElementCollectionMapping().getPersistentAttribute();
+ }
+
+ @Override
+ public OrmElementCollectionMapping2_0 getParent() {
+ return (OrmElementCollectionMapping2_0) super.getParent();
+ }
+
+ protected OrmElementCollectionMapping2_0 getElementCollectionMapping() {
+ return this.getParent();
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return MappingTools.buildCollectionTableDefaultName(this.getElementCollectionMapping());
+ }
+
+ public void initializeFrom(CollectionTable2_0 oldCollectionTable) {
+ super.initializeFrom(oldCollectionTable);
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.getElementCollectionMapping().validatesAgainstDatabase();
+ }
+
+
+ // ********** join column owner **********
+
+ /**
+ * owner for "back-pointer" join columns;
+ * these point at the source/owning entity
+ */
+ protected class JoinColumnOwner
+ implements OrmJoinColumn.Owner
+ {
+ protected JoinColumnOwner() {
+ super();
+ }
+
+ public TypeMapping getTypeMapping() {
+ return this.getElementCollectionMapping().getTypeMapping();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
+ return Tools.valuesAreEqual(GenericOrmCollectionTable2_0.this.getName(), tableName) ?
+ GenericOrmCollectionTable2_0.this.getDbTable() :
+ null;
+ }
+
+ public String getDefaultColumnName() {
+ //built in MappingTools.buildJoinColumnDefaultName()
+ return null;
+ }
+
+ /**
+ * by default, the join column is, obviously, in the collection table;
+ * not sure whether it can be anywhere else...
+ */
+ public String getDefaultTableName() {
+ return GenericOrmCollectionTable2_0.this.getName();
+ }
+
+ public TextRange getValidationTextRange() {
+ return GenericOrmCollectionTable2_0.this.getValidationTextRange();
+ }
+
+ public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
+ return this.getTypeMapping().getPrimaryDbTable();
+ }
+
+ public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
+ return GenericOrmCollectionTable2_0.this.getDefaultJoinColumn() == joinColumn;
+ }
+
+ /**
+ * 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;
+ }
+
+ public Iterator<String> candidateTableNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Entity getRelationshipTarget() {
+ return this.getElementCollectionMapping().getEntity();
+ }
+
+ public String getAttributeName() {
+ //TODO
+ return null; //I *think* this is correct
+// //return GenericJavaCollectionTable2_0.this.getParent().getName();
+// Entity targetEntity = GenericOrmCollectionTable2_0.this.getRelationshipMapping().getResolvedTargetEntity();
+// if (targetEntity == null) {
+// return null;
+// }
+// for (PersistentAttribute each : CollectionTools.iterable(targetEntity.getPersistentType().allAttributes())) {
+// if (each.getMapping().isOwnedBy(getRelationshipMapping())) {
+// return each.getName();
+// }
+// }
+// return null;
+ }
+
+ protected PersistentAttribute getPersistentAttribute() {
+ return GenericOrmCollectionTable2_0.this.getPersistentAttribute();
+ }
+
+ public int joinColumnsSize() {
+ return GenericOrmCollectionTable2_0.this.joinColumnsSize();
+ }
+
+ protected OrmElementCollectionMapping2_0 getElementCollectionMapping() {
+ return GenericOrmCollectionTable2_0.this.getElementCollectionMapping();
+ }
+
+ public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
+ return new JoinColumnValidator(this.getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
new file mode 100644
index 0000000000..7db7be432c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmDerivedIdentity2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmDerivedIdentity2_0
+{
+ protected DerivedIdentityStrategy2_0 strategy;
+
+ protected OrmIdDerivedIdentityStrategy2_0 idStrategy;
+
+ protected OrmMapsIdDerivedIdentityStrategy2_0 mapsIdStrategy;
+
+
+ public GenericOrmDerivedIdentity2_0(OrmSingleRelationshipMapping2_0 parent) {
+ super(parent);
+ this.idStrategy = this.buildIdStrategy();
+ this.mapsIdStrategy = this.buildMapsIdStrategy();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.idStrategy.synchronizeWithResourceModel();
+ this.mapsIdStrategy.synchronizeWithResourceModel();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.idStrategy.update();
+ this.mapsIdStrategy.update();
+ this.updateStrategy();
+ }
+
+
+ // ********** predominant strategy **********
+
+ public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() {
+ return this.strategy;
+ }
+
+ protected void setStrategy(DerivedIdentityStrategy2_0 strategy) {
+ DerivedIdentityStrategy2_0 old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, strategy);
+ }
+
+ protected void updateStrategy() {
+ this.setStrategy(this.buildStrategy());
+ }
+
+ protected DerivedIdentityStrategy2_0 buildStrategy() {
+ if (this.mapsIdStrategy.isSpecified()) {
+ return this.mapsIdStrategy;
+ }
+ if (this.idStrategy.isSpecified()) {
+ return this.idStrategy;
+ }
+ return null;
+ }
+
+
+ // ********** null strategy **********
+
+ public boolean usesNullDerivedIdentityStrategy() {
+ return this.strategy == null;
+ }
+
+ public void setNullDerivedIdentityStrategy() {
+ this.mapsIdStrategy.removeStrategy();
+ this.idStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+
+ // ********** ID strategy **********
+
+ public OrmIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() {
+ return this.idStrategy;
+ }
+
+ public void setIdDerivedIdentityStrategy() {
+ this.idStrategy.addStrategy();
+ this.mapsIdStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public void unsetIdDerivedIdentityStrategy() {
+ this.idStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean usesIdDerivedIdentityStrategy() {
+ return this.strategy == this.idStrategy;
+ }
+
+ protected OrmIdDerivedIdentityStrategy2_0 buildIdStrategy() {
+ return new GenericOrmIdDerivedIdentityStrategy2_0(this);
+ }
+
+
+ // ********** maps ID strategy **********
+
+ public OrmMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() {
+ return this.mapsIdStrategy;
+ }
+
+ public void setMapsIdDerivedIdentityStrategy() {
+ this.mapsIdStrategy.addStrategy();
+ this.idStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public void unsetMapsIdDerivedIdentityStrategy() {
+ this.mapsIdStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean usesMapsIdDerivedIdentityStrategy() {
+ return this.strategy == this.mapsIdStrategy;
+ }
+
+ protected OrmMapsIdDerivedIdentityStrategy2_0 buildMapsIdStrategy() {
+ return new GenericOrmMapsIdDerivedIdentityStrategy2_0(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmSingleRelationshipMapping2_0 getParent() {
+ return (OrmSingleRelationshipMapping2_0) super.getParent();
+ }
+
+ public OrmSingleRelationshipMapping2_0 getMapping() {
+ return this.getParent();
+ }
+
+ public void initializeFrom(OrmDerivedIdentity2_0 oldDerivedIdentity) {
+ this.idStrategy.initializeFrom(oldDerivedIdentity.getIdDerivedIdentityStrategy());
+ this.mapsIdStrategy.initializeFrom(oldDerivedIdentity.getMapsIdDerivedIdentityStrategy());
+ this.updateStrategy();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.idStrategy.validate(messages, reporter);
+ this.mapsIdStrategy.validate(messages, reporter);
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getMapping().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
new file mode 100644
index 0000000000..105c822071
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0, which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+
+public class GenericOrmElementCollectionMapping2_0
+ extends AbstractOrmElementCollectionMapping2_0<XmlElementCollection>
+{
+ public GenericOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
+ super(parent, resourceMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java
new file mode 100644
index 0000000000..7d5525de4d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+
+/**
+ * JPA 2.0
+ * <code>orm.xml</code> embeddable type mapping
+ */
+public class GenericOrmEmbeddable2_0
+ extends AbstractOrmEmbeddable<XmlEmbeddable>
+{
+ public GenericOrmEmbeddable2_0(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
+ super(parent, resourceMapping);
+ }
+
+ @Override
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return ArrayTools.contains(GenericJavaEmbeddable2_0.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..cdf4e2a343
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmIdDerivedIdentityStrategy2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmIdDerivedIdentityStrategy2_0
+{
+ protected boolean value;
+
+
+ public GenericOrmIdDerivedIdentityStrategy2_0(OrmDerivedIdentity2_0 parent) {
+ super(parent);
+ this.value = this.buildValue();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** value **********
+
+ public boolean getValue() {
+ return this.value;
+ }
+
+ public void setValue(boolean value) {
+ this.setValue_(value);
+ this.getXmlMapping().setId(value ? Boolean.TRUE : null);
+ }
+
+ protected void setValue_(boolean value) {
+ boolean old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ protected boolean buildValue() {
+ Boolean xmlValue = this.getXmlMapping().getId();
+ return (xmlValue != null) && xmlValue.booleanValue();
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmDerivedIdentity2_0 getParent() {
+ return (OrmDerivedIdentity2_0) super.getParent();
+ }
+
+ protected OrmDerivedIdentity2_0 getDerivedIdentity() {
+ return this.getParent();
+ }
+
+ protected OrmSingleRelationshipMapping2_0 getMapping() {
+ return this.getDerivedIdentity().getMapping();
+ }
+
+ protected XmlSingleRelationshipMapping_2_0 getXmlMapping() {
+ return this.getMapping().getXmlAttributeMapping();
+ }
+
+ public boolean isSpecified() {
+ return this.value;
+ }
+
+ public void addStrategy() {
+ this.setValue(true);
+ }
+
+ public void removeStrategy() {
+ this.setValue(false);
+ }
+
+ public void initializeFrom(OrmIdDerivedIdentityStrategy2_0 oldStrategy) {
+ this.setValue(oldStrategy.getValue());
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return this.getXmlMapping().getIdTextRange();
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ // no validation rules
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..a795658ba1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import java.util.List;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.Embeddable;
+import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+public class GenericOrmMapsIdDerivedIdentityStrategy2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmMapsIdDerivedIdentityStrategy2_0
+{
+ protected String specifiedValue;
+ // no default value
+
+
+ public GenericOrmMapsIdDerivedIdentityStrategy2_0(OrmDerivedIdentity2_0 parent) {
+ super(parent);
+ this.specifiedValue = this.getXmlMapping().getMapsId();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedValue_(this.getXmlMapping().getMapsId());
+ }
+
+
+ // ********** value **********
+
+ public String getValue() {
+ // there is no default value
+ return this.specifiedValue;
+ }
+
+ public String getSpecifiedValue() {
+ return this.specifiedValue;
+ }
+
+ public void setSpecifiedValue(String value) {
+ this.setSpecifiedValue_(value);
+ this.getXmlMapping().setMapsId(value);
+ }
+
+ protected void setSpecifiedValue_(String value) {
+ String old = this.specifiedValue;
+ this.specifiedValue = value;
+ this.firePropertyChanged(SPECIFIED_VALUE_PROPERTY, old, value);
+ }
+
+ public String getDefaultValue() {
+ // there is no way to have default values in xml
+ return null;
+ }
+
+ public boolean usesDefaultValue() {
+ return false;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmDerivedIdentity2_0 getParent() {
+ return (OrmDerivedIdentity2_0) super.getParent();
+ }
+
+ protected OrmDerivedIdentity2_0 getDerivedIdentity() {
+ return this.getParent();
+ }
+
+ public OrmSingleRelationshipMapping2_0 getMapping() {
+ return this.getDerivedIdentity().getMapping();
+ }
+
+ protected OrmPersistentAttribute getPersistentAttribute() {
+ return this.getMapping().getPersistentAttribute();
+ }
+
+ protected XmlSingleRelationshipMapping_2_0 getXmlMapping() {
+ return this.getMapping().getXmlAttributeMapping();
+ }
+
+ protected Iterable<AttributeMapping> getAllAttributeMappings() {
+ return CollectionTools.collection(this.getPersistentAttribute().getOwningTypeMapping().allAttributeMappings());
+ }
+
+ public Iterable<String> getSortedValueChoices() {
+ return CollectionTools.sort(this.getAllAttributeMappingChoiceNames());
+ }
+
+ protected Iterable<String> getAllAttributeMappingChoiceNames() {
+ return new TransformationIterable<AttributeMapping, String>(this.getAllAttributeMappingChoices()) {
+ @Override
+ protected String transform(AttributeMapping mapping) {
+ return mapping.getName();
+ }
+ };
+ }
+
+ protected Iterable<AttributeMapping> getAllAttributeMappingChoices() {
+ return this.buildAttributeMappingChoices(this.getAllAttributeMappings());
+ }
+
+ protected Iterable<AttributeMapping> buildAttributeMappingChoices(Iterable<AttributeMapping> attributeMappings) {
+ return new CompositeIterable<AttributeMapping>(this.getAttributeMappingChoiceIterables(attributeMappings));
+ }
+
+ /**
+ * @see #getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping)
+ */
+ protected Iterable<Iterable<AttributeMapping>> getAttributeMappingChoiceIterables(Iterable<AttributeMapping> availableMappings) {
+ return new TransformationIterable<AttributeMapping, Iterable<AttributeMapping>>(availableMappings) {
+ @Override
+ protected Iterable<AttributeMapping> transform(AttributeMapping o) {
+ return Tools.valuesAreEqual(o.getKey(), MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) ?
+ GenericOrmMapsIdDerivedIdentityStrategy2_0.this.getEmbeddedIdMappingChoiceIterable((EmbeddedIdMapping) o) :
+ new SingleElementIterable<AttributeMapping>(o);
+ }
+ };
+ }
+
+ /**
+ * Convert the specified mapping into a collection of its "mappings".
+ * Typically, this collection will include just the mapping itself;
+ * but, if the mapping is an embedded ID, this collection will include
+ * the mapping itself plus all the mappings of its target embeddable.
+ */
+ protected Iterable<AttributeMapping> getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping mapping) {
+ Embeddable embeddable = mapping.getTargetEmbeddable();
+ if (embeddable == null) {
+ return new SingleElementIterable<AttributeMapping>(mapping);
+ }
+ return new CompositeIterable<AttributeMapping>(
+ mapping,
+ CollectionTools.collection(embeddable.allAttributeMappings())
+ );
+ }
+
+ public AttributeMapping getResolvedAttributeMappingValue() {
+ String value = this.getValue();
+ if (value != null) {
+ for (AttributeMapping mapping : this.getAllAttributeMappingChoices()) {
+ if (value.equals(mapping.getName())) {
+ return mapping;
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isSpecified() {
+ return this.getXmlMapping().getMapsId() != null;
+ }
+
+ public void addStrategy() {
+ this.getXmlMapping().setMapsId(""); //$NON-NLS-1$
+ }
+
+ public void removeStrategy() {
+ this.getXmlMapping().setMapsId(null);
+ }
+
+ public void initializeFrom(OrmMapsIdDerivedIdentityStrategy2_0 oldStrategy) {
+ this.setSpecifiedValue(oldStrategy.getSpecifiedValue());
+ }
+
+
+ // ********** ID mappings **********
+
+ protected Iterable<AttributeMapping> getIdAttributeMappings() {
+ return new FilteringIterable<AttributeMapping>(this.getAllAttributeMappings()) {
+ @Override
+ protected boolean accept(AttributeMapping mapping) {
+ return GenericOrmMapsIdDerivedIdentityStrategy2_0.this.mappingIsIdMapping(mapping);
+ }
+ };
+ }
+
+ protected boolean mappingIsIdMapping(AttributeMapping mapping) {
+ return CollectionTools.contains(this.getIdMappingKeys(), mapping.getKey());
+ }
+
+ protected Iterable<String> getIdMappingKeys() {
+ return ID_MAPPING_KEYS;
+ }
+
+ protected static final String[] ID_MAPPING_KEYS_ARRAY = new String[] {
+ MappingKeys.ID_ATTRIBUTE_MAPPING_KEY,
+ MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY
+ };
+
+ protected static final Iterable<String> ID_MAPPING_KEYS = new ArrayIterable<String>(ID_MAPPING_KEYS_ARRAY);
+
+
+ // ********** validation **********
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter) {
+ super.validate(messages, reporter);
+ this.validateMapsId(messages);
+ }
+
+ protected void validateMapsId(List<IMessage> messages) {
+ if (this.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy()) {
+ this.validateMapsId_(messages);
+ }
+ }
+
+ protected void validateMapsId_(List<IMessage> messages) {
+ // test whether value can be resolved
+ AttributeMapping attributeMapping = this.getResolvedAttributeMappingValue();
+ if (attributeMapping == null) {
+ // there is no defaulting, so only use the 'resolved' error, even if the value is empty string
+ messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_NOT_RESOLVED, new String[] {this.getValue()}));
+ } else {
+ // test whether attribute mapping is allowable
+ if ( ! CollectionTools.contains(this.getValidAttributeMappingChoices(), attributeMapping)) {
+ messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_INVALID, new String[] {this.getValue()}));
+ }
+ }
+ }
+
+ protected Iterable<AttributeMapping> getValidAttributeMappingChoices() {
+ return this.buildAttributeMappingChoices(this.getIdAttributeMappings());
+ }
+
+ protected IMessage buildMessage(String msgID, String[] parms) {
+ PersistentAttribute attribute = this.getPersistentAttribute();
+ String attributeDescription = attribute.isVirtual() ?
+ JpaValidationDescriptionMessages.VIRTUAL_ATTRIBUTE_DESC :
+ JpaValidationDescriptionMessages.ATTRIBUTE_DESC;
+ attributeDescription = NLS.bind(attributeDescription, attribute.getName());
+ parms = ArrayTools.add(parms, 0, attributeDescription);
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ parms,
+ this,
+ this.getValidationTextRange()
+ );
+ }
+
+ public TextRange getValidationTextRange() {
+ TextRange textRange = this.getXmlMapping().getMapsIdTextRange();
+ return (textRange != null) ? textRange : this.getDerivedIdentity().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
new file mode 100644
index 0000000000..639bf61ada
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
+import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmNamedQuery2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
+
+/**
+ * JPA 2.0
+ * <code>orm.xml</code> named query
+ */
+public class GenericOrmNamedQuery2_0
+ extends AbstractOrmQuery<XmlNamedQuery>
+ implements OrmNamedQuery2_0
+{
+ private LockModeType2_0 specifiedLockMode;
+ private LockModeType2_0 defaultLockMode;
+
+
+ public GenericOrmNamedQuery2_0(XmlContextNode parent, XmlNamedQuery xmlNamedQuery) {
+ super(parent, xmlNamedQuery);
+ this.specifiedLockMode = this.buildSpecifiedLockMode();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedLockMode_(this.buildSpecifiedLockMode());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultLockMode(this.buildDefaultLockMode());
+ }
+
+
+ // ********** lock mode **********
+
+ public LockModeType2_0 getLockMode() {
+ return (this.specifiedLockMode != null) ? this.specifiedLockMode : this.defaultLockMode;
+ }
+
+ public LockModeType2_0 getSpecifiedLockMode() {
+ return this.specifiedLockMode;
+ }
+
+ public void setSpecifiedLockMode(LockModeType2_0 lockMode) {
+ this.setSpecifiedLockMode_(lockMode);
+ this.xmlQuery.setLockMode(LockModeType2_0.toOrmResourceModel(lockMode));
+ }
+
+ public void setSpecifiedLockMode_(LockModeType2_0 lockMode) {
+ LockModeType2_0 old = this.specifiedLockMode;
+ this.specifiedLockMode = lockMode;
+ this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode);
+ }
+
+ protected LockModeType2_0 buildSpecifiedLockMode() {
+ return LockModeType2_0.fromOrmResourceModel(this.xmlQuery.getLockMode());
+ }
+
+ public LockModeType2_0 getDefaultLockMode() {
+ return this.defaultLockMode;
+ }
+
+ protected void setDefaultLockMode(LockModeType2_0 lockMode) {
+ LockModeType2_0 old = this.defaultLockMode;
+ this.defaultLockMode = lockMode;
+ this.firePropertyChanged(DEFAULT_LOCK_MODE_PROPERTY, old, lockMode);
+ }
+
+ protected LockModeType2_0 buildDefaultLockMode() {
+ return LockModeType2_0.NONE;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
new file mode 100644
index 0000000000..48922a3903
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn;
+
+/**
+ * <code>orm.xml</code> order column
+ */
+public class GenericOrmOrderColumn2_0
+ extends AbstractOrmNamedColumn<XmlOrderColumn, OrmOrderColumn2_0.Owner>
+ implements OrmOrderColumn2_0
+{
+ // TODO defaults from java for all of these settings
+ protected Boolean specifiedNullable;
+
+ protected Boolean specifiedInsertable;
+
+ protected Boolean specifiedUpdatable;
+
+
+ public GenericOrmOrderColumn2_0(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner) {
+ super(parent, owner);
+ this.specifiedNullable = this.buildSpecifiedNullable();
+ this.specifiedInsertable = this.buildSpecifiedInsertable();
+ this.specifiedUpdatable = this.buildSpecifiedUpdatable();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedNullable_(this.buildSpecifiedNullable());
+ this.setSpecifiedInsertable_(this.buildSpecifiedInsertable());
+ this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable());
+ }
+
+
+ // ********** XML column **********
+
+ @Override
+ public XmlOrderColumn getXmlColumn() {
+ return this.owner.getXmlColumn();
+ }
+
+ @Override
+ protected XmlOrderColumn buildXmlColumn() {
+ return this.owner.buildXmlColumn();
+ }
+
+ @Override
+ protected void removeXmlColumn() {
+ this.owner.removeXmlColumn();
+ }
+
+
+ // ********** nullable **********
+
+ public boolean isNullable() {
+ return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable();
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean nullable) {
+ if (this.valuesAreDifferent(this.specifiedNullable, nullable)) {
+ XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedNullable_(nullable);
+ xmlColumn.setNullable(nullable);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedNullable_(Boolean nullable) {
+ Boolean old = this.specifiedNullable;
+ this.specifiedNullable = nullable;
+ this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable);
+ }
+
+ protected Boolean buildSpecifiedNullable() {
+ XmlOrderColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getNullable();
+ }
+
+ public boolean isDefaultNullable() {
+ return DEFAULT_NULLABLE;
+ }
+
+
+ // ********** insertable **********
+
+ public boolean isInsertable() {
+ return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable();
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean insertable) {
+ if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) {
+ XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedInsertable_(insertable);
+ xmlColumn.setInsertable(insertable);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedInsertable_(Boolean insertable) {
+ Boolean old = this.specifiedInsertable;
+ this.specifiedInsertable = insertable;
+ this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ protected Boolean buildSpecifiedInsertable() {
+ XmlOrderColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getInsertable();
+ }
+
+ public boolean isDefaultInsertable() {
+ return DEFAULT_INSERTABLE;
+ }
+
+
+ // ********** updatable **********
+
+ public boolean isUpdatable() {
+ return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable();
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean updatable) {
+ if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) {
+ XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate();
+ this.setSpecifiedUpdatable_(updatable);
+ xmlColumn.setUpdatable(updatable);
+ this.removeXmlColumnIfUnset();
+ }
+ }
+
+ protected void setSpecifiedUpdatable_(Boolean updatable) {
+ Boolean old = this.specifiedUpdatable;
+ this.specifiedUpdatable = updatable;
+ this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ protected Boolean buildSpecifiedUpdatable() {
+ XmlOrderColumn xmlColumn = this.getXmlColumn();
+ return (xmlColumn == null) ? null : xmlColumn.getUpdatable();
+ }
+
+ public boolean isDefaultUpdatable() {
+ return DEFAULT_UPDATABLE;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmOrderable2_0 getParent() {
+ return (OrmOrderable2_0) super.getParent();
+ }
+
+ protected OrmOrderable2_0 getOrderable() {
+ return this.getParent();
+ }
+
+ protected OrmAttributeMapping getAttributeMapping() {
+ return this.getOrderable().getParent();
+ }
+
+ protected PersistentAttribute getPersistentAttribute() {
+ return this.getAttributeMapping().getPersistentAttribute();
+ }
+
+ @Override
+ public String getTable() {
+ return this.getParent().getDefaultTableName();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
new file mode 100644
index 0000000000..69ec1920af
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0;
+
+/**
+ * <code>orm.xml</code> orphan removal
+ */
+public class GenericOrmOrphanRemoval2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmOrphanRemovable2_0
+{
+ protected Boolean specifiedOrphanRemoval;
+ protected boolean defaultOrphanRemoval;
+
+
+ public GenericOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent) {
+ super(parent);
+ this.specifiedOrphanRemoval = this.buildSpecifiedOrphanRemoval();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedOrphanRemoval_(this.buildSpecifiedOrphanRemoval());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultOrphanRemoval(this.buildDefaultOrphanRemoval());
+ }
+
+
+ // ********** orphan removal **********
+
+ public boolean isOrphanRemoval() {
+ return (this.specifiedOrphanRemoval != null) ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval;
+ }
+
+ public Boolean getSpecifiedOrphanRemoval() {
+ return this.specifiedOrphanRemoval;
+ }
+
+ public void setSpecifiedOrphanRemoval(Boolean orphanRemoval) {
+ this.setSpecifiedOrphanRemoval_(orphanRemoval);
+ this.getXmlOrphanRemovable().setOrphanRemoval(orphanRemoval);
+ }
+
+ protected void setSpecifiedOrphanRemoval_(Boolean orphanRemoval) {
+ Boolean old = this.specifiedOrphanRemoval;
+ this.specifiedOrphanRemoval = orphanRemoval;
+ this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
+ }
+
+ protected Boolean buildSpecifiedOrphanRemoval() {
+ return this.getXmlOrphanRemovable().getOrphanRemoval();
+ }
+
+ public boolean isDefaultOrphanRemoval() {
+ return this.defaultOrphanRemoval;
+ }
+
+ protected void setDefaultOrphanRemoval(boolean orphanRemoval) {
+ boolean old = this.defaultOrphanRemoval;
+ this.defaultOrphanRemoval = orphanRemoval;
+ this.firePropertyChanged(DEFAULT_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
+ }
+
+ protected boolean buildDefaultOrphanRemoval() {
+ return DEFAULT_ORPHAN_REMOVAL;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmOrphanRemovalHolder2_0 getParent() {
+ return (OrmOrphanRemovalHolder2_0) super.getParent();
+ }
+
+ protected OrmAttributeMapping getMapping() {
+ return (OrmAttributeMapping) this.getParent();
+ }
+
+ protected XmlAttributeMapping getXmlMapping() {
+ return this.getMapping().getXmlAttributeMapping();
+ }
+
+ protected XmlOrphanRemovable_2_0 getXmlOrphanRemovable() {
+ return (XmlOrphanRemovable_2_0) this.getXmlMapping();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ // TODO
+ return this.getXmlOrphanRemovable().getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java
new file mode 100644
index 0000000000..12ca663dbf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOverrideRelationship2_0;
+
+public class GenericOrmOverrideJoinTableRelationshipStrategy2_0
+ extends AbstractOrmJoinTableRelationshipStrategy
+{
+ public GenericOrmOverrideJoinTableRelationshipStrategy2_0(OrmOverrideRelationship2_0 parent) {
+ super(parent);
+ }
+
+
+ @Override
+ public OrmOverrideRelationship2_0 getRelationship() {
+ return (OrmOverrideRelationship2_0) super.getRelationship();
+ }
+
+ public boolean isOverridable() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public boolean validatesAgainstDatabase() {
+ return this.getRelationship().getTypeMapping().validatesAgainstDatabase();
+ }
+
+ public TextRange getValidationTextRange() {
+ TextRange textRange = this.getRelationship().getAssociationOverride().getXmlOverride().getValidationTextRange();
+ return (textRange != null) ? textRange : this.getRelationship().getValidationTextRange();
+ }
+
+ public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.getRelationship().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
+ }
+
+ public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
+ return this.getRelationship().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
+ }
+
+ public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) {
+ return this.getRelationship().buildTableValidator(table, textRangeResolver);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java
new file mode 100644
index 0000000000..7b3684a80b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+
+/**
+ * JPA 2.0
+ * <code>orm.xml</code> persistent attribute
+ */
+public class GenericOrmPersistentAttribute2_0
+ extends SpecifiedOrmPersistentAttribute
+{
+ protected AccessType specifiedAccess;
+
+
+ public GenericOrmPersistentAttribute2_0(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
+ super(parent, xmlMapping);
+ this.specifiedAccess = this.buildSpecifiedAccess();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedAccess_(this.buildSpecifiedAccess());
+ }
+
+
+ // ********** access **********
+
+ @Override
+ public AccessType getSpecifiedAccess() {
+ return this.specifiedAccess;
+ }
+
+ public void setSpecifiedAccess(AccessType access) {
+ this.setSpecifiedAccess_(access);
+ this.getXmlAccessHolder().setAccess(AccessType.toOrmResourceModel(access));
+ }
+
+ protected void setSpecifiedAccess_(AccessType access) {
+ AccessType old = this.specifiedAccess;
+ this.specifiedAccess = access;
+ this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access);
+ }
+
+ protected AccessType buildSpecifiedAccess() {
+ return AccessType.fromOrmResourceModel(this.getXmlAccessHolder().getAccess());
+ }
+
+ protected XmlAccessHolder getXmlAccessHolder() {
+ return this.getXmlAttributeMapping();
+ }
+
+
+ // ********** validation **********
+
+ @Override
+ protected JptValidator buildAttibuteValidator() {
+ return new GenericPersistentAttributeValidator(this, this.getJavaPersistentAttribute(), this.buildTextRangeResolver());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java
new file mode 100644
index 0000000000..548a4a0f50
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSequenceGenerator2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+
+/**
+ * JPA 2.0
+ * <code>orm.xml</code> sequence generator
+ */
+public class GenericOrmSequenceGenerator2_0
+ extends AbstractOrmSequenceGenerator
+ implements OrmSequenceGenerator2_0
+{
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+
+ public GenericOrmSequenceGenerator2_0(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) {
+ super(parent, xmlSequenceGenerator);
+ this.specifiedCatalog = xmlSequenceGenerator.getCatalog();
+ this.specifiedSchema = xmlSequenceGenerator.getSchema();
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void synchronizeWithResourceModel() {
+ super.synchronizeWithResourceModel();
+ this.setSpecifiedCatalog_(this.xmlGenerator.getCatalog());
+ this.setSpecifiedSchema_(this.xmlGenerator.getSchema());
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultCatalog(this.buildDefaultCatalog());
+ this.setDefaultSchema(this.buildDefaultSchema());
+ }
+
+
+ // ********** catalog **********
+
+ @Override
+ public String getCatalog() {
+ return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String catalog) {
+ this.setSpecifiedCatalog_(catalog);
+ this.xmlGenerator.setCatalog(catalog);
+ }
+
+ protected void setSpecifiedCatalog_(String catalog) {
+ String old = this.specifiedCatalog;
+ this.specifiedCatalog = catalog;
+ this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String catalog) {
+ String old = this.defaultCatalog;
+ this.defaultCatalog = catalog;
+ this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
+ }
+
+ protected String buildDefaultCatalog() {
+ return this.getContextDefaultCatalog();
+ }
+
+
+ // ********** schema **********
+
+ @Override
+ public String getSchema() {
+ return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String schema) {
+ this.setSpecifiedSchema_(schema);
+ this.xmlGenerator.setSchema(schema);
+ }
+
+ protected void setSpecifiedSchema_(String schema) {
+ String old = this.specifiedSchema;
+ this.specifiedSchema = schema;
+ this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String schema) {
+ String old = this.defaultSchema;
+ this.defaultSchema = schema;
+ this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
+ }
+
+ protected String buildDefaultSchema() {
+ return this.getContextDefaultSchema();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java
new file mode 100644
index 0000000000..72502c6d33
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.JoinTable;
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+
+public class GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmVirtualJoinTableRelationshipStrategy
+{
+ protected OrmVirtualJoinTable joinTable;
+
+
+ public GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0(OrmVirtualJoinTableRelationship parent) {
+ super(parent);
+ }
+
+
+ // ********** synchronize/update **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinTable();
+ }
+
+
+ // ********** join table **********
+
+ public OrmVirtualJoinTable getJoinTable() {
+ return this.joinTable;
+ }
+
+ protected void setJoinTable(OrmVirtualJoinTable joinTable) {
+ OrmVirtualJoinTable old = this.joinTable;
+ this.joinTable = joinTable;
+ this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable);
+ }
+
+ protected void updateJoinTable() {
+ JoinTable overriddenJoinTable = this.getOverriddenJoinTable();
+ if (overriddenJoinTable == null) {
+ if (this.joinTable != null) {
+ this.setJoinTable(null);
+ }
+ } else {
+ if ((this.joinTable != null) && (this.joinTable.getOverriddenTable() == overriddenJoinTable)) {
+ this.joinTable.update();
+ } else {
+ this.setJoinTable(this.buildJoinTable(overriddenJoinTable));
+ }
+ }
+ }
+
+ protected JoinTable getOverriddenJoinTable() {
+ JoinTableRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
+ return (overriddenStrategy == null) ? null : overriddenStrategy.getJoinTable();
+ }
+
+ protected OrmVirtualJoinTable buildJoinTable(JoinTable overriddenJoinTable) {
+ return this.getContextNodeFactory().buildOrmVirtualJoinTable(this, overriddenJoinTable);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public OrmVirtualJoinTableRelationship getParent() {
+ return (OrmVirtualJoinTableRelationship) super.getParent();
+ }
+
+ public OrmVirtualJoinTableRelationship getRelationship() {
+ return this.getParent();
+ }
+
+ protected JoinTableRelationshipStrategy getOverriddenStrategy() {
+ JoinTableRelationship relationship = this.getOverriddenJoinTableRelationship();
+ return (relationship == null) ? null : relationship.getJoinTableStrategy();
+ }
+
+ protected JoinTableRelationship getOverriddenJoinTableRelationship() {
+ Relationship relationship = this.resolveOverriddenRelationship();
+ return (relationship instanceof JoinTableRelationship) ? (JoinTableRelationship) relationship : null;
+ }
+
+ protected Relationship resolveOverriddenRelationship() {
+ return this.getRelationship().resolveOverriddenRelationship();
+ }
+
+ public String getTableName() {
+ return this.joinTable.getName();
+ }
+
+ public String getJoinTableDefaultName() {
+ return MappingTools.buildJoinTableDefaultName(this.getRelationship());
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
new file mode 100644
index 0000000000..6da85e8058
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer.Owner;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOrderable;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+
+public class GenericOrmXml2_0ContextNodeFactory
+ extends AbstractOrmXmlContextNodeFactory
+ implements OrmXml2_0ContextNodeFactory
+{
+ @Override
+ public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) {
+ throw new UnsupportedOperationException("use #buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner)"); //$NON-NLS-1$
+ }
+
+ @Override
+ public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
+ return new GenericOrmEmbeddable2_0(parent, resourceMapping);
+ }
+
+ @Override
+ public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
+ return new GenericOrmPersistentAttribute2_0(parent, xmlMapping);
+ }
+
+ @Override
+ public OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) {
+ return new GenericOrmSequenceGenerator2_0(parent, resourceSequenceGenerator);
+ }
+
+ public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEmbeddedMapping2_0 parent, Owner owner) {
+ return new GenericOrmAssociationOverrideContainer(parent, owner);
+ }
+
+ public OrmDerivedIdentity2_0 buildOrmDerivedIdentity(OrmSingleRelationshipMapping2_0 parent) {
+ return new GenericOrmDerivedIdentity2_0(parent);
+ }
+
+ public OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0(
+ OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
+
+ return new GenericOrmElementCollectionMapping2_0(parent, resourceMapping);
+ }
+
+ public OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent) {
+ return new GenericOrmCacheable2_0(parent);
+ }
+
+ public OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent) {
+ return new GenericOrmOrphanRemoval2_0(parent);
+ }
+
+ @Override
+ public OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
+ return new GenericOrmNamedQuery2_0(parent, resourceNamedQuery);
+ }
+
+ public OrmCollectionTable2_0 buildOrmCollectionTable(OrmElementCollectionMapping2_0 parent, Table.Owner owner) {
+ return new GenericOrmCollectionTable2_0(parent, owner);
+ }
+
+ public OrmOrderable2_0 buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner) {
+ return new GenericOrmOrderable(parent, owner);
+ }
+
+ public OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner) {
+ return new GenericOrmOrderColumn2_0(parent, owner);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
new file mode 100644
index 0000000000..25d286b699
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import java.util.ArrayList;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEntityDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmMappedSuperclassDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+
+public class GenericOrmXml2_0Definition
+ extends AbstractOrmXmlDefinition
+{
+ // singleton
+ private static final OrmXmlDefinition INSTANCE = new GenericOrmXml2_0Definition();
+
+ /**
+ * Return the singleton
+ */
+ public static OrmXmlDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private GenericOrmXml2_0Definition() {
+ super();
+ }
+
+ public JptResourceType getResourceType() {
+ return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
+ }
+
+ public EFactory getResourceNodeFactory() {
+ return OrmFactory.eINSTANCE;
+ }
+
+ @Override
+ protected OrmXmlContextNodeFactory buildContextNodeFactory() {
+ return new GenericOrmXml2_0ContextNodeFactory();
+ }
+
+ @Override
+ protected void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS);
+ }
+
+ /**
+ * Order should not matter here; but we'll use the same order as for Java.
+ * @see Generic2_0JpaPlatformProvider
+ */
+ protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] {
+ OrmEntityDefinition.instance(),
+ OrmEmbeddableDefinition.instance(),
+ OrmMappedSuperclassDefinition.instance()
+ };
+
+ @Override
+ protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ /**
+ * Order should not matter here; but we'll use the same order as for Java.
+ * @see Generic2_0JpaPlatformProvider
+ */
+ protected static final OrmAttributeMappingDefinition[] ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] {
+ OrmTransientMappingDefinition.instance(),
+ OrmElementCollectionMapping2_0Definition.instance(),
+ OrmIdMappingDefinition.instance(),
+ OrmVersionMappingDefinition.instance(),
+ OrmBasicMappingDefinition.instance(),
+ OrmEmbeddedMappingDefinition.instance(),
+ OrmEmbeddedIdMappingDefinition.instance(),
+ OrmManyToManyMappingDefinition.instance(),
+ OrmManyToOneMappingDefinition.instance(),
+ OrmOneToManyMappingDefinition.instance(),
+ OrmOneToOneMappingDefinition.instance(),
+ NullOrmAttributeMappingDefinition.instance()
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java
new file mode 100644
index 0000000000..7ae634f53b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
+
+/**
+ * null <code>orm.xml</code> cacheable
+ */
+public class NullOrmCacheable2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmCacheable2_0
+{
+ public NullOrmCacheable2_0(OrmCacheableHolder2_0 parent) {
+ super(parent);
+ }
+
+
+ // ********** cacheable **********
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public Boolean getSpecifiedCacheable() {
+ return null;
+ }
+
+ public void setSpecifiedCacheable(Boolean cacheable) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isDefaultCacheable() {
+ return false;
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java
new file mode 100644
index 0000000000..9bb81d55ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
+
+public class NullOrmDerivedIdentity2_0
+ extends AbstractXmlContextNode
+ implements OrmDerivedIdentity2_0
+{
+ public NullOrmDerivedIdentity2_0(OrmSingleRelationshipMapping2_0 parent) {
+ super(parent);
+ }
+
+
+
+ // ********** predominant derived identity strategy **********
+
+ public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() {
+ return null;
+ }
+
+
+ // ********** null derived identity strategy **********
+
+ public boolean usesNullDerivedIdentityStrategy() {
+ return true;
+ }
+
+ public void setNullDerivedIdentityStrategy() {
+ // NOP
+ }
+
+
+ // ********** ID derived identity strategy **********
+
+ public OrmIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() {
+ return null;
+ }
+
+ public boolean usesIdDerivedIdentityStrategy() {
+ return false;
+ }
+
+ public void setIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+ public void unsetIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+
+ // ********** maps ID derived identity strategy **********
+
+ public OrmMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() {
+ return null;
+ }
+
+ public boolean usesMapsIdDerivedIdentityStrategy() {
+ return false;
+ }
+
+ public void setMapsIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+ public void unsetMapsIdDerivedIdentityStrategy() {
+ // NOP
+ }
+
+
+ // ********** misc **********
+
+ public OrmSingleRelationshipMapping2_0 getMapping() {
+ return (OrmSingleRelationshipMapping2_0) this.getParent();
+ }
+
+ public void initializeFrom(OrmDerivedIdentity2_0 oldDerivedIdentity) {
+ // NOP
+ }
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
new file mode 100644
index 0000000000..6ecbf93f32
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
+
+/**
+ * Null <code>orm.xml</code> orphan removal
+ */
+public class NullOrmOrphanRemoval2_0
+ extends AbstractOrmXmlContextNode
+ implements OrmOrphanRemovable2_0
+{
+ public NullOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent) {
+ super(parent);
+ }
+
+
+ // ********** orphan removal **********
+
+ public boolean isDefaultOrphanRemoval() {
+ return false;
+ }
+
+ public boolean isOrphanRemoval() {
+ return false;
+ }
+
+ public Boolean getSpecifiedOrphanRemoval() {
+ return null;
+ }
+
+ public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** validation **********
+
+ public TextRange getValidationTextRange() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java
new file mode 100644
index 0000000000..44e92594b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
+
+public class OrmElementCollectionMapping2_0Definition
+ implements OrmAttributeMappingDefinition
+{
+ // singleton
+ private static final OrmAttributeMappingDefinition INSTANCE =
+ new OrmElementCollectionMapping2_0Definition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static OrmAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private OrmElementCollectionMapping2_0Definition() {
+ super();
+ }
+
+
+ public String getKey() {
+ return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlAttributeMapping buildResourceMapping(EFactory factory) {
+ return EmfTools.create(
+ factory,
+ OrmPackage.eINSTANCE.getXmlElementCollection(),
+ XmlElementCollection.class);
+ }
+
+ public OrmAttributeMapping buildContextMapping(
+ OrmPersistentAttribute parent,
+ XmlAttributeMapping xmlMapping,
+ OrmXmlContextNodeFactory factory) {
+ return ((OrmXml2_0ContextNodeFactory) factory).buildOrmElementCollectionMapping2_0(parent, (XmlElementCollection) xmlMapping);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
new file mode 100644
index 0000000000..cc6131ac51
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.GenericConnection2_0;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.GenericOptions2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0;
+
+
+public class Generic2_0PersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
+{
+
+ public JpaConnection2_0 buildConnection(PersistenceUnit parent) {
+ return new GenericConnection2_0(parent);
+ }
+
+ public JpaOptions2_0 buildOptions(PersistenceUnit parent) {
+ return new GenericOptions2_0(parent);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
new file mode 100644
index 0000000000..c2ea049fd9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory;
+
+public class Generic2_0PersistenceXmlDefinition
+ extends AbstractPersistenceXmlDefinition
+{
+ // singleton
+ private static final PersistenceXmlDefinition INSTANCE = new Generic2_0PersistenceXmlDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static PersistenceXmlDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private Generic2_0PersistenceXmlDefinition() {
+ super();
+ }
+
+ public JptResourceType getResourceType() {
+ return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
+ }
+
+ public EFactory getResourceNodeFactory() {
+ return PersistenceV2_0Factory.eINSTANCE;
+ }
+
+ @Override
+ protected PersistenceXmlContextNodeFactory buildContextNodeFactory() {
+ return new Generic2_0PersistenceXmlContextNodeFactory();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java
new file mode 100644
index 0000000000..f8129b5932
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection;
+
+import java.util.Map;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0;
+
+/**
+ * GenericConnection2_0
+ */
+public class GenericConnection2_0 extends AbstractPersistenceUnitProperties
+ implements JpaConnection2_0
+{
+ // ********** GenericConnection properties **********
+ private String driver;
+ private String url;
+ private String user;
+ private String password;
+
+
+ // ********** constructors **********
+ public GenericConnection2_0(PersistenceUnit parent) {
+ super(parent);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ this.driver =
+ this.getStringValue(PERSISTENCE_JDBC_DRIVER);
+ this.url =
+ this.getStringValue(PERSISTENCE_JDBC_URL);
+ this.user =
+ this.getStringValue(PERSISTENCE_JDBC_USER);
+ this.password =
+ this.getStringValue(PERSISTENCE_JDBC_PASSWORD);
+ }
+
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) {
+ this.driverChanged(newValue);
+ }
+ else if (propertyName.equals(PERSISTENCE_JDBC_URL)) {
+ this.urlChanged(newValue);
+ }
+ else if (propertyName.equals(PERSISTENCE_JDBC_USER)) {
+ this.userChanged(newValue);
+ }
+ else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) {
+ this.passwordChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) {
+ this.driverChanged(null);
+ }
+ else if (propertyName.equals(PERSISTENCE_JDBC_URL)) {
+ this.urlChanged(null);
+ }
+ else if (propertyName.equals(PERSISTENCE_JDBC_USER)) {
+ this.userChanged(null);
+ }
+ else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) {
+ this.passwordChanged(null);
+ }
+ }
+
+ /**
+ * Adds property names key/value pairs, where:
+ * key = PU property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ propertyNames.put(
+ PERSISTENCE_JDBC_DRIVER,
+ DRIVER_PROPERTY);
+ propertyNames.put(
+ PERSISTENCE_JDBC_URL,
+ URL_PROPERTY);
+ propertyNames.put(
+ PERSISTENCE_JDBC_USER,
+ USER_PROPERTY);
+ propertyNames.put(
+ PERSISTENCE_JDBC_PASSWORD,
+ PASSWORD_PROPERTY);
+ }
+
+ // ********** Driver **********
+ public String getDriver() {
+ return this.driver;
+ }
+
+ public void setDriver(String newDriver) {
+ String old = this.driver;
+ this.driver = newDriver;
+ this.putProperty(DRIVER_PROPERTY, newDriver);
+ this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver);
+ }
+
+ private void driverChanged(String newValue) {
+ String old = this.driver;
+ this.driver = newValue;
+ this.firePropertyChanged(DRIVER_PROPERTY, old, newValue);
+ }
+
+ public String getDefaultDriver() {
+ return DEFAULT_JDBC_DRIVER;
+ }
+
+ // ********** URL **********
+ public String getUrl() {
+ return this.url;
+ }
+
+ public void setUrl(String newUrl) {
+ String old = this.url;
+ this.url = newUrl;
+ this.putProperty(URL_PROPERTY, newUrl);
+ this.firePropertyChanged(URL_PROPERTY, old, newUrl);
+ }
+
+ private void urlChanged(String newValue) {
+ String old = this.url;
+ this.url = newValue;
+ this.firePropertyChanged(URL_PROPERTY, old, newValue);
+ }
+
+ public String getDefaultUrl() {
+ return DEFAULT_JDBC_URL;
+ }
+
+ // ********** User **********
+ public String getUser() {
+ return this.user;
+ }
+
+ public void setUser(String newUser) {
+ String old = this.user;
+ this.user = newUser;
+ this.putProperty(USER_PROPERTY, newUser);
+ this.firePropertyChanged(USER_PROPERTY, old, newUser);
+ }
+
+ private void userChanged(String newValue) {
+ String old = this.user;
+ this.user = newValue;
+ this.firePropertyChanged(USER_PROPERTY, old, newValue);
+ }
+
+ public String getDefaultUser() {
+ return DEFAULT_JDBC_USER;
+ }
+
+ // ********** Password **********
+ public String getPassword() {
+ return this.password;
+ }
+
+ public void setPassword(String newPassword) {
+ String old = this.password;
+ this.password = newPassword;
+ this.putProperty(PASSWORD_PROPERTY, newPassword);
+ this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword);
+ }
+
+ private void passwordChanged(String newValue) {
+ String old = this.password;
+ this.password = newValue;
+ this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue);
+ }
+
+ public String getDefaultPassword() {
+ return DEFAULT_JDBC_PASSWORD;
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
new file mode 100644
index 0000000000..0131c28cb9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection;
+
+import java.util.Map;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0;
+
+/**
+ * GenericConnection2_0
+ */
+public class NullConnection2_0 extends AbstractPersistenceUnitProperties
+ implements JpaConnection2_0
+{
+
+
+ // ********** constructors **********
+ public NullConnection2_0(PersistenceUnit parent) {
+ super(parent);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ //do nothing
+ }
+
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ //do nothing
+ }
+
+ public void propertyRemoved(String propertyName) {
+ //do nothing
+ }
+
+ /**
+ * Adds property names key/value pairs, where:
+ * key = PU property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ //do nothing
+ }
+
+ // ********** Driver **********
+ public String getDriver() {
+ return null;
+ }
+
+ public void setDriver(String newDriver) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultDriver() {
+ return DEFAULT_JDBC_DRIVER;
+ }
+
+ // ********** URL **********
+ public String getUrl() {
+ return null;
+ }
+
+ public void setUrl(String newUrl) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultUrl() {
+ return DEFAULT_JDBC_URL;
+ }
+
+ // ********** User **********
+ public String getUser() {
+ return null;
+ }
+
+ public void setUser(String newUser) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultUser() {
+ return DEFAULT_JDBC_USER;
+ }
+
+ // ********** Password **********
+ public String getPassword() {
+ return null;
+ }
+
+ public void setPassword(String newPassword) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultPassword() {
+ return DEFAULT_JDBC_PASSWORD;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
new file mode 100644
index 0000000000..b432df0d5b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
@@ -0,0 +1,337 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options;
+
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0;
+
+/**
+ * JPA 2.0 options
+ */
+public class GenericOptions2_0 extends AbstractPersistenceUnitProperties
+ implements JpaOptions2_0
+{
+ // ********** GenericConnection properties **********
+ private Integer lockTimeout;
+ private Integer queryTimeout;
+ private List<String> validationGroupPrePersists;
+ private List<String> validationGroupPreUpdates;
+ private List<String> validationGroupPreRemoves;
+
+ // ********** constructors **********
+ public GenericOptions2_0(PersistenceUnit parent) {
+ super(parent);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ this.lockTimeout =
+ this.getIntegerValue(PERSISTENCE_LOCK_TIMEOUT);
+ this.queryTimeout =
+ this.getIntegerValue(PERSISTENCE_QUERY_TIMEOUT);
+
+ // ValidationMode is initialized with the persistence unit element
+ this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST);
+ this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE);
+ this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE);
+ }
+
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) {
+ this.lockTimeoutChanged(newValue);
+ }
+ else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) {
+ this.queryTimeoutChanged(newValue);
+ }
+ else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) {
+ this.validationGroupPrePersistsChanged();
+ }
+ else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) {
+ this.validationGroupPreUpdatesChanged();
+ }
+ else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) {
+ this.validationGroupPreRemovesChanged();
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) {
+ this.lockTimeoutChanged(null);
+ }
+ else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) {
+ this.queryTimeoutChanged(null);
+ }
+ else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) {
+ this.validationGroupPrePersistsChanged();
+ }
+ else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) {
+ this.validationGroupPreUpdatesChanged();
+ }
+ else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) {
+ this.validationGroupPreRemovesChanged();
+ }
+ }
+
+ /**
+ * Adds property names key/value pairs, where:
+ * key = PU property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ propertyNames.put(
+ PERSISTENCE_LOCK_TIMEOUT,
+ LOCK_TIMEOUT_PROPERTY);
+ propertyNames.put(
+ PERSISTENCE_QUERY_TIMEOUT,
+ QUERY_TIMEOUT_PROPERTY);
+ propertyNames.put(
+ PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST,
+ VALIDATION_GROUP_PRE_PERSIST_PROPERTY);
+ propertyNames.put(
+ PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE,
+ VALIDATION_GROUP_PRE_UPDATE_PROPERTY);
+ propertyNames.put(
+ PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE,
+ VALIDATION_GROUP_PRE_REMOVE_PROPERTY);
+ }
+
+ @Override
+ public PersistenceUnit2_0 getPersistenceUnit() {
+ return (PersistenceUnit2_0) super.getPersistenceUnit();
+ }
+
+ // ********** LockTimeout **********
+ public Integer getLockTimeout() {
+ return this.lockTimeout;
+ }
+
+ public void setLockTimeout(Integer newLockTimeout) {
+ Integer old = this.lockTimeout;
+ this.lockTimeout = newLockTimeout;
+ this.putProperty(LOCK_TIMEOUT_PROPERTY, newLockTimeout);
+ this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newLockTimeout);
+ }
+
+ private void lockTimeoutChanged(String stringValue) {
+ Integer newValue = getIntegerValueOf(stringValue);
+
+ Integer old = this.lockTimeout;
+ this.lockTimeout = newValue;
+ this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newValue);
+ }
+
+ public Integer getDefaultLockTimeout() {
+ return DEFAULT_LOCK_TIMEOUT;
+ }
+
+ // ********** QueryTimeout **********
+ public Integer getQueryTimeout() {
+ return this.queryTimeout;
+ }
+
+ public void setQueryTimeout(Integer newQueryTimeout) {
+ Integer old = this.queryTimeout;
+ this.queryTimeout = newQueryTimeout;
+ this.putProperty(QUERY_TIMEOUT_PROPERTY, newQueryTimeout);
+ this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newQueryTimeout);
+ }
+
+ private void queryTimeoutChanged(String stringValue) {
+ Integer newValue = getIntegerValueOf(stringValue);
+
+ Integer old = this.queryTimeout;
+ this.queryTimeout = newValue;
+ this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newValue);
+ }
+
+ public Integer getDefaultQueryTimeout() {
+ return DEFAULT_QUERY_TIMEOUT;
+ }
+
+ // ********** ValidationGroupPrePersists **********
+ public ListIterator<String> validationGroupPrePersists(){
+ return new CloneListIterator<String>(this.validationGroupPrePersists);
+ }
+
+ public int validationGroupPrePersistsSize(){
+ return this.validationGroupPrePersists.size();
+ }
+
+ public boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName) {
+ for (String validationGroupPrePersist : this.validationGroupPrePersists) {
+ if(validationGroupPrePersist.equals(validationGroupPrePersistClassName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String addValidationGroupPrePersist(String newPrePersistClassName){
+
+ if( ! this.validationGroupPrePersistExists(newPrePersistClassName)) {
+ this.validationGroupPrePersists.add(newPrePersistClassName);
+ this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, newPrePersistClassName);
+ this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists);
+ return newPrePersistClassName;
+ }
+ return null;
+ }
+
+ public void removeValidationGroupPrePersist(String className){
+
+ if(this.removeValidationGroupPrePersist_(className) != null) {
+ this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, className);
+ this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists);
+ }
+ }
+
+ private String removeValidationGroupPrePersist_(String className){
+
+ for ( ListIterator<String> i = this.validationGroupPrePersists(); i.hasNext();) {
+ String validationGroupPrePersist = i.next();
+ if(validationGroupPrePersist.equals(className)) {
+ this.validationGroupPrePersists.remove(validationGroupPrePersist);
+ return validationGroupPrePersist;
+ }
+ }
+ return null;
+ }
+
+ private void validationGroupPrePersistsChanged() {
+ this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST);
+ this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists);
+ }
+
+ // ********** ValidationGroupPreUpdates **********
+
+ public ListIterator<String> validationGroupPreUpdates(){
+ return new CloneListIterator<String>(this.validationGroupPreUpdates);
+ }
+
+ public int validationGroupPreUpdatesSize(){
+ return this.validationGroupPreUpdates.size();
+ }
+
+ public boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName) {
+
+ for (String validationGroupPreUpdate : this.validationGroupPreUpdates) {
+ if(validationGroupPreUpdate.equals(validationGroupPreUpdateClassName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String addValidationGroupPreUpdate(String newPreUpdateClassName){
+
+ if( ! this.validationGroupPreUpdateExists(newPreUpdateClassName)) {
+ this.validationGroupPreUpdates.add(newPreUpdateClassName);
+ this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, newPreUpdateClassName);
+ this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates);
+ return newPreUpdateClassName;
+ }
+ return null;
+ }
+
+ public void removeValidationGroupPreUpdate(String className){
+
+ if(this.removeValidationGroupPreUpdate_(className) != null) {
+ this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, className);
+ this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates);
+ }
+ }
+
+ private String removeValidationGroupPreUpdate_(String className){
+
+ for(ListIterator<String> i = this.validationGroupPreUpdates(); i.hasNext();) {
+ String validationGroupPreUpdate = i.next();
+ if(validationGroupPreUpdate.equals(className)) {
+ this.validationGroupPreUpdates.remove(validationGroupPreUpdate);
+ return validationGroupPreUpdate;
+ }
+ }
+ return null;
+ }
+
+ private void validationGroupPreUpdatesChanged() {
+ this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE);
+ this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates);
+ }
+
+ // ********** ValidationGroupPreRemoves **********
+
+ public ListIterator<String> validationGroupPreRemoves(){
+ return new CloneListIterator<String>(this.validationGroupPreRemoves);
+ }
+
+ public int validationGroupPreRemovesSize(){
+ return this.validationGroupPreRemoves.size();
+ }
+
+ public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) {
+
+ for (String validationGroupPreRemove : this.validationGroupPreRemoves) {
+ if(validationGroupPreRemove.equals(validationGroupPreRemoveClassName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String addValidationGroupPreRemove(String newPreRemoveClassName){
+
+ if( ! this.validationGroupPreRemoveExists(newPreRemoveClassName)) {
+ this.validationGroupPreRemoves.add(newPreRemoveClassName);
+ this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, newPreRemoveClassName);
+ this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves);
+ return newPreRemoveClassName;
+ }
+ return null;
+ }
+
+ public void removeValidationGroupPreRemove(String className){
+
+ if(this.removeValidationGroupPreRemove_(className) != null) {
+ this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, className);
+ this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves);
+ }
+ }
+
+ private String removeValidationGroupPreRemove_(String className){
+
+ for(ListIterator<String> i = this.validationGroupPreRemoves(); i.hasNext();) {
+ String validationGroupPreRemove = i.next();
+ if(validationGroupPreRemove.equals(className)) {
+ this.validationGroupPreRemoves.remove(validationGroupPreRemove);
+ return validationGroupPreRemove;
+ }
+ }
+ return null;
+ }
+
+ private void validationGroupPreRemovesChanged() {
+ this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE);
+ this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
new file mode 100644
index 0000000000..b7625ed94f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options;
+
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0;
+
+/**
+ * JPA 2.0 options
+ */
+public class NullOptions2_0 extends AbstractPersistenceUnitProperties
+ implements JpaOptions2_0
+{
+
+
+ // ********** constructors **********
+ public NullOptions2_0(PersistenceUnit parent) {
+ super(parent);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ //do nothing
+ }
+
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ //do nothing
+ }
+
+ public void propertyRemoved(String propertyName) {
+ //do nothing
+ }
+
+ /**
+ * Adds property names key/value pairs, where:
+ * key = PU property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ //do nothing
+ }
+
+ // ********** LockTimeout **********
+ public Integer getLockTimeout() {
+ return null;
+ }
+
+ public void setLockTimeout(Integer newLockTimeout) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Integer getDefaultLockTimeout() {
+ return DEFAULT_LOCK_TIMEOUT;
+ }
+
+ // ********** QueryTimeout **********
+ public Integer getQueryTimeout() {
+ return null;
+ }
+
+ public void setQueryTimeout(Integer newQueryTimeout) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Integer getDefaultQueryTimeout() {
+ return DEFAULT_QUERY_TIMEOUT;
+ }
+
+
+ // ********** ValidationGroupPrePersists **********
+ public ListIterator<String> validationGroupPrePersists() {
+ return EmptyListIterator.instance();
+ }
+
+ public int validationGroupPrePersistsSize() {
+ return 0;
+ }
+
+ public boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName) {
+ return false;
+ }
+
+ public String addValidationGroupPrePersist(String newValidationGroupPrePersistClassName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeValidationGroupPrePersist(String validationGroupPrePersistClassName) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ********** ValidationGroupPreUpdates **********
+ public ListIterator<String> validationGroupPreUpdates() {
+ return EmptyListIterator.instance();
+ }
+
+ public int validationGroupPreUpdatesSize() {
+ return 0;
+ }
+
+ public boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName) {
+ return false;
+ }
+
+ public String addValidationGroupPreUpdate(String newValidationGroupPreUpdateClassName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeValidationGroupPreUpdate(String validationGroupPreUpdateClassName) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ********** ValidationGroupPreRemoves **********
+ public ListIterator<String> validationGroupPreRemoves() {
+ return EmptyListIterator.instance();
+ }
+
+ public int validationGroupPreRemovesSize() {
+ return 0;
+ }
+
+ public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) {
+ return false;
+ }
+
+ public String addValidationGroupPreRemove(String newValidationGroupPreRemoveClassName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeValidationGroupPreRemove(String validationGroupPreRemoveClassName) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..0e3e95e81d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAccess2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAccess2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.Access
+ */
+public final class Access2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new Access2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private Access2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceAccess2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullAccess2_0Annotation((JavaResourcePersistentMember) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryAccess2_0Annotation((JavaResourcePersistentMember) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return Access2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..12d1fe772f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverride2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverride2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.AssociationOverride
+ */
+public final class AssociationOverride2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new AssociationOverride2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private AssociationOverride2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourceAssociationOverride2_0Annotation.buildAssociationOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryAssociationOverride2_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverrideAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..87eaa59f93
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverrides2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverrides2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.AssociationOverrides
+ */
+public final class AssociationOverrides2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new AssociationOverrides2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private AssociationOverrides2_0AnnotationDefinition() {
+ super();
+ }
+
+ public AssociationOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceAssociationOverrides2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public AssociationOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryAssociationOverrides2_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverridesAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..0e99636386
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCacheable2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCacheable2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Cacheable
+ */
+public final class Cacheable2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new Cacheable2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private Cacheable2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceCacheable2_0Annotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryCacheable2_0Annotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return Cacheable2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..34710f0028
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCollectionTable2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCollectionTable2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.CollectionTable
+ */
+public final class CollectionTable2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new CollectionTable2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private CollectionTable2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullCollectionTable2_0Annotation(parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return CollectionTable2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..3d99fe6c92
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.ElementCollection
+ */
+public final class ElementCollection2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ElementCollection2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ElementCollection2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ElementCollection2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
new file mode 100644
index 0000000000..5b897d1620
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.annotation.Generated
+ * <p>
+ * This annotation definition is not really required; it's just here for a bit
+ * of consistency....
+ */
+public final class GeneratedAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final GeneratedAnnotationDefinition INSTANCE = new GeneratedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static GeneratedAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private GeneratedAnnotationDefinition() {
+ super();
+ }
+
+ public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceGeneratedAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public GeneratedAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryGeneratedAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return GeneratedAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..37b7e18382
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyClass
+ */
+public final class MapKeyClass2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapKeyClass2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MapKeyClass2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyClass2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..53a40c8fcf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyColumn
+ */
+public final class MapKeyColumn2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapKeyColumn2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MapKeyColumn2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullMapKeyColumnAnnotation(parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyColumn2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..6ba277bdc2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyTemporal
+ */
+public final class MapKeyEnumerated2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapKeyEnumerated2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MapKeyEnumerated2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..c943113e00
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+
+/**
+ * javax.persistence.MapKeyJoinColumn
+ */
+public final class MapKeyJoinColumn2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapKeyJoinColumn2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MapKeyJoinColumn2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourceMapKeyJoinColumn2_0Annotation.createMapKeyJoinColumn(parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapKeyJoinColumn2_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..23ddfdc204
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumns2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyJoinColumns
+ */
+public final class MapKeyJoinColumns2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapKeyJoinColumns2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MapKeyJoinColumns2_0AnnotationDefinition() {
+ super();
+ }
+
+ public MapKeyJoinColumns2_0Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public MapKeyJoinColumns2_0Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..4539b09588
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyTemporal
+ */
+public final class MapKeyTemporal2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapKeyTemporal2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MapKeyTemporal2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyTemporal2_0Annotation.ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..a597251aee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.MapsId
+ */
+public class MapsId2_0AnnotationDefinition implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapsId2_0AnnotationDefinition();
+
+
+ /**
+ * Return the singleton
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private MapsId2_0AnnotationDefinition() {
+ super();
+ }
+
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullMapsId2_0Annotation((JavaResourcePersistentMember) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapsId2_0Annotation.ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..888cc8e2a8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQueries2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQueries2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
+
+/**
+ * javax.persistence.NamedQueries
+ */
+public class NamedQueries2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new NamedQueries2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private NamedQueries2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedQueries2_0Annotation(parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryNamedQueries2_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return NamedQueriesAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..86ba2b97c6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQuery2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQuery2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+
+/**
+ * javax.persistence.NamedQuery
+ */
+public class NamedQuery2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new NamedQuery2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private NamedQuery2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedQuery2_0Annotation(parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryNamedQuery2_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return NamedQueryAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
new file mode 100644
index 0000000000..2aa8b84300
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * <code>javax.persistence.Access</code>
+ */
+public final class NullAccess2_0Annotation
+ extends NullAnnotation<Access2_0Annotation>
+ implements Access2_0Annotation
+{
+
+ protected NullAccess2_0Annotation(JavaResourcePersistentMember parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** value
+ public AccessType getValue() {
+ return null;
+ }
+
+ public void setValue(AccessType value) {
+ if (value != null) {
+ this.addAnnotation().setValue(value);
+ }
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java
new file mode 100644
index 0000000000..2393ed2dd2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * <code>javax.persistence.JoinTable</code> found in a
+ * <code>javax.persistence.AssociationOverride</code> annotation
+ */
+public final class NullAssociationOverrideJoinTableAnnotation
+ extends NullJoinTableAnnotation
+{
+ public NullAssociationOverrideJoinTableAnnotation(AssociationOverride2_0Annotation parent) {
+ super(parent);
+ }
+
+ private AssociationOverride2_0Annotation getAssociationOverride2_0Annotation() {
+ return (AssociationOverride2_0Annotation) this.parent;
+ }
+
+ @Override
+ protected JoinTableAnnotation addAnnotation() {
+ return this.getAssociationOverride2_0Annotation().addJoinTable();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
new file mode 100644
index 0000000000..eba00c41e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseTableAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.CollectionTable</code>
+ */
+public final class NullCollectionTable2_0Annotation
+ extends NullBaseTableAnnotation<CollectionTable2_0Annotation>
+ implements CollectionTable2_0Annotation
+{
+ public NullCollectionTable2_0Annotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return EmptyListIterator.instance();
+ }
+
+ public int joinColumnsSize() {
+ return 0;
+ }
+
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return null;
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ // the CollectionTable annotation is missing, add both it and a join column at the same time
+ return this.addAnnotation().addJoinColumn(index);
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
new file mode 100644
index 0000000000..6a4b869bbe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <code>javax.persistence.MapKeyColumn</code>
+ */
+public final class NullMapKeyColumnAnnotation
+ extends NullBaseColumnAnnotation<MapKeyColumn2_0Annotation>
+ implements MapKeyColumn2_0Annotation
+{
+ public NullMapKeyColumnAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** length
+ public Integer getLength() {
+ return null;
+ }
+
+ public void setLength(Integer length) {
+ if (length != null) {
+ this.addAnnotation().setLength(length);
+ }
+ }
+
+ public TextRange getLengthTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** scale
+ public Integer getScale() {
+ return null;
+ }
+
+ public void setScale(Integer scale) {
+ if (scale != null) {
+ this.addAnnotation().setScale(scale);
+ }
+ }
+
+ public TextRange getScaleTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** precision
+ public Integer getPrecision() {
+ return null;
+ }
+
+ public void setPrecision(Integer precision) {
+ if (precision != null) {
+ this.addAnnotation().setPrecision(precision);
+ }
+ }
+
+ public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
new file mode 100644
index 0000000000..c9eaf62795
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.EnumType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * <code>javax.persistence.MapKeyEnumerated</code>
+ */
+public final class NullMapKeyEnumerated2_0Annotation
+ extends NullAnnotation<MapKeyEnumerated2_0Annotation>
+ implements MapKeyEnumerated2_0Annotation
+{
+ protected NullMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** value
+ public EnumType getValue() {
+ return null;
+ }
+
+ public void setValue(EnumType value) {
+ if (value != null) {
+ this.addAnnotation().setValue(value);
+ }
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
new file mode 100644
index 0000000000..2a8a676aba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
+
+/**
+ * <code>javax.persistence.MapKeyTemporal</code>
+ */
+public final class NullMapKeyTemporal2_0Annotation
+ extends NullAnnotation<MapKeyTemporal2_0Annotation>
+ implements MapKeyTemporal2_0Annotation
+{
+ protected NullMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** value
+ public TemporalType getValue() {
+ return null;
+ }
+
+ public void setValue(TemporalType value) {
+ if (value != null) {
+ this.addAnnotation().setValue(value);
+ }
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
new file mode 100644
index 0000000000..0dcf181809
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * <code>javax.persistence.MapsId</code>
+ */
+public final class NullMapsId2_0Annotation
+ extends NullAnnotation<MapsId2_0Annotation>
+ implements MapsId2_0Annotation
+{
+ protected NullMapsId2_0Annotation(JavaResourcePersistentMember parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** value
+ public String getValue() {
+ return null;
+ }
+
+ public void setValue(String newValue) {
+ if (newValue != null) {
+ this.addAnnotation().setValue(newValue);
+ }
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean valueTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
new file mode 100644
index 0000000000..ca2a7b5123
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullNamedColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * <code>javax.persistence.OrderColumn</code>
+ */
+public final class NullOrderColumn2_0Annotation
+ extends NullNamedColumnAnnotation<OrderColumn2_0Annotation>
+ implements OrderColumn2_0Annotation
+{
+ public NullOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** updatable
+ public Boolean getUpdatable() {
+ return null;
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ if (updatable != null) {
+ this.addAnnotation().setUpdatable(updatable);
+ }
+ }
+
+ public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** insertable
+ public Boolean getInsertable() {
+ return null;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ if (insertable != null) {
+ this.addAnnotation().setInsertable(insertable);
+ }
+ }
+
+ public TextRange getInsertableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** nullable
+ public Boolean getNullable() {
+ return null;
+ }
+
+ public void setNullable(Boolean nullable) {
+ if (nullable != null) {
+ this.addAnnotation().setNullable(nullable);
+ }
+ }
+
+ public TextRange getNullableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..91ff5ae6fc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryOrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceOrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.OrderColumn
+ */
+public final class OrderColumn2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new OrderColumn2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private OrderColumn2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return OrderColumn2_0Annotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
new file mode 100644
index 0000000000..513678f78d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinarySequenceGenerator2_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceSequenceGenerator2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+
+/**
+ * javax.persistence.SequenceGenerator
+ */
+public final class SequenceGenerator2_0AnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new SequenceGenerator2_0AnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private SequenceGenerator2_0AnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceSequenceGenerator2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinarySequenceGenerator2_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return SequenceGeneratorAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java
new file mode 100644
index 0000000000..1d1d2289a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <code>javax.persistence.MapKeyJoinColumn</code>
+ */
+public final class SourceMapKeyJoinColumn2_0Annotation
+ extends SourceBaseJoinColumnAnnotation
+ implements NestableMapKeyJoinColumnAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, attribute, daa, annotationAdapter);
+ }
+
+ public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
+ this(parent, attribute, daa, new ElementAnnotationAdapter(attribute, daa));
+ }
+
+ public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, attribute, idaa, new ElementIndexedAnnotationAdapter(attribute, idaa));
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ********** SourceNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** SourceBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE;
+ }
+
+
+ // ********** SourceBaseJoinColumnAnnotation implementation **********
+
+ @Override
+ protected String getReferencedColumnNameElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
+ }
+
+
+ // ********** static methods **********
+
+ public static SourceMapKeyJoinColumn2_0Annotation createMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute) {
+ return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ static SourceMapKeyJoinColumn2_0Annotation createNestedMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute, int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa);
+ return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, idaa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java
new file mode 100644
index 0000000000..c538288cb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * <code>javax.persistence.MapKeyJoinColumns</code>
+ */
+public final class SourceMapKeyJoinColumns2_0Annotation
+ extends SourceAnnotation<Attribute>
+ implements MapKeyJoinColumns2_0Annotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableMapKeyJoinColumnAnnotation> mapKeyJoinColumns = new Vector<NestableMapKeyJoinColumnAnnotation>();
+
+
+ public SourceMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.mapKeyJoinColumns.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.mapKeyJoinColumns);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableMapKeyJoinColumnAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableMapKeyJoinColumnAnnotation>(this.mapKeyJoinColumns);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.mapKeyJoinColumns.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.mapKeyJoinColumns.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.mapKeyJoinColumns.add(index, (NestableMapKeyJoinColumnAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.mapKeyJoinColumns.remove(0).convertToStandAlone();
+ }
+
+ public NestableMapKeyJoinColumnAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.mapKeyJoinColumns.size());
+ }
+
+ private NestableMapKeyJoinColumnAnnotation addNestedAnnotation(int index) {
+ NestableMapKeyJoinColumnAnnotation joinColumn = this.buildMapKeyJoinColumn(index);
+ this.mapKeyJoinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.mapKeyJoinColumns.size();
+ NestableMapKeyJoinColumnAnnotation joinColumn = this.addNestedAnnotation(index);
+ joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(MAP_KEY_JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ private NestableMapKeyJoinColumnAnnotation buildMapKeyJoinColumn(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceMapKeyJoinColumn2_0Annotation.createNestedMapKeyJoinColumn(this.parent, this.annotatedElement, index, this.daa);
+ }
+
+ public NestableMapKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.mapKeyJoinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestableMapKeyJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return this.mapKeyJoinColumns.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.mapKeyJoinColumns, MAP_KEY_JOIN_COLUMNS_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
new file mode 100644
index 0000000000..b88a0b18bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.metamodel.StaticMetamodel
+ * <p>
+ * This annotation definition is not really required; it's just here for a bit
+ * of consistency....
+ */
+public final class StaticMetamodelAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final StaticMetamodelAnnotationDefinition INSTANCE = new StaticMetamodelAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static StaticMetamodelAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private StaticMetamodelAnnotationDefinition() {
+ super();
+ }
+
+ public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceStaticMetamodelAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public StaticMetamodelAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryStaticMetamodelAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return StaticMetamodelAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
new file mode 100644
index 0000000000..ee01d96507
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.Access
+ */
+public final class BinaryAccess2_0Annotation
+ extends BinaryAnnotation
+ implements Access2_0Annotation
+{
+ private AccessType value;
+
+
+ public BinaryAccess2_0Annotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** AccessAnnotation implementation **********
+
+ // ***** value
+ public AccessType getValue() {
+ return this.value;
+ }
+
+ public void setValue(AccessType value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(AccessType value) {
+ AccessType old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private AccessType buildValue() {
+ return AccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ACCESS));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
new file mode 100644
index 0000000000..eb213548d2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * BinarySequenceGenerator2_0Annotation
+ */
+public final class BinaryAssociationOverride2_0Annotation
+ extends BinaryAssociationOverrideAnnotation
+ implements AssociationOverride2_0Annotation
+{
+ private JoinTableAnnotation joinTable;
+ private final JoinTableAnnotation nullJoinTable;
+
+ public BinaryAssociationOverride2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.joinTable = this.buildJoinTable();
+ this.nullJoinTable = this.buildNullJoinTable();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinTable();
+ }
+
+
+ // ********** AssociationOverride2_0Annotation implementation **********
+
+ // ***** joinTable
+ public JoinTableAnnotation getJoinTable() {
+ return this.joinTable;
+ }
+
+ public JoinTableAnnotation getNonNullJoinTable() {
+ return (this.joinTable != null) ? this.joinTable : this.nullJoinTable;
+ }
+
+ public JoinTableAnnotation addJoinTable() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinTable() {
+ throw new UnsupportedOperationException();
+ }
+
+ private JoinTableAnnotation buildJoinTable() {
+ IAnnotation jdtJoinTable = this.getJdtJoinTable();
+ return (jdtJoinTable == null) ? null : this.buildJoinTable(jdtJoinTable);
+ }
+
+ private JoinTableAnnotation buildNullJoinTable() {
+ return new NullJoinTableAnnotation(this);
+ }
+
+ private JoinTableAnnotation buildJoinTable(IAnnotation jdtJoinTable) {
+ return new BinaryJoinTableAnnotation(this, jdtJoinTable);
+ }
+
+ private IAnnotation getJdtJoinTable() {
+ return (IAnnotation) this.getJdtMemberValue(JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE);
+ }
+
+ // TODO
+ private void updateJoinTable() {
+ throw new UnsupportedOperationException();
+// IAnnotation jdtJoinTable = this.getJdtJoinTable();
+// if (jdtJoinTable == null) {
+// this.setJoinTable(null);
+// } else {
+// if (this.column == null) {
+// this.setJoinTable(this.buildJoinTable(jdtJoinTable));
+// } else {
+// this.column.update(jdtJoinTable);
+// }
+// }
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
new file mode 100644
index 0000000000..e2877de83d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+
+/**
+ * javax.persistence.AssociationOverrides
+ */
+public class BinaryAssociationOverrides2_0Annotation
+ extends BinaryAssociationOverridesAnnotation
+{
+
+ public BinaryAssociationOverrides2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ @Override
+ protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) {
+ return new BinaryAssociationOverride2_0Annotation(this, (IAnnotation) jdtAssociationOverride);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
new file mode 100644
index 0000000000..3702c2ec5f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Cacheable
+ */
+public final class BinaryCacheable2_0Annotation
+ extends BinaryAnnotation
+ implements Cacheable2_0Annotation
+{
+ private Boolean value;
+
+
+ public BinaryCacheable2_0Annotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** Cacheable2_0Annotation implementation **********
+
+ // ***** value
+ public Boolean getValue() {
+ return this.value;
+ }
+
+ public void setValue(Boolean value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(Boolean value) {
+ Boolean old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private Boolean buildValue() {
+ return (Boolean) this.getJdtMemberValue(JPA2_0.CACHEABLE__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
new file mode 100644
index 0000000000..324ac63515
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+
+/**
+ * javax.persistence.CollectionTable
+ */
+public final class BinaryCollectionTable2_0Annotation
+ extends BinaryBaseTableAnnotation
+ implements CollectionTable2_0Annotation
+{
+ private final Vector<JoinColumnAnnotation> joinColumns;
+
+
+ public BinaryCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.joinColumns = this.buildJoinColumns();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinColumns();
+ }
+
+
+ // ********** BinaryBaseTableAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA2_0.COLLECTION_TABLE__NAME;
+ }
+
+ @Override
+ protected String getSchemaElementName() {
+ return JPA2_0.COLLECTION_TABLE__SCHEMA;
+ }
+
+ @Override
+ protected String getCatalogElementName() {
+ return JPA2_0.COLLECTION_TABLE__CATALOG;
+ }
+
+ @Override
+ protected String getUniqueConstraintElementName() {
+ return JPA2_0.COLLECTION_TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+
+ // ********** CollectionTable2_0Annotation implementation **********
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<JoinColumnAnnotation> buildJoinColumns() {
+ Object[] jdtJoinColumns = this.getJdtMemberValues(JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS);
+ Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
+ for (Object jdtJoinColumn : jdtJoinColumns) {
+ result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
+ }
+ return result;
+ }
+
+ // TODO
+ private void updateJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
new file mode 100644
index 0000000000..b4774b3c3c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.FetchType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * org.eclipse.persistence.annotations.Transformation
+ */
+public class BinaryElementCollection2_0Annotation
+ extends BinaryAnnotation
+ implements ElementCollection2_0Annotation
+{
+ private String targetClass;
+ private FetchType fetch;
+
+
+ public BinaryElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.targetClass = this.buildTargetClass();
+ this.fetch = this.buildFetch();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setTargetClass_(this.buildTargetClass());
+ this.setFetch_(this.buildFetch());
+ }
+
+
+ // ********** ElementCollection2_0Annotation implementation **********
+
+ // ***** target entity
+ public String getTargetClass() {
+ return this.targetClass;
+ }
+
+ public void setTargetClass(String targetClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setTargetClass_(String targetClass) {
+ String old = this.targetClass;
+ this.targetClass = targetClass;
+ this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, targetClass);
+ }
+
+ private String buildTargetClass() {
+ return (String) this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS);
+ }
+
+ public TextRange getTargetClassTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fully-qualified target entity class name
+ public String getFullyQualifiedTargetClassName() {
+ return this.targetClass;
+ }
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setFetch_(FetchType fetch) {
+ FetchType old = this.fetch;
+ this.fetch = fetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
+ }
+
+ private FetchType buildFetch() {
+ return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__FETCH));
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
new file mode 100644
index 0000000000..798b809e9e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.annotation.Generated
+ */
+public final class BinaryGeneratedAnnotation
+ extends BinaryAnnotation
+ implements GeneratedAnnotation
+{
+ private final Vector<String> values;
+ private String date;
+ private String comments;
+
+
+ public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.values = this.buildValues();
+ this.date = this.buildDate();
+ this.comments = this.buildComments();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateValues();
+ this.setDate_(this.buildDate());
+ this.setComments_(this.buildComments());
+ }
+
+ // TODO
+ private void updateValues() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** GeneratedAnnotation implementation **********
+
+ // ***** values
+ public ListIterator<String> values() {
+ return new CloneListIterator<String>(this.values);
+ }
+
+ public int valuesSize() {
+ return this.values.size();
+ }
+
+ public String getValue(int index) {
+ return this.values.get(index);
+ }
+
+ private Vector<String> buildValues() {
+ Object[] jdtValues = this.getJdtMemberValues(VALUE_ELEMENT_NAME);
+ Vector<String> result = new Vector<String>(jdtValues.length);
+ for (Object value : jdtValues) {
+ result.add((String) value);
+ }
+ return result;
+ }
+
+ public void addValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addValue(int index, String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveValue(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeValue(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** date
+ public String getDate() {
+ return this.date;
+ }
+
+ public void setDate(String date) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDate_(String date) {
+ String old = this.date;
+ this.date = date;
+ this.firePropertyChanged(DATE_PROPERTY, old, date);
+ }
+
+ private String buildDate() {
+ return (String) this.getJdtMemberValue(DATE_ELEMENT_NAME);
+ }
+
+ // ***** comments
+ public String getComments() {
+ return this.comments;
+ }
+
+ public void setComments(String comments) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setComments_(String comments) {
+ String old = this.comments;
+ this.comments = comments;
+ this.firePropertyChanged(COMMENTS_PROPERTY, old, comments);
+ }
+
+ private String buildComments() {
+ return (String) this.getJdtMemberValue(COMMENTS_ELEMENT_NAME);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
new file mode 100644
index 0000000000..e20a405b5c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyClass
+ */
+public final class BinaryMapKeyClass2_0Annotation
+ extends BinaryAnnotation
+ implements MapKeyClass2_0Annotation
+{
+ private String value;
+
+
+ public BinaryMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** MapKeyClass2_0Annotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA2_0.MAP_KEY_CLASS__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fully-qualified class name
+ /**
+ * binary is already fully-qualified
+ */
+ public String getFullyQualifiedClassName() {
+ return this.value;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
new file mode 100644
index 0000000000..f2a2415614
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryCompleteColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyColumn
+ */
+public final class BinaryMapKeyColumn2_0Annotation
+ extends BinaryCompleteColumnAnnotation
+ implements MapKeyColumn2_0Annotation
+{
+
+ public BinaryMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** BinaryBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__UPDATABLE;
+ }
+
+
+ // ********** BinaryCompleteColumnAnnotation implementation **********
+
+ @Override
+ protected String getLengthElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__LENGTH;
+ }
+
+ @Override
+ protected String getPrecisionElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__PRECISION;
+ }
+
+ @Override
+ protected String getScaleElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__SCALE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
new file mode 100644
index 0000000000..39f3229e74
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseEnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyEnumerated
+ */
+public final class BinaryMapKeyEnumerated2_0Annotation
+ extends BinaryBaseEnumeratedAnnotation
+ implements MapKeyEnumerated2_0Annotation
+{
+
+ public BinaryMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA2_0.MAP_KEY_ENUMERATED__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
new file mode 100644
index 0000000000..c4d25d3ed2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.MapKeyJoinColumn
+ */
+public final class BinaryMapKeyJoinColumn2_0Annotation
+ extends BinaryBaseJoinColumnAnnotation
+ implements NestableMapKeyJoinColumnAnnotation
+{
+
+ public BinaryMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** BinaryBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE;
+ }
+
+
+ // ********** BinaryBaseJoinColumnAnnotation implementation **********
+
+ @Override
+ protected String getReferencedColumnNameElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java
new file mode 100644
index 0000000000..2622efab7c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryContainerAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyJoinColumns
+ */
+public final class BinaryMapKeyJoinColumns2_0Annotation
+ extends BinaryContainerAnnotation<NestableMapKeyJoinColumnAnnotation>
+ implements MapKeyJoinColumns2_0Annotation
+{
+ private final Vector<NestableMapKeyJoinColumnAnnotation> mapKeyJoinColumns;
+
+
+ public BinaryMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.mapKeyJoinColumns = this.buildMapKeyJoinColumns();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableMapKeyJoinColumnAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableMapKeyJoinColumnAnnotation>(this.mapKeyJoinColumns);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.mapKeyJoinColumns.size();
+ }
+
+ private Vector<NestableMapKeyJoinColumnAnnotation> buildMapKeyJoinColumns() {
+ Object[] jdtMapKeyJoinColumns = this.getJdtMemberValues(JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE);
+ Vector<NestableMapKeyJoinColumnAnnotation> result = new Vector<NestableMapKeyJoinColumnAnnotation>(jdtMapKeyJoinColumns.length);
+ for (Object jdtMapKeyJoinColumn : jdtMapKeyJoinColumns) {
+ result.add(new BinaryMapKeyJoinColumn2_0Annotation(this, (IAnnotation) jdtMapKeyJoinColumn));
+ }
+ return result;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateMapKeyJoinColumns();
+ }
+
+ // TODO
+ private void updateMapKeyJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
new file mode 100644
index 0000000000..1c5b97b821
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTemporalAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyTemporal
+ */
+public final class BinaryMapKeyTemporal2_0Annotation
+ extends BinaryBaseTemporalAnnotation
+ implements MapKeyTemporal2_0Annotation
+{
+
+ public BinaryMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyTemporal2_0Annotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA2_0.MAP_KEY_TEMPORAL__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
new file mode 100644
index 0000000000..c7d7e03c05
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapsId
+ */
+public class BinaryMapsId2_0Annotation
+ extends BinaryAnnotation
+ implements MapsId2_0Annotation
+{
+ private String value;
+
+
+ public BinaryMapsId2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** MapsId2_0Annotation implementation **********
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String newValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String newValue) {
+ String oldValue = this.value;
+ this.value = newValue;
+ this.firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA2_0.MAPS_ID__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean valueTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
new file mode 100644
index 0000000000..b6270a6eb5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+
+/**
+ * javax.persistence.NamedQueries
+ */
+public final class BinaryNamedQueries2_0Annotation
+ extends BinaryNamedQueriesAnnotation
+{
+ public BinaryNamedQueries2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ @Override
+ protected NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery) {
+ return new BinaryNamedQuery2_0Annotation(this, (IAnnotation) jdtQuery);
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
new file mode 100644
index 0000000000..83e2f3e112
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * BinaryNamedQuery2_0Annotation
+ */
+public final class BinaryNamedQuery2_0Annotation
+ extends BinaryNamedQueryAnnotation
+ implements NamedQuery2_0Annotation
+{
+ private LockModeType_2_0 lockMode;
+
+ public BinaryNamedQuery2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.lockMode = this.buildLockMode();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setLockMode_(this.buildLockMode());
+ }
+
+ // ********** NamedQuery2_0Annotation implementation **********
+
+ public LockModeType_2_0 getLockMode() {
+ return this.lockMode;
+ }
+
+ public void setLockMode(LockModeType_2_0 lockMode) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setLockMode_(LockModeType_2_0 lockMode) {
+ LockModeType_2_0 old = this.lockMode;
+ this.lockMode = lockMode;
+ this.firePropertyChanged(LOCK_MODE_PROPERTY, old, lockMode);
+ }
+
+ public TextRange getLockModeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean lockModeTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ private LockModeType_2_0 buildLockMode() {
+ return LockModeType_2_0.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.NAMED_QUERY__LOCK_MODE));
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
new file mode 100644
index 0000000000..446297a6a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.OrderColumn
+ */
+public class BinaryOrderColumn2_0Annotation
+ extends BinaryNamedColumnAnnotation
+ implements OrderColumn2_0Annotation
+{
+ private Boolean nullable;
+ private Boolean insertable;
+ private Boolean updatable;
+
+
+ public BinaryOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.nullable = this.buildNullable();
+ this.insertable = this.buildInsertable();
+ this.updatable = this.buildUpdatable();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setNullable_(this.buildNullable());
+ this.setInsertable_(this.buildInsertable());
+ this.setUpdatable_(this.buildUpdatable());
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ //************* BinaryNamedColumnAnnotation implementation *************
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.COLUMN__COLUMN_DEFINITION;
+ }
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.COLUMN__NAME;
+ }
+
+ //************* OrderColumn2_0Annotation implementation *************
+
+ // ***** nullable
+ public Boolean getNullable() {
+ return this.nullable;
+ }
+
+ public void setNullable(Boolean nullable) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setNullable_(Boolean nullable) {
+ Boolean old = this.nullable;
+ this.nullable = nullable;
+ this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable);
+ }
+
+ private Boolean buildNullable() {
+ return (Boolean) this.getJdtMemberValue(getNullableElementName());
+ }
+
+ String getNullableElementName() {
+ return JPA.COLUMN__NULLABLE;
+ }
+
+ public TextRange getNullableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** insertable
+ public Boolean getInsertable() {
+ return this.insertable;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setInsertable_(Boolean insertable) {
+ Boolean old = this.insertable;
+ this.insertable = insertable;
+ this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ private Boolean buildInsertable() {
+ return (Boolean) this.getJdtMemberValue(this.getInsertableElementName());
+ }
+
+ String getInsertableElementName() {
+ return JPA.COLUMN__INSERTABLE;
+ }
+
+ public TextRange getInsertableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** updatable
+ public Boolean getUpdatable() {
+ return this.updatable;
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setUpdatable_(Boolean updatable) {
+ Boolean old = this.updatable;
+ this.updatable = updatable;
+ this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ private Boolean buildUpdatable() {
+ return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName());
+ }
+
+ String getUpdatableElementName() {
+ return JPA.COLUMN__UPDATABLE;
+ }
+
+ public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
new file mode 100644
index 0000000000..b9b94ad58d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * BinarySequenceGenerator2_0Annotation
+ */
+public final class BinarySequenceGenerator2_0Annotation
+ extends BinarySequenceGeneratorAnnotation
+ implements SequenceGenerator2_0Annotation
+{
+ private String catalog;
+ private String schema;
+
+
+ public BinarySequenceGenerator2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.catalog = this.buildCatalog();
+ this.schema = this.buildSchema();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setCatalog_(this.buildCatalog());
+ this.setSchema_(this.buildSchema());
+ }
+
+ // ********** SequenceGenerator2_0Annotation implementation **********
+
+ // ********** catalog **********
+
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String catalog) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCatalog_(String catalog) {
+ String old = this.catalog;
+ this.catalog = catalog;
+ this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
+ }
+
+ private String buildCatalog() {
+ return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__CATALOG);
+ }
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ********** schema **********
+
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String schema) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setSchema_(String schema) {
+ String old = this.schema;
+ this.schema = schema;
+ this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
+ }
+
+ private String buildSchema() {
+ return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__SCHEMA);
+ }
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
new file mode 100644
index 0000000000..3f30009013
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.metamodel.StaticMetamodel
+ */
+public final class BinaryStaticMetamodelAnnotation
+ extends BinaryAnnotation
+ implements StaticMetamodelAnnotation
+{
+ private String value;
+
+
+ public BinaryStaticMetamodelAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** StaticMetamodelAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA2_0.STATIC_METAMODEL__VALUE);
+ }
+
+ // ***** fully-qualified class name
+ /**
+ * binary is already fully-qualified
+ */
+ public String getFullyQualifiedClassName() {
+ return this.value;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
new file mode 100644
index 0000000000..4b8790b08b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.Access
+ */
+public final class SourceAccess2_0Annotation
+ extends SourceAnnotation<Member>
+ implements Access2_0Annotation
+{
+ 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 AccessType value;
+
+
+ public SourceAccess2_0Annotation(JavaResourcePersistentMember parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(member, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** AccessAnnotation implementation **********
+
+ // ***** value
+ public AccessType getValue() {
+ return this.value;
+ }
+
+ public void setValue(AccessType value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(AccessType.toJavaAnnotationValue(value));
+ }
+ }
+
+ private void syncValue(AccessType astValue) {
+ AccessType old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private AccessType buildValue(CompilationUnit astRoot) {
+ return AccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ACCESS__VALUE);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
new file mode 100644
index 0000000000..9ea428b84a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NullAssociationOverrideJoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * <code>javax.persistence.AssociationOverride</code>
+ */
+public final class SourceAssociationOverride2_0Annotation
+ extends SourceAssociationOverrideAnnotation
+ implements AssociationOverride2_0Annotation
+{
+ private ElementAnnotationAdapter joinTableAdapter;
+ private JoinTableAnnotation joinTable;
+ private final JoinTableAnnotation nullJoinTable;
+
+
+ public SourceAssociationOverride2_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.joinTableAdapter = this.buildJoinTableAdapter();
+ this.nullJoinTable = this.buildNullJoinTable();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ if (this.joinTableAdapter.getAnnotation(astRoot) != null) {
+ this.joinTable = buildJoinTableAnnotation(this, this.annotatedElement, this.daa);
+ this.joinTable.initialize(astRoot);
+ }
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncJoinTable(astRoot);
+ }
+
+
+ //************ AssociationOverride2_0Annotation implementation ****************
+
+ // ***** joinTable
+ public JoinTableAnnotation getJoinTable() {
+ return this.joinTable;
+ }
+
+ public JoinTableAnnotation getNonNullJoinTable() {
+ return (this.joinTable != null) ? this.joinTable : this.nullJoinTable;
+ }
+
+ public JoinTableAnnotation addJoinTable() {
+ if (this.joinTable != null) {
+ throw new IllegalStateException("'joinTable' element already exists: " + this.joinTable); //$NON-NLS-1$
+ }
+ this.joinTable = buildJoinTableAnnotation(this, this.annotatedElement, this.daa);
+ this.joinTable.newAnnotation();
+ return this.joinTable;
+ }
+
+ public void removeJoinTable() {
+ if (this.joinTable == null) {
+ throw new IllegalStateException("'joinTable' element does not exist"); //$NON-NLS-1$
+ }
+ JoinTableAnnotation old = this.joinTable;
+ this.joinTable = null;
+ old.removeAnnotation();
+ }
+
+ private void syncJoinTable(CompilationUnit astRoot) {
+ if (this.joinTableAdapter.getAnnotation(astRoot) == null) {
+ this.syncJoinTable_(null);
+ } else {
+ if (this.joinTable == null) {
+ JoinTableAnnotation table = buildJoinTableAnnotation(this, this.annotatedElement, this.daa);
+ table.initialize(astRoot);
+ this.syncJoinTable_(table);
+ } else {
+ this.joinTable.synchronizeWith(astRoot);
+ }
+ }
+ }
+
+ private void syncJoinTable_(JoinTableAnnotation astJoinTable) {
+ JoinTableAnnotation old = this.joinTable;
+ this.joinTable = astJoinTable;
+ this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, astJoinTable);
+ }
+
+ private ElementAnnotationAdapter buildJoinTableAdapter() {
+ return new ElementAnnotationAdapter(this.annotatedElement, buildJoinTableAnnotationAdapter(this.daa));
+ }
+
+ private JoinTableAnnotation buildNullJoinTable() {
+ return new NullAssociationOverrideJoinTableAnnotation(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.joinTable == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.joinTableAdapter = this.buildJoinTableAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ if (this.joinTable != null) {
+ Map<String, Object> joinTableState = new HashMap<String, Object>();
+ this.joinTable.storeOn(joinTableState);
+ map.put(JOIN_TABLE_PROPERTY, joinTableState);
+ this.joinTable = null;
+ }
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> joinTableState = (Map<String, Object>) map.get(JOIN_TABLE_PROPERTY);
+ if (joinTableState != null) {
+ this.addJoinTable().restoreFrom(joinTableState);
+ }
+ }
+
+
+ // ********** static methods **********
+
+ public static SourceAssociationOverride2_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) {
+ return new SourceAssociationOverride2_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static JoinTableAnnotation buildJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
+ return new SourceJoinTableAnnotation(parent, member, buildJoinTableAnnotationAdapter(associationOverrideAnnotationAdapter));
+ }
+
+ static DeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
+ return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE, JPA.JOIN_TABLE);
+ }
+
+
+ static SourceAssociationOverrideAnnotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
+ return new SourceAssociationOverride2_0Annotation(parent, member, idaa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
new file mode 100644
index 0000000000..be45b19954
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+
+/**
+ * <code>javax.persistence.AssociationOverrides</code>
+ */
+public final class SourceAssociationOverrides2_0Annotation
+ extends SourceAssociationOverridesAnnotation
+{
+ public SourceAssociationOverrides2_0Annotation(JavaResourceNode parent, Member member) {
+ super(parent, member);
+ }
+
+ @Override
+ protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceAssociationOverride2_0Annotation.buildNestedAssociationOverride(this.parent, this.annotatedElement, index, this.daa);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
new file mode 100644
index 0000000000..f89f48edd4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Cacheable
+ */
+public final class SourceCacheable2_0Annotation
+ extends SourceAnnotation<Member>
+ implements Cacheable2_0Annotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<Boolean> VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter<Boolean> valueAdapter;
+ private Boolean value;
+
+
+ public SourceCacheable2_0Annotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** Cacheable2_0Annotation implementation **********
+
+ // ***** value
+ public Boolean getValue() {
+ return this.value;
+ }
+
+ public void setValue(Boolean value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(Boolean astValue) {
+ Boolean old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private Boolean buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.CACHEABLE__VALUE, BooleanExpressionConverter.instance());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
new file mode 100644
index 0000000000..8243f24a36
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.CollectionTable</code>
+ */
+public final class SourceCollectionTable2_0Annotation
+ extends SourceBaseTableAnnotation
+ implements CollectionTable2_0Annotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(CollectionTable2_0Annotation.ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__SCHEMA);
+
+ private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__CATALOG);
+
+
+ private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
+ private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
+
+
+ public SourceCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot);
+ }
+
+
+ // ********** SourceBaseTableAnnotation implementation **********
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return NAME_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildSchemaDeclarationAdapter() {
+ return SCHEMA_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildCatalogDeclarationAdapter() {
+ return CATALOG_ADAPTER;
+ }
+
+ @Override
+ protected String getUniqueConstraintsElementName() {
+ return JPA2_0.COLLECTION_TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+ // ********** CollectionTable2_0Annotation implementation **********
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ }
+
+ Iterable<NestableJoinColumnAnnotation> getNestableJoinColumns() {
+ return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public NestableJoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation addJoinColumn() {
+ return this.addJoinColumn(this.joinColumns.size());
+ }
+
+ public NestableJoinColumnAnnotation addJoinColumn(int index) {
+ return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation addJoinColumn_() {
+ return this.addJoinColumn_(this.joinColumns.size());
+ }
+
+ private NestableJoinColumnAnnotation addJoinColumn_(int index) {
+ NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
+ this.joinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ void syncAddJoinColumn(Annotation astAnnotation) {
+ int index = this.joinColumns.size();
+ NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index);
+ joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation buildJoinColumn(int index) {
+ return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildJoinColumnAnnotationAdapter(index));
+ }
+
+ private IndexedDeclarationAnnotationAdapter buildJoinColumnAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+ }
+
+ void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
+ this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public void removeJoinColumn(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation removeJoinColumn_(int index) {
+ return this.joinColumns.remove(index);
+ }
+
+ void syncRemoveJoinColumns(int index) {
+ this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.joinColumns.isEmpty();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+
+ List<Map<String, Object>> joinColumnsState = this.buildStateList(this.joinColumns.size());
+ for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) {
+ Map<String, Object> joinColumnState = new HashMap<String, Object>();
+ joinColumn.storeOn(joinColumnState);
+ joinColumnsState.add(joinColumnState);
+ }
+ map.put(JOIN_COLUMNS_LIST, joinColumnsState);
+ this.joinColumns.clear();
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> joinColumnsState = (List<Map<String, Object>>) map.get(JOIN_COLUMNS_LIST);
+ for (Map<String, Object> joinColumnState : joinColumnsState) {
+ this.addJoinColumn().restoreFrom(joinColumnState);
+ }
+ }
+
+
+ // ********** join column container **********
+
+ /**
+ * adapt the AnnotationContainer interface to the collection table's join columns
+ */
+ class JoinColumnsAnnotationContainer
+ implements AnnotationContainer<NestableJoinColumnAnnotation>
+ {
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return SourceCollectionTable2_0Annotation.this.getAstAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS;
+ }
+
+ public String getNestedAnnotationName() {
+ return JoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
+ return SourceCollectionTable2_0Annotation.this.getNestableJoinColumns();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceCollectionTable2_0Annotation.this.joinColumnsSize();
+ }
+
+ public NestableJoinColumnAnnotation addNestedAnnotation() {
+ return SourceCollectionTable2_0Annotation.this.addJoinColumn_();
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ SourceCollectionTable2_0Annotation.this.syncAddJoinColumn(astAnnotation);
+ }
+
+ public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceCollectionTable2_0Annotation.this.moveJoinColumn_(targetIndex, sourceIndex);
+ }
+
+ public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return SourceCollectionTable2_0Annotation.this.removeJoinColumn_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceCollectionTable2_0Annotation.this.syncRemoveJoinColumns(index);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
new file mode 100644
index 0000000000..3910e85f42
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.java.FetchType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * org.eclipse.persistence.annotations.Transformation
+ */
+public final class SourceElementCollection2_0Annotation
+ extends SourceAnnotation<Attribute>
+ implements ElementCollection2_0Annotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> TARGET_CLASS_ADAPTER = buildTargetClassAdapter();
+ private final AnnotationElementAdapter<String> targetClassAdapter;
+ private String targetClass;
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
+ */
+ private String fullyQualifiedTargetClassName;
+ // we need a flag since the f-q name can be null
+ private boolean fqTargetClassNameStale = true;
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+ private final AnnotationElementAdapter<String> fetchAdapter;
+ private FetchType fetch;
+
+
+ public SourceElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.targetClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, TARGET_CLASS_ADAPTER);
+ this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
+ }
+
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.targetClass = this.buildTargetClass(astRoot);
+ this.fetch = this.buildFetch(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncTargetClass(this.buildTargetClass(astRoot));
+ this.syncFetch(this.buildFetch(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.targetClass == null) &&
+ (this.fetch == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.targetClass);
+ }
+
+
+ // ********** ElementCollection2_0Annotation implementation **********
+
+ // ***** target class
+ public String getTargetClass() {
+ return this.targetClass;
+ }
+
+ public void setTargetClass(String targetClass) {
+ if (this.attributeValueHasChanged(this.targetClass, targetClass)) {
+ this.targetClass = targetClass;
+ this.fqTargetClassNameStale = true;
+ this.targetClassAdapter.setValue(targetClass);
+ }
+ }
+
+ private void syncTargetClass(String astTargetClass) {
+ if (this.attributeValueHasChanged(this.targetClass, astTargetClass)) {
+ this.syncTargetClass_(astTargetClass);
+ }
+ }
+
+ private void syncTargetClass_(String astTargetClass) {
+ String old = this.targetClass;
+ this.targetClass = astTargetClass;
+ this.fqTargetClassNameStale = true;
+ this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, astTargetClass);
+ }
+
+ private String buildTargetClass(CompilationUnit astRoot) {
+ return this.targetClassAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTargetClassTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(TARGET_CLASS_ADAPTER, astRoot);
+ }
+
+ // ***** fully-qualified target entity class name
+ public String getFullyQualifiedTargetClassName() {
+ if (this.fqTargetClassNameStale) {
+ this.fullyQualifiedTargetClassName = this.buildFullyQualifiedTargetClassName();
+ this.fqTargetClassNameStale = false;
+ }
+ return this.fullyQualifiedTargetClassName;
+ }
+
+ private String buildFullyQualifiedTargetClassName() {
+ return (this.targetClass == null) ? null : this.buildFullyQualifiedTargetClassName_();
+ }
+
+ private String buildFullyQualifiedTargetClassName_() {
+ return ASTTools.resolveFullyQualifiedName(this.targetClassAdapter.getExpression(this.buildASTRoot()));
+ }
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ if (this.attributeValueHasChanged(this.fetch, fetch)) {
+ this.fetch = fetch;
+ this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
+ }
+ }
+
+ private void syncFetch(FetchType astFetch) {
+ FetchType old = this.fetch;
+ this.fetch = astFetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, astFetch);
+ }
+
+ private FetchType buildFetch(CompilationUnit astRoot) {
+ return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(FETCH_ADAPTER, astRoot);
+ }
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__FETCH);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetClassAdapter() {
+ return buildTargetClassAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetClassAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ // TODO what about QualifiedType?
+ return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
new file mode 100644
index 0000000000..4e68a01b21
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import java.util.Arrays;
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.annotation.Generated
+ */
+public final class SourceGeneratedAnnotation
+ extends SourceAnnotation<Type>
+ implements GeneratedAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String[]> VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter<String[]> valueAdapter;
+ private final Vector<String> values = new Vector<String>();
+
+ private static final DeclarationAnnotationElementAdapter<String> DATE_ADAPTER = buildAdapter(DATE_ELEMENT_NAME);
+ private final AnnotationElementAdapter<String> dateAdapter;
+ private String date;
+
+ private static final DeclarationAnnotationElementAdapter<String> COMMENTS_ADAPTER = buildAdapter(COMMENTS_ELEMENT_NAME);
+ private final AnnotationElementAdapter<String> commentsAdapter;
+ private String comments;
+
+
+ public SourceGeneratedAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER);
+ this.dateAdapter = this.buildAdapter(DATE_ADAPTER);
+ this.commentsAdapter = this.buildAdapter(COMMENTS_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ private AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String[]>(this.annotatedElement, daea);
+ }
+
+ private AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.initializeValues(astRoot);
+ this.date = this.buildDate(astRoot);
+ this.comments = this.buildComments(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValues(astRoot);
+ this.syncDate(this.buildDate(astRoot));
+ this.syncComments(this.buildComments(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.values.isEmpty() &&
+ (this.date == null) &&
+ (this.comments == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.values);
+ }
+
+
+ // ********** GeneratedAnnotation implementation **********
+
+ // ***** values
+ public ListIterator<String> values() {
+ return new CloneListIterator<String>(this.values);
+ }
+
+ public int valuesSize() {
+ return this.values.size();
+ }
+
+ public String getValue(int index) {
+ return this.values.get(index);
+ }
+
+ public void addValue(String value) {
+ this.addValue(this.values.size(), value);
+ }
+
+ public void addValue(int index, String value) {
+ this.values.add(index, value);
+ this.writeValues();
+ }
+
+ public void moveValue(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.values, targetIndex, sourceIndex);
+ this.writeValues();
+ }
+
+ public void removeValue(String value) {
+ this.values.remove(value);
+ this.writeValues();
+ }
+
+ public void removeValue(int index) {
+ this.values.remove(index);
+ this.writeValues();
+ }
+
+ private void writeValues() {
+ this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
+ }
+
+ private void initializeValues(CompilationUnit astRoot) {
+ String[] astValues = this.valueAdapter.getValue(astRoot);
+ for (int i = 0; i < astValues.length; i++) {
+ this.values.add(astValues[i]);
+ }
+ }
+
+ private void syncValues(CompilationUnit astRoot) {
+ String[] astValues = this.valueAdapter.getValue(astRoot);
+ this.synchronizeList(Arrays.asList(astValues), this.values, VALUES_LIST);
+ }
+
+ // ***** date
+ public String getDate() {
+ return this.date;
+ }
+
+ public void setDate(String date) {
+ if (this.attributeValueHasChanged(this.date, date)) {
+ this.date = date;
+ this.dateAdapter.setValue(date);
+ }
+ }
+
+ protected void syncDate(String astDate) {
+ String old = this.date;
+ this.date = astDate;
+ this.firePropertyChanged(DATE_PROPERTY, old, astDate);
+ }
+
+ private String buildDate(CompilationUnit astRoot) {
+ return this.dateAdapter.getValue(astRoot);
+ }
+
+ // ***** comments
+ public String getComments() {
+ return this.comments;
+ }
+
+ public void setComments(String comments) {
+ if (this.attributeValueHasChanged(this.comments, comments)) {
+ this.comments = comments;
+ this.commentsAdapter.setValue(comments);
+ }
+ }
+
+ protected void syncComments(String astComments) {
+ String old = this.comments;
+ this.comments = astComments;
+ this.firePropertyChanged(COMMENTS_PROPERTY, old, astComments);
+ }
+
+ private String buildComments(CompilationUnit astRoot) {
+ return this.commentsAdapter.getValue(astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ protected static DeclarationAnnotationElementAdapter<String[]> buildValueAdapter() {
+ return buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, VALUE_ELEMENT_NAME);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, converter);
+ }
+
+ protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
+ return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+ static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
new file mode 100644
index 0000000000..ca2f005792
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyClass
+ */
+public final class SourceMapKeyClass2_0Annotation
+ extends SourceAnnotation<Attribute>
+ implements MapKeyClass2_0Annotation
+{
+ 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;
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
+ */
+ private String fullyQualifiedClassName;
+ // we need a flag since the f-q name can be null
+ private boolean fqClassNameStale = true;
+
+
+ public SourceMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** MapKeyClass2_0Annotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.fqClassNameStale = true;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(String astValue) {
+ if (this.attributeValueHasChanged(this.value, astValue)) {
+ this.syncValue_(astValue);
+ }
+ }
+
+ private void syncValue_(String astValue) {
+ String old = this.value;
+ this.value = astValue;
+ this.fqClassNameStale = true;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ // ***** fully-qualified class name
+ public String getFullyQualifiedClassName() {
+ if (this.fqClassNameStale) {
+ this.fullyQualifiedClassName = this.buildFullyQualifiedClassName();
+ this.fqClassNameStale = false;
+ }
+ return this.fullyQualifiedClassName;
+ }
+
+ private String buildFullyQualifiedClassName() {
+ return (this.value == null) ? null : this.buildFullyQualifiedClassName_();
+ }
+
+ private String buildFullyQualifiedClassName_() {
+ return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot()));
+ }
+
+
+ // ********** static methods **********
+
+ protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAP_KEY_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
new file mode 100644
index 0000000000..e0ee92ad8f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompleteColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * <code>javax.persistence.MapKeyColumn</code>
+ */
+public final class SourceMapKeyColumn2_0Annotation
+ extends SourceCompleteColumnAnnotation
+ implements MapKeyColumn2_0Annotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+
+
+ public SourceMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyColumn2_0Annotation.ANNOTATION_NAME;
+ }
+
+
+ // ********** SourceNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** SourceBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__UPDATABLE;
+ }
+
+ // ********** SourceCompleteColumnAnnotation implementation **********
+
+ @Override
+ protected String getLengthElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__LENGTH;
+ }
+
+ @Override
+ protected String getPrecisionElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__PRECISION;
+ }
+
+ @Override
+ protected String getScaleElementName() {
+ return JPA2_0.MAP_KEY_COLUMN__SCALE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
new file mode 100644
index 0000000000..6a6adffa06
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseEnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyEnumerated
+ */
+public final class SourceMapKeyEnumerated2_0Annotation
+ extends SourceBaseEnumeratedAnnotation
+ implements MapKeyEnumerated2_0Annotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyEnumerated2_0Annotation.ANNOTATION_NAME);
+
+ public SourceMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA2_0.MAP_KEY_ENUMERATED__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
new file mode 100644
index 0000000000..6f119b77fb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTemporalAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapKeyTemporal
+ */
+public final class SourceMapKeyTemporal2_0Annotation
+ extends SourceBaseTemporalAnnotation
+ implements MapKeyTemporal2_0Annotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyTemporal2_0Annotation.ANNOTATION_NAME);
+
+
+ public SourceMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyTemporal2_0Annotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA2_0.MAP_KEY_TEMPORAL__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
new file mode 100644
index 0000000000..866f42d481
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.MapsId
+ */
+public final class SourceMapsId2_0Annotation
+ extends SourceAnnotation<Attribute>
+ implements MapsId2_0Annotation
+{
+ 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;
+
+
+ public SourceMapsId2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ }
+
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** MapsId2_0Annotation implementation **********
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(String astValue) {
+ String old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public boolean valueTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(VALUE_ADAPTER, pos, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(
+ DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAPS_ID__VALUE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
new file mode 100644
index 0000000000..71a614c996
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+
+/**
+ * <code>javax.persistence.NamedQueries</code>
+ */
+public final class SourceNamedQueries2_0Annotation
+ extends SourceNamedQueriesAnnotation
+{
+ public SourceNamedQueries2_0Annotation(JavaResourceNode parent, Type type) {
+ super(parent, type);
+ }
+
+ @Override
+ protected NestableNamedQueryAnnotation buildNamedQuery(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceNamedQuery2_0Annotation.createNestedNamedQuery(this.parent, this.annotatedElement, index, this.daa);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
new file mode 100644
index 0000000000..780c127a30
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <code>javax.persistence.NamedQuery</code>
+ */
+public final class SourceNamedQuery2_0Annotation
+ extends SourceNamedQueryAnnotation
+ implements NamedQuery2_0Annotation
+{
+ private DeclarationAnnotationElementAdapter<String> lockModeDeclarationAdapter;
+ private AnnotationElementAdapter<String> lockModeAdapter;
+ private LockModeType_2_0 lockMode;
+
+
+ public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter();
+ this.lockModeAdapter = this.buildLockModeAdapter();
+ }
+
+ public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type) {
+ this(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ private String getLockModeElementName() {
+ return JPA2_0.NAMED_QUERY__LOCK_MODE;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.lockMode = this.buildLockMode(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncLockMode(this.buildLockMode(astRoot));
+ }
+
+
+ // ********** NamedQuery2_0Annotation implementation **********
+
+ public LockModeType_2_0 getLockMode() {
+ return this.lockMode;
+ }
+
+ public void setLockMode(LockModeType_2_0 lockMode) {
+ if (this.attributeValueHasChanged(this.lockMode, lockMode)) {
+ this.lockMode = lockMode;
+ this.lockModeAdapter.setValue(LockModeType_2_0.toJavaAnnotationValue(lockMode));
+ }
+ }
+
+ private void syncLockMode(LockModeType_2_0 astLockMode) {
+ LockModeType_2_0 old = this.lockMode;
+ this.lockMode = astLockMode;
+ this.firePropertyChanged(LOCK_MODE_PROPERTY, old, astLockMode);
+ }
+
+ private LockModeType_2_0 buildLockMode(CompilationUnit astRoot) {
+ return LockModeType_2_0.fromJavaAnnotationValue(this.lockModeAdapter.getValue(astRoot));
+ }
+
+ public TextRange getLockModeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.lockModeDeclarationAdapter, astRoot);
+ }
+
+ public boolean lockModeTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.lockModeDeclarationAdapter, pos, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildLockModeDeclarationAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(this.daa, this.getLockModeElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildLockModeAdapter() {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, this.lockModeDeclarationAdapter);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.lockMode == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter();
+ this.lockModeAdapter = this.buildLockModeAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(LOCK_MODE_PROPERTY, this.lockMode);
+ this.lockMode = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setLockMode((LockModeType_2_0) map.get(LOCK_MODE_PROPERTY));
+ }
+
+
+ // ********** static methods **********
+
+ static SourceNamedQuery2_0Annotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa);
+ return new SourceNamedQuery2_0Annotation(parent, type, idaa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
new file mode 100644
index 0000000000..9d45f1d4b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * <code>javax.persistence.OrderColumn</code>
+ */
+public final class SourceOrderColumn2_0Annotation
+ extends SourceNamedColumnAnnotation
+ implements OrderColumn2_0Annotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private DeclarationAnnotationElementAdapter<Boolean> nullableDeclarationAdapter;
+ private AnnotationElementAdapter<Boolean> nullableAdapter;
+ private Boolean nullable;
+
+ private DeclarationAnnotationElementAdapter<Boolean> insertableDeclarationAdapter;
+ private AnnotationElementAdapter<Boolean> insertableAdapter;
+ private Boolean insertable;
+
+ private DeclarationAnnotationElementAdapter<Boolean> updatableDeclarationAdapter;
+ private AnnotationElementAdapter<Boolean> updatableAdapter;
+ private Boolean updatable;
+
+
+ public SourceOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter();
+ this.nullableAdapter = this.buildNullableAdapter();
+ this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter();
+ this.insertableAdapter = this.buildInsertableAdapter();
+ this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter();
+ this.updatableAdapter = this.buildUpdatableAdapter();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.nullable = this.buildNullable(astRoot);
+ this.insertable = this.buildInsertable(astRoot);
+ this.updatable = this.buildUpdatable(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncNullable(this.buildNullable(astRoot));
+ this.syncInsertable(this.buildInsertable(astRoot));
+ this.syncUpdatable(this.buildUpdatable(astRoot));
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getNameElementName() {
+ return JPA2_0.ORDER_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA2_0.ORDER_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ //************* OrderColumn2_0Annotation implementation *************
+
+ // ***** nullable
+ public Boolean getNullable() {
+ return this.nullable;
+ }
+
+ public void setNullable(Boolean nullable) {
+ if (this.attributeValueHasChanged(this.nullable, nullable)) {
+ this.nullable = nullable;
+ this.nullableAdapter.setValue(nullable);
+ }
+ }
+
+ private void syncNullable(Boolean astNullable) {
+ Boolean old = this.nullable;
+ this.nullable = astNullable;
+ this.firePropertyChanged(NULLABLE_PROPERTY, old, astNullable);
+ }
+
+ private Boolean buildNullable(CompilationUnit astRoot) {
+ return this.nullableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNullableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nullableDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildNullableDeclarationAdapter() {
+ return this.buildBooleanElementAdapter(this.getNullableElementName());
+ }
+
+ private AnnotationElementAdapter<Boolean> buildNullableAdapter() {
+ return this.buildBooleanElementAdapter(this.nullableDeclarationAdapter);
+ }
+
+ String getNullableElementName() {
+ return JPA2_0.ORDER_COLUMN__NULLABLE;
+ }
+
+ // ***** insertable
+ public Boolean getInsertable() {
+ return this.insertable;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ if (this.attributeValueHasChanged(this.insertable, insertable)) {
+ this.insertable = insertable;
+ this.insertableAdapter.setValue(insertable);
+ }
+ }
+
+ private void syncInsertable(Boolean astInsertable) {
+ Boolean old = this.insertable;
+ this.insertable = astInsertable;
+ this.firePropertyChanged(INSERTABLE_PROPERTY, old, astInsertable);
+ }
+
+ private Boolean buildInsertable(CompilationUnit astRoot) {
+ return this.insertableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getInsertableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.insertableDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildInsertableDeclarationAdapter() {
+ return this.buildBooleanElementAdapter(this.getInsertableElementName());
+ }
+
+ private AnnotationElementAdapter<Boolean> buildInsertableAdapter() {
+ return this.buildBooleanElementAdapter(this.insertableDeclarationAdapter);
+ }
+
+ String getInsertableElementName() {
+ return JPA2_0.ORDER_COLUMN__INSERTABLE;
+ }
+
+ // ***** updatable
+ public Boolean getUpdatable() {
+ return this.updatable;
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ if (this.attributeValueHasChanged(this.updatable, updatable)) {
+ this.updatable = updatable;
+ this.updatableAdapter.setValue(updatable);
+ }
+ }
+
+ private void syncUpdatable(Boolean astUpdatable) {
+ Boolean old = this.updatable;
+ this.updatable = astUpdatable;
+ this.firePropertyChanged(UPDATABLE_PROPERTY, old, astUpdatable);
+ }
+
+ private Boolean buildUpdatable(CompilationUnit astRoot) {
+ return this.updatableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.updatableDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildUpdatableDeclarationAdapter() {
+ return this.buildBooleanElementAdapter(this.getUpdatableElementName());
+ }
+
+ private AnnotationElementAdapter<Boolean> buildUpdatableAdapter() {
+ return this.buildBooleanElementAdapter(this.updatableDeclarationAdapter);
+ }
+
+ String getUpdatableElementName() {
+ return JPA2_0.ORDER_COLUMN__UPDATABLE;
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.nullable == null) &&
+ (this.insertable == null) &&
+ (this.updatable == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter();
+ this.nullableAdapter = this.buildNullableAdapter();
+ this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter();
+ this.insertableAdapter = this.buildInsertableAdapter();
+ this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter();
+ this.updatableAdapter = this.buildUpdatableAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(NULLABLE_PROPERTY, this.nullable);
+ this.nullable = null;
+ map.put(INSERTABLE_PROPERTY, this.insertable);
+ this.insertable = null;
+ map.put(UPDATABLE_PROPERTY, this.updatable);
+ this.updatable = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setNullable((Boolean) map.get(NULLABLE_PROPERTY));
+ this.setInsertable((Boolean) map.get(INSERTABLE_PROPERTY));
+ this.setUpdatable((Boolean) map.get(UPDATABLE_PROPERTY));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
new file mode 100644
index 0000000000..f6fbcbcef1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * SourceSequenceGenerator2_0Annotation
+ */
+public final class SourceSequenceGenerator2_0Annotation
+ extends SourceSequenceGeneratorAnnotation
+ implements SequenceGenerator2_0Annotation
+{
+ private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__CATALOG);
+ private final AnnotationElementAdapter<String> catalogAdapter;
+ private String catalog;
+
+ private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__SCHEMA);
+ private final AnnotationElementAdapter<String> schemaAdapter;
+ private String schema;
+
+
+ // ********** constructor **********
+ public SourceSequenceGenerator2_0Annotation(JavaResourceNode parent, Member member) {
+ super(parent, member);
+ this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
+ this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.catalog = this.buildCatalog(astRoot);
+ this.schema = this.buildSchema(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncCatalog(this.buildCatalog(astRoot));
+ this.syncSchema(this.buildSchema(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.catalog == null) &&
+ (this.schema == null);
+ }
+
+
+ // ********** catalog **********
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String catalog) {
+ if (this.attributeValueHasChanged(this.catalog, catalog)) {
+ this.catalog = catalog;
+ this.catalogAdapter.setValue(catalog);
+ }
+ }
+
+ private void syncCatalog(String astCatalog) {
+ String old = this.catalog;
+ this.catalog = astCatalog;
+ this.firePropertyChanged(CATALOG_PROPERTY, old, astCatalog);
+ }
+
+ private String buildCatalog(CompilationUnit astRoot) {
+ return this.catalogAdapter.getValue(astRoot);
+ }
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(CATALOG_ADAPTER, astRoot);
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(CATALOG_ADAPTER, pos, astRoot);
+ }
+
+ // ********** schema **********
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String schema) {
+ if (this.attributeValueHasChanged(this.schema, schema)) {
+ this.schema = schema;
+ this.schemaAdapter.setValue(schema);
+ }
+ }
+
+ private void syncSchema(String astSchema) {
+ String old = this.schema;
+ this.schema = astSchema;
+ this.firePropertyChanged(SCHEMA_PROPERTY, old, astSchema);
+ }
+
+ private String buildSchema(CompilationUnit astRoot) {
+ return this.schemaAdapter.getValue(astRoot);
+ }
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(SCHEMA_ADAPTER, astRoot);
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(SCHEMA_ADAPTER, pos, astRoot);
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
new file mode 100644
index 0000000000..165188d7e6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.metamodel.StaticMetamodel
+ */
+public final class SourceStaticMetamodelAnnotation
+ extends SourceAnnotation<Type>
+ implements StaticMetamodelAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter<String> valueAdapter;
+ private String value;
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
+ */
+ private String fullyQualifiedClassName;
+ // we need a flag since the f-q name can be null
+ private boolean fqClassNameStale = true;
+
+
+ public SourceStaticMetamodelAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** StaticMetamodelAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.fqClassNameStale = true;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(String astValue) {
+ if (this.attributeValueHasChanged(this.value, astValue)) {
+ this.syncValue_(astValue);
+ }
+ }
+
+ private void syncValue_(String astValue) {
+ String old = this.value;
+ this.value = astValue;
+ this.fqClassNameStale = true;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ // ***** fully-qualified class name
+ public String getFullyQualifiedClassName() {
+ if (this.fqClassNameStale) {
+ this.fullyQualifiedClassName = this.buildFullyQualifiedClassName();
+ this.fqClassNameStale = false;
+ }
+ return this.fullyQualifiedClassName;
+ }
+
+ private String buildFullyQualifiedClassName() {
+ return (this.value == null) ? null : this.buildFullyQualifiedClassName_();
+ }
+
+ private String buildFullyQualifiedClassName_() {
+ return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot()));
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.STATIC_METAMODEL__VALUE, SimpleTypeStringExpressionConverter.instance());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java
new file mode 100644
index 0000000000..1414a3b681
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.libprov;
+
+import org.eclipse.jpt.common.core.internal.libprov.JptOsgiBundlesLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+
+public class JpaOsgiBundlesLibraryProviderInstallOperationConfig
+ extends JptOsgiBundlesLibraryProviderInstallOperationConfig
+ implements JpaLibraryProviderInstallOperationConfig {
+
+ private JpaPlatformDescription jpaPlatform;
+
+
+ public JpaOsgiBundlesLibraryProviderInstallOperationConfig() {
+ super();
+ }
+
+ public JpaPlatformDescription getJpaPlatform() {
+ return this.jpaPlatform;
+ }
+
+ public void setJpaPlatform(JpaPlatformDescription jpaPlatform) {
+ JpaPlatformDescription old = this.jpaPlatform;
+ this.jpaPlatform = jpaPlatform;
+ notifyListeners(PROP_JPA_PLATFORM, old, jpaPlatform);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java
new file mode 100644
index 0000000000..9f28287e06
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.libprov;
+
+import org.eclipse.jpt.common.core.internal.libprov.JptUserLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+
+public class JpaUserLibraryProviderInstallOperationConfig
+ extends JptUserLibraryProviderInstallOperationConfig
+ implements JpaLibraryProviderInstallOperationConfig {
+
+ private JpaPlatformDescription jpaPlatform;
+
+
+ public JpaUserLibraryProviderInstallOperationConfig() {
+ super();
+ }
+
+
+ public JpaPlatformDescription getJpaPlatform() {
+ return this.jpaPlatform;
+ }
+
+ public void setJpaPlatform(JpaPlatformDescription jpaPlatform) {
+ JpaPlatformDescription old = this.jpaPlatform;
+ this.jpaPlatform = jpaPlatform;
+ notifyListeners(PROP_JPA_PLATFORM, old, jpaPlatform);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
new file mode 100644
index 0000000000..1a7c1eca30
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.libprov;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
+import org.eclipse.jst.common.project.facet.core.libprov.LegacyLibraryProviderDetector;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+
+public class LegacyJpaLibraryProviderDetector
+ extends LegacyLibraryProviderDetector
+{
+ public static final String LEGACY_JPA_LIBRARY_PROVIDER_ID
+ = "jpa-legacy-library-provider"; //$NON-NLS-1$
+
+
+ @Override
+ public ILibraryProvider detect(
+ final IProject project, final IProjectFacet facet) {
+ if (facet.equals(JpaFacet.FACET)) {
+ return LibraryProviderFramework.getProvider(LEGACY_JPA_LIBRARY_PROVIDER_ID);
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java
new file mode 100644
index 0000000000..996c67dcfd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.libprov;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperation;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
+
+public class LegacyJpaLibraryProviderUninstallOperation
+ extends LibraryProviderOperation
+{
+ @Override
+ public void execute(
+ LibraryProviderOperationConfig config, IProgressMonitor monitor)
+ throws CoreException {
+ // no op - nothing to uninstall
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
new file mode 100644
index 0000000000..71e7bf352b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.libval;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.core.libval.LibraryValidator;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig;
+import org.eclipse.jst.common.project.facet.core.libprov.osgi.BundleReference;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Bundle;
+
+public abstract class AbstractOsgiBundlesLibraryValidator
+ implements LibraryValidator {
+
+ protected IStatus validate(
+ JpaOsgiBundlesLibraryProviderInstallOperationConfig config,
+ Map<String, VersionRange[]> bundleVersionRanges) {
+
+ Map<String, Bundle> bundles = new HashMap<String, Bundle>();
+
+ for (BundleReference bundleRef : config.getBundleReferences()) {
+ for (String bundleName : bundleVersionRanges.keySet()) {
+ // if we've gotten here, the bundle references are resolvable
+ if (bundleRef.getBundle().getSymbolicName().equals(bundleName)) {
+ bundles.put(bundleName, bundleRef.getBundle());
+ }
+ }
+ }
+
+ for (String bundleName : bundleVersionRanges.keySet()) {
+ if (bundles.get(bundleName) == null) {
+ String message
+ = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND, bundleName);
+ return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message);
+ }
+ }
+
+ for (String bundleName : bundleVersionRanges.keySet()) {
+ Bundle bundle = bundles.get(bundleName);
+ for (VersionRange versionRange : bundleVersionRanges.get(bundleName)) {
+ if (! versionRange.isIncluded(bundle.getVersion())) {
+ String message
+ = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION, bundleName);
+ return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message);
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
new file mode 100644
index 0000000000..93e8012aab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.libval;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class GenericEclipseLinkBundlesLibraryValidator
+ extends AbstractOsgiBundlesLibraryValidator {
+
+ public IStatus validate(JptLibraryProviderInstallOperationConfig config) {
+ JpaOsgiBundlesLibraryProviderInstallOperationConfig jpaConfig
+ = (JpaOsgiBundlesLibraryProviderInstallOperationConfig) config;
+ Map<String, VersionRange[]> bundleVersionRanges = new HashMap<String, VersionRange[]>();
+ String bundleName = "javax.persistence"; //$NON-NLS-1$
+ VersionRange[] versionRanges = new VersionRange[0];
+ if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_1_0)) {
+ versionRanges = new VersionRange[] {new VersionRange("[1.0, 3.0)")}; //$NON-NLS-1$
+ }
+ else if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_2_0)) {
+ versionRanges = new VersionRange[] {new VersionRange("[2.0, 3.0)")}; //$NON-NLS-1$
+ }
+ bundleVersionRanges.put(bundleName, versionRanges);
+ return validate(jpaConfig, bundleVersionRanges);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java
new file mode 100644
index 0000000000..89f01d2494
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.libval;
+
+import static org.eclipse.jst.common.project.facet.core.internal.FacetedProjectFrameworkJavaPlugin.PLUGIN_ID;
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.common.core.libval.LibraryValidator;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.libprov.JpaUserLibraryProviderInstallOperationConfig;
+import org.eclipse.osgi.util.NLS;
+
+public class GenericJpaUserLibraryValidator
+ implements LibraryValidator {
+
+ public IStatus validate(JptLibraryProviderInstallOperationConfig config) {
+ JpaUserLibraryProviderInstallOperationConfig jpaConfig
+ = (JpaUserLibraryProviderInstallOperationConfig) config;
+ Set<String> classNames = new HashSet<String>();
+ classNames.add("javax.persistence.Entity"); //$NON-NLS-1$
+ if (config.getProjectFacetVersion().compareTo(JpaFacet.VERSION_2_0) >= 0) {
+ classNames.add("javax.persistence.ElementCollection"); //$NON-NLS-1$
+ }
+ return validate(jpaConfig, classNames);
+ }
+
+ protected IStatus validate(
+ JpaUserLibraryProviderInstallOperationConfig config, Set<String> classNames) {
+
+ Set<String> classFileNames = new HashSet<String>();
+ Map<String,String> classFileNameToClassName = new HashMap<String,String>();
+ for (String className : classNames) {
+ String classFileName = className.replace('.', '/') + ".class"; //$NON-NLS-1$
+ classFileNames.add(classFileName);
+ classFileNameToClassName.put(classFileName, className);
+ }
+
+ final Map<String,Integer> classAppearanceCounts = new HashMap<String,Integer>();
+
+ for (String classFileName : classFileNames) {
+ classAppearanceCounts.put(classFileName, 0);
+ }
+
+ for (IClasspathEntry cpe : config.resolve()) {
+ if( cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY ) {
+ final File file = cpe.getPath().toFile();
+
+ if (file.exists()) {
+ ZipFile zip = null;
+
+ try {
+ zip = new ZipFile(file);
+
+ for (Enumeration<? extends ZipEntry> itr = zip.entries(); itr.hasMoreElements(); ) {
+ final ZipEntry zipEntry = itr.nextElement();
+ final String name = zipEntry.getName();
+
+ Integer count = classAppearanceCounts.get(name);
+
+ if (count != null) {
+ classAppearanceCounts.put(name, count + 1);
+ }
+ }
+ }
+ catch (IOException e) {}
+ finally {
+ if (zip != null) {
+ try {
+ zip.close();
+ }
+ catch (IOException e) {}
+ }
+ }
+ }
+ }
+ }
+
+ for (Map.Entry<String,Integer> entry : classAppearanceCounts.entrySet()) {
+ final int count = entry.getValue();
+
+ if (count == 0) {
+ final String classFileName = entry.getKey();
+ final String className = classFileNameToClassName.get(classFileName);
+ final String message =
+ NLS.bind(JptCoreMessages.USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND, className);
+ return new Status(IStatus.ERROR, PLUGIN_ID, message);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
new file mode 100644
index 0000000000..1ab0a16337
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+import java.util.Set;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.operations.AbstractJptFileCreationDataModelProvider;
+import org.eclipse.jpt.common.core.resource.ResourceLocator;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public abstract class AbstractJpaFileCreationDataModelProvider
+ extends AbstractJptFileCreationDataModelProvider
+ implements JpaFileCreationDataModelProperties
+{
+ protected AbstractJpaFileCreationDataModelProvider() {
+ super();
+ }
+
+
+ @Override
+ public Set<String> getPropertyNames() {
+ Set<String> propertyNames = super.getPropertyNames();
+ propertyNames.add(VERSION);
+ return propertyNames;
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(VERSION)) {
+ return getDefaultVersion();
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ protected abstract String getDefaultVersion();
+
+
+ // **************** validation *********************************************
+
+ @Override
+ public IStatus validate(String propertyName) {
+ IStatus status = super.validate(propertyName);
+ if (! status.isOK()) {
+ return status;
+ }
+ if (propertyName.equals(CONTAINER_PATH)
+ || propertyName.equals(VERSION)) {
+ status = validateVersion();
+ }
+ if (! status.isOK()) {
+ return status;
+ }
+
+ return status;
+ }
+
+ @Override
+ protected IStatus validateContainerPathAndFileName() {
+ IStatus status = super.validateContainerPathAndFileName();
+ if (! status.isOK()) {
+ return status;
+ }
+ IContainer container = getContainer();
+ IProject project = getProject(container);
+ if (! JpaFacet.isInstalled(project)) {
+ // verifies project has jpa facet
+ return new Status(
+ IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
+ JptCoreMessages.VALIDATE_PROJECT_NOT_JPA);
+ }
+ if (! hasSupportedPlatform(project)) {
+ // verifies project has platform that supports this file type
+ return new Status(
+ IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
+ JptCoreMessages.VALIDATE_PROJECT_IMPROPER_PLATFORM);
+ }
+ ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(project);
+ if (resourceLocator != null /* should never be null, but there might be crazy circumstances */
+ && ! resourceLocator.acceptResourceLocation(project, container)) {
+ return new Status(
+ IStatus.WARNING, JptJpaCorePlugin.PLUGIN_ID,
+ JptCoreMessages.VALIDATE_CONTAINER_QUESTIONABLE);
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus validateVersion() {
+ if (getProject() == null) {
+ return Status.OK_STATUS;
+ }
+ String fileVersion = getStringProperty(VERSION);
+ if (! fileVersionSupported(fileVersion)) {
+ return new Status(
+ IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
+ JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED);
+ }
+ try {
+ String jpaFacetVersion = getJpaFacetVersion(getProject());
+ if (! fileVersionSupportedForFacetVersion(fileVersion, jpaFacetVersion)) {
+ return new Status(
+ IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
+ JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION);
+ }
+ }
+ catch (CoreException ce) {
+ // project should have been validated already, so assume that this will never get hit
+ // fall through to final return
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected abstract boolean fileVersionSupported(String fileVersion);
+
+ protected abstract boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion);
+
+
+ // **************** helper methods *****************************************
+
+ protected JpaProject getJpaProject() {
+ return getJpaProject(getProject());
+ }
+
+ protected JpaProject getJpaProject(IProject project) {
+ return (project == null) ? null : JptJpaCorePlugin.getJpaProject(project);
+ }
+
+ protected String getJpaFacetVersion(IProject project) throws CoreException {
+ IFacetedProject fproj = ProjectFacetsManager.create(project);
+ return fproj.getProjectFacetVersion(JpaFacet.FACET).getVersionString();
+ }
+
+ protected boolean hasSupportedPlatform(IProject project) {
+ JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
+ return (jpaProject != null) && isSupportedPlatformId(jpaProject.getJpaPlatform().getId());
+ }
+
+ protected boolean isSupportedPlatformId(@SuppressWarnings("unused") String id) {
+ return true;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java
new file mode 100644
index 0000000000..e27c9479b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+
+import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.*;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public abstract class AbstractJpaFileCreationOperation
+ extends AbstractDataModelOperation
+{
+ /**
+ * Will be null until container is created or verified to exist
+ */
+ protected IContainer container;
+
+ /**
+ * Will be null until file is created or verified to exist
+ */
+ protected IFile file;
+
+
+ protected AbstractJpaFileCreationOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ SubMonitor sm = SubMonitor.convert(monitor, 5);
+ // Create folder if it does not exist
+ createContainer(sm.newChild(1));
+ // Create file
+ createFile(sm.newChild(4));
+ return OK_STATUS;
+ }
+
+ protected IContainer getContainer() throws ExecutionException {
+ IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH);
+ IContainer container = PlatformTools.getContainer(containerPath);
+ if (container == null) {
+ throw new ExecutionException("No container path specified"); //$NON-NLS-1$
+ }
+ return container;
+ }
+
+ protected IProject getProject() throws ExecutionException {
+ return getContainer().getProject();
+ }
+
+ protected JpaProject getJpaProject() throws ExecutionException {
+ IProject project = getProject();
+ JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
+ if (jpaProject == null) {
+ throw new ExecutionException("Project does not have JPA facet"); //$NON-NLS-1$
+ }
+ return jpaProject;
+ }
+
+ /**
+ * This method will create the container as specified in the data model if it does not exist.
+ */
+ protected void createContainer(IProgressMonitor monitor) throws ExecutionException {
+ IContainer container = getContainer();
+ if (! container.exists()) {
+ if (container.getType() == IContainer.PROJECT) {
+ throw new ExecutionException("Project does not exist");
+ }
+ else if (container.getType() == IContainer.FOLDER) {
+ try {
+ ((IFolder) container).create(true, true, null);
+ }
+ catch (CoreException e) {
+ throw new ExecutionException("Could not create folder", e); //$NON-NLS-1$
+ }
+ }
+ else {
+ throw new ExecutionException("Container is not a project or folder"); //$NON-NLS-1$
+ }
+ }
+ this.container = container;
+ }
+
+ protected void createFile(IProgressMonitor monitor) throws ExecutionException {
+ String fileName = getDataModel().getStringProperty(FILE_NAME);
+ IFile newFile = this.container.getFile(new Path(fileName));
+ AbstractXmlResourceProvider resourceProvider = getXmlResourceProvider(newFile);
+ try {
+ resourceProvider.createFileAndResource(getDataModel(), monitor);
+ }
+ catch (CoreException e) {
+ throw new ExecutionException("Could not create file", e);
+ }
+ this.file = newFile;
+ }
+
+ @Override
+ public ISchedulingRule getSchedulingRule() {
+ try {
+ return this.getProject();
+ } catch (ExecutionException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ protected abstract AbstractXmlResourceProvider getXmlResourceProvider(IFile file);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java
new file mode 100644
index 0000000000..e321504544
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+import org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties;
+
+public interface JpaFileCreationDataModelProperties extends JptFileCreationDataModelProperties
+{
+
+ /**
+ * Required, type {@link String}, identifies the version of the file to create
+ */
+ String VERSION = "JpaFileCreationDataModelProperties.VERSION"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java
new file mode 100644
index 0000000000..2f7bb7ebc5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+public interface OrmFileCreationDataModelProperties
+ extends JpaFileCreationDataModelProperties
+{
+ /**
+ * Optional, type AccessType, specifies the default access type (or null)
+ */
+ String DEFAULT_ACCESS = "OrmFileCreationDataModelProperties.DEFAULT_ACCESS"; //$NON-NLS-1$
+
+ /**
+ * Required, type Boolean, specifies whether to add a reference to the file
+ * in the persistence unit
+ */
+ String ADD_TO_PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT"; //$NON-NLS-1$
+
+ /**
+ * Optional (unless ADD_TO_PERSISTENCE_UNIT property is true), type String,
+ * identifies the persistence unit to which to add a reference to the file
+ */
+ String PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.PERSISTENCE_UNIT"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
new file mode 100644
index 0000000000..57cf4806bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
@@ -0,0 +1,280 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+import java.util.Iterator;
+import java.util.Set;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.resource.orm.AccessType;
+import org.eclipse.jpt.jpa.core.resource.orm.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+
+public class OrmFileCreationDataModelProvider
+ extends AbstractJpaFileCreationDataModelProvider
+ implements OrmFileCreationDataModelProperties
+{
+ /**
+ * required default constructor
+ */
+ public OrmFileCreationDataModelProvider() {
+ super();
+ }
+
+
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new OrmFileCreationOperation(getDataModel());
+ }
+
+ @Override
+ public Set<String> getPropertyNames() {
+ Set<String> propertyNames = super.getPropertyNames();
+ propertyNames.add(DEFAULT_ACCESS);
+ propertyNames.add(ADD_TO_PERSISTENCE_UNIT);
+ propertyNames.add(PERSISTENCE_UNIT);
+ return propertyNames;
+ }
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ if (propertyName.equals(PERSISTENCE_UNIT)) {
+ return getBooleanProperty(ADD_TO_PERSISTENCE_UNIT);
+ }
+ return super.isPropertyEnabled(propertyName);
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(DEFAULT_ACCESS)) {
+ return null;
+ }
+ else if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)) {
+ return Boolean.FALSE;
+ }
+ else if (propertyName.equals(PERSISTENCE_UNIT)) {
+ PersistenceUnit pUnit = getDefaultPersistenceUnit();
+ if (pUnit != null) {
+ return pUnit.getName();
+ }
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ protected String getDefaultFileName() {
+ return JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment();
+ }
+
+ @Override
+ protected String getDefaultVersion() {
+ if (getProject() == null) {
+ return null;
+ }
+ JpaPlatform jpaPlatform;
+ JpaProject jpaProject = getJpaProject();
+ jpaPlatform = (jpaProject == null)
+ ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
+ : jpaProject.getJpaPlatform();
+ return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE).getVersion();
+ }
+
+ protected PersistenceUnit getDefaultPersistenceUnit() {
+ JpaProject jpaProject = getJpaProject();
+ if (jpaProject == null) {
+ return null;
+ }
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() == 0) {
+ return null;
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ boolean ok = super.propertySet(propertyName, propertyValue);
+ if (propertyName.equals(CONTAINER_PATH)) {
+ this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.VALID_VALUES_CHG);
+ }
+ else if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)) {
+ this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.ENABLE_CHG);
+ }
+ return ok;
+ }
+
+ @Override
+ public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
+ if (propertyName.equals(DEFAULT_ACCESS)) {
+ DataModelPropertyDescriptor[] accessTypes = new DataModelPropertyDescriptor[3];
+ accessTypes[0] = accessPropertyDescriptor(null);
+ accessTypes[1] = accessPropertyDescriptor(AccessType.FIELD);
+ accessTypes[2] = accessPropertyDescriptor(AccessType.PROPERTY);
+ return accessTypes;
+ }
+ else if (propertyName.equals(PERSISTENCE_UNIT)) {
+ return ArrayTools.array(
+ new TransformationIterator<String, DataModelPropertyDescriptor>(new CompositeIterator<String>(null, persistenceUnitNames())) {
+ @Override
+ protected DataModelPropertyDescriptor transform(String next) {
+ return persistenceUnitPropertyDescriptor(next);
+ }
+ },
+ new DataModelPropertyDescriptor[0]);
+ }
+ return super.getValidPropertyDescriptors(propertyName);
+ }
+
+ @Override
+ public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
+ if (propertyName.equals(DEFAULT_ACCESS)) {
+ return accessPropertyDescriptor((AccessType) getProperty(DEFAULT_ACCESS));
+ }
+ if (propertyName.equals(PERSISTENCE_UNIT)) {
+ return persistenceUnitPropertyDescriptor(getStringProperty(PERSISTENCE_UNIT));
+ }
+ return super.getPropertyDescriptor(propertyName);
+ }
+
+ protected DataModelPropertyDescriptor accessPropertyDescriptor(AccessType accessType) {
+ if (accessType == null) {
+ return new DataModelPropertyDescriptor(null, JptCoreMessages.NONE);
+ }
+ return new DataModelPropertyDescriptor(accessType, accessType.getName());
+ }
+
+ DataModelPropertyDescriptor persistenceUnitPropertyDescriptor(String persistenceUnitName) {
+ if (StringTools.stringIsEmpty(persistenceUnitName)) {
+ return new DataModelPropertyDescriptor(null, JptCoreMessages.NONE);
+ }
+ return new DataModelPropertyDescriptor(persistenceUnitName);
+ }
+
+
+ // **************** validation *********************************************
+
+ @Override
+ public IStatus validate(String propertyName) {
+ IStatus status = super.validate(propertyName);
+ if (! status.isOK()) {
+ return status;
+ }
+
+ if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)
+ || propertyName.equals(PERSISTENCE_UNIT)) {
+ status = validatePersistenceUnit();
+ }
+ if (! status.isOK()) {
+ return status;
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected boolean fileVersionSupported(String fileVersion) {
+ return (fileVersion.equals(JPA.SCHEMA_VERSION)
+ || fileVersion.equals(JPA2_0.SCHEMA_VERSION));
+ }
+
+ @Override
+ protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
+ if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString())
+ && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
+ return false;
+ }
+ return true;
+ }
+
+ protected IStatus validatePersistenceUnit() {
+ boolean addToPUnit = getBooleanProperty(ADD_TO_PERSISTENCE_UNIT);
+ String projectName = getProject().getName();
+ String pUnitName = getStringProperty(PERSISTENCE_UNIT);
+ if (addToPUnit) {
+ if (StringTools.stringIsEmpty(pUnitName)) {
+ return new Status(
+ IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
+ NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED, pUnitName));
+ }
+ if (getPersistenceUnit() == null) {
+ return new Status(
+ IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
+ NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT, pUnitName, projectName));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+
+ // **************** helper methods *****************************************
+
+ protected PersistenceUnit getPersistenceUnit() {
+ String pUnitName = getStringProperty(PERSISTENCE_UNIT);
+ JpaProject jpaProject =
+ (StringTools.stringIsEmpty(pUnitName)) ? null : getJpaProject();
+ PersistenceXml persistenceXml =
+ (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
+ Persistence persistence =
+ (persistenceXml == null) ? null : persistenceXml.getPersistence();
+ if (persistence != null) {
+ for (Iterator<PersistenceUnit> stream = persistence.persistenceUnits(); stream.hasNext(); ) {
+ PersistenceUnit next = stream.next();
+ if (pUnitName.equals(next.getName())) {
+ return next;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected Iterator<PersistenceUnit> persistenceUnits() {
+ //only get the persistence units for the selected JpaProject,
+ //if no jpa project is selected, then no persistence units will be listed in the combo
+ JpaProject jpaProject = getJpaProject();
+ PersistenceXml persistenceXml = (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
+ Persistence persistence = (persistenceXml == null) ? null : persistenceXml.getPersistence();
+ return (persistence == null) ? EmptyIterator.<PersistenceUnit>instance() : persistence.persistenceUnits();
+ }
+
+ protected Iterator<String> persistenceUnitNames() {
+ return new TransformationIterator<PersistenceUnit, String>(persistenceUnits()) {
+ @Override
+ protected String transform(PersistenceUnit next) {
+ return next.getName();
+ }
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
new file mode 100644
index 0000000000..7f2879eede
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+import java.util.Iterator;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class OrmFileCreationOperation
+ extends AbstractJpaFileCreationOperation
+ implements OrmFileCreationDataModelProperties
+{
+ public OrmFileCreationOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ SubMonitor sm = SubMonitor.convert(monitor, 5);
+ IStatus status = super.execute(sm.newChild(4), info);
+
+ if (status.isOK()) {
+ addMappingFileToPersistenceXml();
+ sm.worked(1);
+ }
+
+ return OK_STATUS;
+ }
+
+ protected PersistenceUnit getPersistenceUnit() throws ExecutionException {
+ String pUnitName = getDataModel().getStringProperty(PERSISTENCE_UNIT);
+ JpaProject jpaProject = getJpaProject();
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ throw new ExecutionException("Project does not have a persistence.xml file"); //$NON-NLS-1$
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ throw new ExecutionException("persistence.xml does not have a persistence node."); //$NON-NLS-1$
+ }
+ for (Iterator<PersistenceUnit> stream = persistence.persistenceUnits(); stream.hasNext(); ) {
+ PersistenceUnit pUnit = stream.next();
+ if (pUnitName.equals(pUnit.getName())) {
+ return pUnit;
+ }
+ }
+ throw new ExecutionException("persistence.xml does not have persistence unit named \'" + pUnitName + "\'"); //$NON-NLS-1$
+ }
+
+ protected void addMappingFileToPersistenceXml() throws ExecutionException {
+ if (! getDataModel().getBooleanProperty(ADD_TO_PERSISTENCE_UNIT)) {
+ return;
+ }
+ JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(this.file.getProject());
+ JpaXmlResource resource = jpaProject.getPersistenceXmlResource();
+
+ final PersistenceUnit pUnit = getPersistenceUnit();
+
+ resource.modify(new Runnable() {
+ public void run() {
+ IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH);
+ String fileName = getDataModel().getStringProperty(FILE_NAME);
+ IContainer container = PlatformTools.getContainer(containerPath);
+ IPath filePath = container.getFullPath().append(fileName);
+ IProject project = container.getProject();
+ IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, filePath);
+ for (Iterator<MappingFileRef> stream = pUnit.specifiedMappingFileRefs(); stream.hasNext(); ) {
+ if (runtimePath.equals(stream.next().getFileName())) {
+ return;
+ }
+ }
+ pUnit.addSpecifiedMappingFileRef(runtimePath.toString());
+ }
+ });
+ }
+
+ @Override
+ protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
+ return OrmXmlResourceProvider.getXmlResourceProvider(file);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java
new file mode 100644
index 0000000000..9b74e68753
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+public interface PersistenceFileCreationDataModelProperties
+ extends JpaFileCreationDataModelProperties
+{
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java
new file mode 100644
index 0000000000..506f97545a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.persistence.JPA;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+
+public class PersistenceFileCreationDataModelProvider
+ extends AbstractJpaFileCreationDataModelProvider
+ implements PersistenceFileCreationDataModelProperties
+{
+ /**
+ * required default constructor
+ */
+ public PersistenceFileCreationDataModelProvider() {
+ super();
+ }
+
+
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new PersistenceFileCreationOperation(getDataModel());
+ }
+
+ @Override
+ protected String getDefaultFileName() {
+ return JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH.lastSegment();
+ }
+
+ @Override
+ protected String getDefaultVersion() {
+ if (getProject() == null) {
+ return null;
+ }
+ JpaPlatform jpaPlatform;
+ JpaProject jpaProject = getJpaProject();
+ jpaPlatform = (jpaProject == null)
+ ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
+ : jpaProject.getJpaPlatform();
+ return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
+ }
+
+
+ // **************** validation *********************************************
+
+ @Override
+ protected boolean fileVersionSupported(String fileVersion) {
+ return (fileVersion.equals(JPA.SCHEMA_VERSION)
+ || fileVersion.equals(JPA2_0.SCHEMA_VERSION));
+ }
+
+ @Override
+ protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
+ if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString())
+ && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java
new file mode 100644
index 0000000000..996b0454b3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.operations;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class PersistenceFileCreationOperation
+ extends AbstractJpaFileCreationOperation
+ implements PersistenceFileCreationDataModelProperties
+{
+ public PersistenceFileCreationOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+
+ @Override
+ protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
+ return PersistenceXmlResourceProvider.getXmlResourceProvider(file);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java
new file mode 100644
index 0000000000..4a602f15f7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.platform;
+
+import org.eclipse.jpt.common.core.internal.XPointUtil;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class JpaPlatformDescriptionImpl
+ implements JpaPlatformDescription {
+
+ private String id;
+ private String pluginId;
+ private String label;
+ private String factoryClassName;
+ private IProjectFacetVersion jpaFacetVersion;
+ private boolean default_ = false;
+ private JpaPlatformGroupDescriptionImpl group;
+
+
+ public String getId() {
+ return this.id;
+ }
+
+ void setId(String id) {
+ this.id = id;
+ }
+
+ public String getPluginId() {
+ return this.pluginId;
+ }
+
+ void setPluginId(String pluginId) {
+ this.pluginId = pluginId;
+ }
+
+ public String getLabel() {
+ return this.label;
+ }
+
+ void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getFactoryClassName() {
+ return this.factoryClassName;
+ }
+
+ void setFactoryClassName(String className) {
+ this.factoryClassName = className;
+ }
+
+ public IProjectFacetVersion getJpaFacetVersion() {
+ return this.jpaFacetVersion;
+ }
+
+ void setJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
+ if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
+ throw new IllegalArgumentException(jpaFacetVersion.toString());
+ }
+ this.jpaFacetVersion = jpaFacetVersion;
+ }
+
+ public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
+ if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
+ throw new IllegalArgumentException(jpaFacetVersion.toString());
+ }
+ return (this.jpaFacetVersion != null) ? this.jpaFacetVersion.equals(jpaFacetVersion) : true;
+ }
+
+ public boolean isDefault() {
+ return this.default_;
+ }
+
+ void setDefault(boolean default_) {
+ this.default_ = default_;
+ }
+
+ public JpaPlatformGroupDescription getGroup() {
+ return this.group;
+ }
+
+ void setGroup(JpaPlatformGroupDescriptionImpl group) {
+ this.group = group;
+ }
+
+ public JpaPlatform buildJpaPlatform() {
+ JpaPlatformFactory factory = (JpaPlatformFactory) XPointUtil.instantiate(
+ this.pluginId, JpaPlatformManagerImpl.QUALIFIED_EXTENSION_POINT_ID,
+ this.factoryClassName, JpaPlatformFactory.class);
+ return factory.buildJpaPlatform(getId());
+ }
+
+ @Override
+ public String toString() {
+ return this.label;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java
new file mode 100644
index 0000000000..2ca9afe58c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.platform;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+
+public class JpaPlatformGroupDescriptionImpl
+ implements JpaPlatformGroupDescription {
+
+ private String id;
+ private String pluginId;
+ private String label;
+ private Map<String, JpaPlatformDescriptionImpl> platforms;
+
+
+ JpaPlatformGroupDescriptionImpl() {
+ this.platforms = new HashMap<String, JpaPlatformDescriptionImpl>();
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ void setId(String id) {
+ this.id = id;
+ }
+
+ public String getPluginId() {
+ return this.pluginId;
+ }
+
+ void setPluginId(String pluginId) {
+ this.pluginId = pluginId;
+ }
+
+ public String getLabel() {
+ return this.label;
+ }
+
+ void setLabel(String label) {
+ this.label = label;
+ }
+
+ void addPlatform(JpaPlatformDescriptionImpl platform) {
+ this.platforms.put(platform.getId(), platform);
+ }
+
+ public Iterable<JpaPlatformDescription> getPlatforms() {
+ return new SuperIterableWrapper<JpaPlatformDescription>(CollectionTools.collection(this.platforms.values()));
+ }
+
+ @Override
+ public String toString() {
+ return this.label;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java
new file mode 100644
index 0000000000..847aa3b558
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.platform;
+
+import static org.eclipse.jpt.common.core.internal.XPointUtil.*;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IConfigurationElement;
+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.common.core.internal.XPointUtil.XPointException;
+import org.eclipse.jpt.common.utility.internal.KeyedSet;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * Singleton registry for storing all the registered JPA platform configuration
+ * elements and instantiating JPA platforms from them.
+ */
+public class JpaPlatformManagerImpl
+ implements JpaPlatformManager {
+
+ static final String EXTENSION_POINT_ID = "jpaPlatforms"; //$NON-NLS-1$
+ static final String QUALIFIED_EXTENSION_POINT_ID = JptJpaCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
+ static final String PLATFORM_GROUP_ELEMENT = "jpaPlatformGroup"; //$NON-NLS-1$
+ static final String PLATFORM_ELEMENT = "jpaPlatform"; //$NON-NLS-1$
+ static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+ static final String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$
+ static final String FACTORY_CLASS_ATTRIBUTE = "factoryClass"; //$NON-NLS-1$
+ static final String JPA_FACET_VERSION_ATTRIBUTE = "jpaFacetVersion"; //$NON-NLS-1$
+ static final String DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$
+ static final String GROUP_ELEMENT = "group"; //$NON-NLS-1$
+
+
+ private static final JpaPlatformManagerImpl INSTANCE = new JpaPlatformManagerImpl();
+
+
+ public static JpaPlatformManagerImpl instance() {
+ return INSTANCE;
+ }
+
+
+ private KeyedSet<String, JpaPlatformGroupDescriptionImpl> jpaPlatformGroupDescriptions;
+ private KeyedSet<String, JpaPlatformDescriptionImpl> jpaPlatformDescriptions;
+
+
+ // ********** constructor/initialization **********
+
+ private JpaPlatformManagerImpl() {
+ super();
+ this.jpaPlatformGroupDescriptions = new KeyedSet<String, JpaPlatformGroupDescriptionImpl>();
+ this.jpaPlatformDescriptions = new KeyedSet<String, JpaPlatformDescriptionImpl>();
+ readExtensions();
+ }
+
+
+ private void readExtensions() {
+ final IExtensionRegistry registry = Platform.getExtensionRegistry();
+
+ final IExtensionPoint xpoint
+ = registry.getExtensionPoint(JptJpaCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID);
+
+ if (xpoint == null) {
+ throw new IllegalStateException();
+ }
+
+ List<IConfigurationElement> platformGroupConfigs = new ArrayList<IConfigurationElement>();
+ List<IConfigurationElement> platformConfigs = new ArrayList<IConfigurationElement>();
+
+ for (IExtension extension : xpoint.getExtensions()) {
+ for (IConfigurationElement element : extension.getConfigurationElements()) {
+ if (element.getName().equals(PLATFORM_GROUP_ELEMENT)) {
+ platformGroupConfigs.add(element);
+ }
+ else if (element.getName().equals(PLATFORM_ELEMENT)) {
+ platformConfigs.add(element);
+ }
+ }
+ }
+
+ for (IConfigurationElement element : platformGroupConfigs) {
+ readPlatformGroupExtension(element);
+ }
+
+ for (IConfigurationElement element : platformConfigs) {
+ readPlatformExtension(element);
+ }
+ }
+
+ private void readPlatformGroupExtension(IConfigurationElement element) {
+ try {
+ final JpaPlatformGroupDescriptionImpl desc = new JpaPlatformGroupDescriptionImpl();
+
+ // plug-in id
+ desc.setPluginId(element.getContributor().getName());
+
+ // id
+ desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
+
+ if (this.jpaPlatformGroupDescriptions.containsKey(desc.getId())) {
+ logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
+ throw new XPointException();
+ }
+
+ // label
+ desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
+
+ this.jpaPlatformGroupDescriptions.addItem(desc.getId(), desc);
+ }
+ catch (XPointException e) {
+ // Ignore and continue. The problem has already been reported to the user
+ // in the log.
+ }
+ }
+
+ private void readPlatformExtension(IConfigurationElement element) {
+ try {
+ final JpaPlatformDescriptionImpl desc = new JpaPlatformDescriptionImpl();
+
+ // plug-in id
+ desc.setPluginId(element.getContributor().getName());
+
+ // id
+ desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
+
+ if (this.jpaPlatformDescriptions.containsKey(desc.getId())) {
+ logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
+ throw new XPointException();
+ }
+
+ // label
+ desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
+
+ // factory class
+ desc.setFactoryClassName(findRequiredAttribute(element, FACTORY_CLASS_ATTRIBUTE));
+
+ // JPA facet version
+ String jpaFacetVersionString = element.getAttribute(JPA_FACET_VERSION_ATTRIBUTE);
+ if (jpaFacetVersionString != null) {
+ IProjectFacetVersion jpaFacetVersion = JpaFacet.FACET.getVersion(jpaFacetVersionString);
+ if (jpaFacetVersion != null) {
+ desc.setJpaFacetVersion(jpaFacetVersion);
+ }
+ else {
+ logInvalidValue(element, JPA_FACET_VERSION_ATTRIBUTE, jpaFacetVersionString);
+ throw new XPointException();
+ }
+ }
+
+ // default
+ String defaultString = element.getAttribute(DEFAULT_ATTRIBUTE);
+ if (defaultString != null) {
+ if (defaultString.equals("true")) {
+ desc.setDefault(true);
+ }
+ else if (defaultString.equals("false")) {
+ desc.setDefault(false);
+ }
+ else {
+ logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString);
+ throw new XPointException();
+ }
+ }
+
+ // group
+ String groupId = element.getAttribute(GROUP_ELEMENT);
+ if (groupId != null) {
+ JpaPlatformGroupDescriptionImpl group = this.jpaPlatformGroupDescriptions.getItem(groupId);
+ if (group != null) {
+ desc.setGroup(group);
+ group.addPlatform(desc);
+ }
+ else {
+ logInvalidValue(element, GROUP_ELEMENT, groupId);
+ throw new XPointException();
+ }
+ }
+
+ this.jpaPlatformDescriptions.addItem(desc.getId(), desc);
+ }
+ catch (XPointException e) {
+ // Ignore and continue. The problem has already been reported to the user
+ // in the log.
+ }
+ }
+
+
+ // ********** public methods **********
+
+ public Iterable<JpaPlatformGroupDescription> getJpaPlatformGroups() {
+ return new SuperIterableWrapper<JpaPlatformGroupDescription>(this.jpaPlatformGroupDescriptions.getItemSet());
+ }
+
+ public JpaPlatformGroupDescription getJpaPlatformGroup(String groupId) {
+ return this.jpaPlatformGroupDescriptions.getItem(groupId);
+ }
+
+ public Iterable<JpaPlatformDescription> getJpaPlatforms() {
+ return new SuperIterableWrapper<JpaPlatformDescription>(this.jpaPlatformDescriptions.getItemSet());
+ }
+
+ public JpaPlatformDescription getJpaPlatform(String platformId) {
+ return this.jpaPlatformDescriptions.getItem(platformId);
+ }
+
+ public JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion) {
+ for (JpaPlatformDescription platform : getJpaPlatforms()) {
+ if (platform.isDefault() && platform.supportsJpaFacetVersion(jpaFacetVersion)) {
+ return platform;
+ }
+ }
+ return null;
+ }
+ public JpaPlatform buildJpaPlatformImplementation(IProject project) {
+ String jpaPlatformId = JptJpaCorePlugin.getJpaPlatformId(project);
+ JpaPlatformDescriptionImpl platformDesc = this.jpaPlatformDescriptions.getItem(jpaPlatformId);
+ if (platformDesc == null) {
+ throw new IllegalArgumentException("Project does not have a recognized JPA platform.");
+ }
+ return platformDesc.buildJpaPlatform();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java
new file mode 100644
index 0000000000..d6fd0418ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.prefs;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+
+/**
+ * Class used to initialize default preference values.
+ * See <code>org.eclipse.core.runtime.preferences</code> extension point.
+ */
+public class JpaPreferenceInitializer
+ extends AbstractPreferenceInitializer
+{
+ @Override
+ public void initializeDefaultPreferences() {
+ JptJpaCorePlugin.initializeDefaultPreferences();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
new file mode 100644
index 0000000000..9a9ada9879
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
@@ -0,0 +1,288 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.DeleteParticipant;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.TextEdit;
+
+
+public abstract class AbstractJpaDeleteTypeParticipant
+ extends DeleteParticipant
+{
+
+ /**
+ * Store all the types that are going to be deleted including nestedTypes.
+ */
+ protected final Set<IType> allTypes;
+
+ /**
+ * Store the persistence.xml DeleteEdits in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<DeleteEdit>> persistenceXmlDeleteEdits;
+
+ /**
+ * Store the mapping file DeleteEdits in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<DeleteEdit>> mappingFilePersistentTypeDeleteEdits;
+
+ protected AbstractJpaDeleteTypeParticipant() {
+ super();
+ this.allTypes = new HashSet<IType>();
+ this.persistenceXmlDeleteEdits = new HashMap<IFile, Iterable<DeleteEdit>>();
+ this.mappingFilePersistentTypeDeleteEdits = new HashMap<IFile, Iterable<DeleteEdit>>();
+ }
+
+ /**
+ * Nested types are not added to the deleteParticipant when the parent is deleted.
+ * We must handle them in case they are mapped.
+ */
+ protected void addType(IType type) {
+ this.allTypes.add(type);
+ this.addNestedTypes(type);
+ }
+
+ private void addNestedTypes(IType type) {
+ IType[] nestedTypes;
+ try {
+ nestedTypes = type.getTypes();
+ }
+ catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return;
+ }
+
+ for (IType nestedType : nestedTypes) {
+ this.addType(nestedType);
+ }
+ }
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate DeleteEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ //since the progress bar will hang if a large JPA project is being loaded,
+ //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2);
+ sm.subTask(this.getCheckConditionsSubTaskName());
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) {
+ this.createDeleteEdits(sm.newChild(10), jpaProject);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile file : this.persistenceXmlDeleteEdits.keySet()) {
+ deltaFactory.change(file);
+ }
+ sm.worked(1);
+ for (IFile file : this.mappingFilePersistentTypeDeleteEdits.keySet()) {
+ deltaFactory.change(file);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ /**
+ * This will be appended to the main refactoring task named : 'Checking preconditions...'
+ */
+ protected String getCheckConditionsSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlDeleteEdits.isEmpty() && this.mappingFilePersistentTypeDeleteEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlDeleteEdits.size() + this.mappingFilePersistentTypeDeleteEdits.size());
+ sm.subTask(this.getCreateChangeSubTaskName());
+ CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_CHANGE_NAME);
+ for (IFile persistenceXmlFile : this.persistenceXmlDeleteEdits.keySet()) {
+ this.addPersistenceXmlDeleteTypeChange(persistenceXmlFile, compositeChange);
+ sm.worked(1);
+ }
+ for (IFile mappingFile : this.mappingFilePersistentTypeDeleteEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addMappingFileDeleteTypeChange(mappingFile, compositeChange);
+ sm.worked(1);
+ }
+ //must check for children in case all changes were made in other participant's TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+ /**
+ * This will be appended to the main refactoring task named : 'Creating workspace modifications...'
+ */
+ protected String getCreateChangeSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ protected void createDeleteEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize());
+ Iterable<DeleteEdit> persistenceXmlDeleteEdits = this.createPersistenceXmlDeleteEdits(persistenceUnit);
+ if (!CollectionTools.isEmpty(persistenceXmlDeleteEdits)) {
+ this.persistenceXmlDeleteEdits.put(jpaProject.getPersistenceXmlResource().getFile(), persistenceXmlDeleteEdits);
+ }
+ sm.worked(1);
+ for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ Iterable<DeleteEdit> mappingFileDeleteEdits = this.createMappingFileDeleteTypeEdits(mappingFileRef);
+ if (!CollectionTools.isEmpty(mappingFileDeleteEdits)) {
+ this.mappingFilePersistentTypeDeleteEdits.put((IFile) mappingFileRef.getMappingFile().getResource(), mappingFileDeleteEdits);
+ }
+ sm.worked(1);
+ }
+ }
+
+ protected Iterable<DeleteEdit> createPersistenceXmlDeleteEdits(final PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<DeleteEdit>(
+ new TransformationIterable<IType, Iterable<DeleteEdit>>(this.getTypesOnClasspath(persistenceUnit.getJpaProject())) {
+ @Override
+ protected Iterable<DeleteEdit> transform(IType type) {
+ return persistenceUnit.createDeleteTypeEdits(type);
+ }
+ }
+ );
+ }
+
+ protected Iterable<IType> getTypesOnClasspath(final JpaProject jpaProject) {
+ final IJavaProject javaProject = jpaProject.getJavaProject();
+ return new FilteringIterable<IType>(this.allTypes) {
+ @Override
+ protected boolean accept(IType type) {
+ return javaProject.isOnClasspath(type);
+ }
+ };
+ }
+
+ protected void addPersistenceXmlDeleteTypeChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ Iterable<DeleteEdit> deleteTypeEdits = this.persistenceXmlDeleteEdits.get(persistenceXmlFile);
+
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
+ //TODO probably need to figure out TextEditGroups since these can be used to show check boxes under the file in the preview dialog
+ //also used to add edits to existing changes??
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+// textChange.addTextEditGroup(new TextEditGroup("edit persistence unit", multiTextEdit));???
+ compositeChange.add(textChange);
+ }
+ this.addEdits(textChange, deleteTypeEdits);
+ }
+
+ private Iterable<DeleteEdit> createMappingFileDeleteTypeEdits(final MappingFileRef mappingFileRef) {
+ return new CompositeIterable<DeleteEdit>(
+ new TransformationIterable<IType, Iterable<DeleteEdit>>(this.getTypesOnClasspath(mappingFileRef.getJpaProject())) {
+ @Override
+ protected Iterable<DeleteEdit> transform(IType type) {
+ return mappingFileRef.createDeleteTypeEdits(type);
+ }
+ }
+ );
+ }
+
+ protected void addMappingFileDeleteTypeChange(IFile mappingFile, CompositeChange compositeChange) {
+ Iterable<DeleteEdit> deleteTypeEdits = this.mappingFilePersistentTypeDeleteEdits.get(mappingFile);
+
+ TextChange textChange = getTextChange(mappingFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME, mappingFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ this.addEdits(textChange, deleteTypeEdits);
+ }
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException ex) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
new file mode 100644
index 0000000000..13bc76ed57
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
@@ -0,0 +1,294 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
+import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
+import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
+public abstract class AbstractJpaMoveJavaElementParticipant
+ extends MoveParticipant implements ISharableParticipant {
+
+ /**
+ * Store the {@link IJavaElements}s to be moved and their corresponding {@link MoveArguments}
+ */
+ protected final Map<IJavaElement, MoveArguments> originalJavaElements;
+
+ /**
+ * Store the persistence.xml ReplaceEdits in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
+
+ /**
+ * Store the mapping file ReplaceEdits in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> mappingFileReplaceEdits;
+
+ protected AbstractJpaMoveJavaElementParticipant() {
+ super();
+ this.originalJavaElements = new HashMap<IJavaElement, MoveArguments>();
+ this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ this.mappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if (!getArguments().getUpdateReferences()) {
+ //we do not want to do any refactoring if the user chooses not to update references
+ return false;
+ }
+ this.addElement(element, getArguments());
+ return true;
+ }
+
+
+ //****************ISharableParticipant implementation *****************
+ /**
+ * This is used when multiple mapping files are deleted.
+ * RefactoringParticipant#initialize(Object) is called for the first deleted IFile.
+ * RefactoringParticipant#getArguments() only applies to the first deleted IFile
+ */
+ public void addElement(Object element, RefactoringArguments arguments) {
+ this.originalJavaElements.put((IJavaElement) element, (MoveArguments) arguments);
+ }
+
+ protected MoveArguments getArguments(IJavaElement element) {
+ return this.originalJavaElements.get(element);
+ }
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2);
+ sm.subTask(this.getCheckConditionsSubTaskName());
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) {
+ this.createReplaceEdits(sm.newChild(10), jpaProject);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile file : this.persistenceXmlReplaceEdits.keySet()) {
+ deltaFactory.change(file);
+ }
+ sm.worked(1);
+ for (IFile file : this.mappingFileReplaceEdits.keySet()) {
+ deltaFactory.change(file);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ protected abstract String getCompositeChangeName();
+
+ /**
+ * This will be appended to the main refactoring task named : 'Checking preconditions...'
+ */
+ protected abstract String getCheckConditionsSubTaskName();
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlReplaceEdits.isEmpty() && this.mappingFileReplaceEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size() + this.mappingFileReplaceEdits.size());
+ sm.subTask(this.getCreateChangeSubTaskName());
+ CompositeChange compositeChange = new CompositeChange(this.getCompositeChangeName());
+ for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
+ this.addPersistenceXmlRenameEdits(persistenceXmlFile, compositeChange);
+ sm.worked(1);
+ }
+ for (IFile mappingFile : this.mappingFileReplaceEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addMappingFileRenameEdits(mappingFile, compositeChange);
+ sm.worked(1);
+ }
+ //must check for children in case all changes were made in other participant's TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+ /**
+ * This will be appended to the main refactoring task named : 'Creating workspace modifications...'
+ */
+ protected abstract String getCreateChangeSubTaskName();
+
+ protected void createReplaceEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize());
+ Iterable<ReplaceEdit> classRefDeleteEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit);
+ sm.worked(1);
+ if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
+ this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
+ }
+ for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ Iterable<ReplaceEdit> mappingFileReplaceEdits = this.createMappingFileReplaceEditsCheckClasspath(mappingFileRef);
+ if (!CollectionTools.isEmpty(mappingFileReplaceEdits)) {
+ IFile file = (IFile) mappingFileRef.getMappingFile().getResource();
+ this.mappingFileReplaceEdits.put(file, mappingFileReplaceEdits);
+ }
+ sm.worked(1);
+ }
+ }
+
+ protected Iterable<ReplaceEdit> createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<IJavaElement, Iterable<ReplaceEdit>>(this.getElementsOnClasspath(persistenceUnit.getJpaProject())) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(IJavaElement javaElement) {
+ return createPersistenceXmlReplaceEdits(persistenceUnit, javaElement, getArguments(javaElement).getDestination());
+ }
+ }
+ );
+ }
+
+ protected Iterable<IJavaElement> getElementsOnClasspath(final JpaProject jpaProject) {
+ final IJavaProject javaProject = jpaProject.getJavaProject();
+ return new FilteringIterable<IJavaElement>(this.originalJavaElements.keySet()) {
+ @Override
+ protected boolean accept(IJavaElement javaElement) {
+ return javaProject.isOnClasspath(javaElement);
+ }
+ };
+ }
+
+ protected abstract Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit, IJavaElement javaElement, Object destination);
+
+ protected void addPersistenceXmlRenameEdits(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ Iterable<ReplaceEdit> replacePackageEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile);
+
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(this.getPersistenceXmlChangeName(), persistenceXmlFile);
+ //TODO probably need to figure out TextEditGroups since these can be used to show check boxes under the file in the preview dialog
+ //also used to add edits to existing changes??
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+// textChange.addTextEditGroup(new TextEditGroup("edit persistence unit", multiTextEdit));???
+ compositeChange.add(textChange);
+ }
+ this.addEdits(textChange, replacePackageEdits);
+ }
+
+ protected abstract String getPersistenceXmlChangeName();
+
+
+ private Iterable<ReplaceEdit> createMappingFileReplaceEditsCheckClasspath(final MappingFileRef mappingFileRef) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<IJavaElement, Iterable<ReplaceEdit>>(this.getElementsOnClasspath(mappingFileRef.getJpaProject())) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(IJavaElement javaElement) {
+ return createMappingFileReplaceEdits(mappingFileRef, javaElement, getArguments(javaElement).getDestination());
+ }
+ }
+ );
+ }
+
+ protected abstract Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef, IJavaElement javaElement, Object destination);
+
+
+ protected void addMappingFileRenameEdits(IFile mappingFile, CompositeChange compositeChange) {
+ Iterable<ReplaceEdit> replacedTypeEdits = this.mappingFileReplaceEdits.get(mappingFile);
+
+ TextChange textChange = getTextChange(mappingFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(this.getMappingFileChangeName(), mappingFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ this.addEdits(textChange, replacedTypeEdits);
+ }
+
+ protected abstract String getMappingFileChangeName();
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException ex) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
new file mode 100644
index 0000000000..d0d951594c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
+public abstract class AbstractJpaRenameJavaElementParticipant
+ extends RenameParticipant {
+
+ protected IJavaElement originalJavaElement;
+
+ /**
+ * Store the persistence.xml ReplaceEdits in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
+
+ /**
+ * Store the mapping file ReplaceEdits in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> mappingFileReplaceEdits;
+
+ protected AbstractJpaRenameJavaElementParticipant() {
+ super();
+ this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ this.mappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if (!getArguments().getUpdateReferences()) {
+ //we do not want to do any refactoring if the user chooses not to update references
+ return false;
+ }
+ this.originalJavaElement = (IJavaElement) element;
+ return true;
+ }
+
+ protected IJavaElement getOriginalJavaElement() {
+ return this.originalJavaElement;
+ }
+
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2);
+ sm.subTask(this.getCheckConditionsSubTaskName());
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) {
+ this.createReplaceEdits(sm.newChild(10), jpaProject);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile file : this.persistenceXmlReplaceEdits.keySet()) {
+ deltaFactory.change(file);
+ }
+ sm.worked(1);
+ for (IFile file : this.mappingFileReplaceEdits.keySet()) {
+ deltaFactory.change(file);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ protected abstract String getCompositeChangeName();
+
+ /**
+ * This will be appended to the main refactoring task named : 'Checking preconditions...'
+ */
+ protected abstract String getCheckConditionsSubTaskName();
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlReplaceEdits.isEmpty() && this.mappingFileReplaceEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size() + this.mappingFileReplaceEdits.size());
+ sm.subTask(this.getCreateChangeSubTaskName());
+ CompositeChange compositeChange = new CompositeChange(this.getCompositeChangeName());
+ for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
+ this.addPersistenceXmlRenameEdits(persistenceXmlFile, compositeChange);
+ sm.worked(1);
+ }
+ for (IFile mappingFile : this.mappingFileReplaceEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addMappingFileRenameEdits(mappingFile, compositeChange);
+ sm.worked(1);
+ }
+ //must check for children in case all changes were made in other participant's TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+ /**
+ * This will be appended to the main refactoring task named : 'Creating workspace modifications...'
+ */
+ protected abstract String getCreateChangeSubTaskName();
+
+ protected void createReplaceEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize());
+ Iterable<ReplaceEdit> classRefDeleteEdits = this.createPersistenceXmlReplaceEditsCheckClasspath(persistenceUnit);
+ sm.worked(1);
+ if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
+ this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
+ }
+ for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ Iterable<ReplaceEdit> mappingFileReplaceEdits = this.createMappingFileReplaceEditsCheckClasspath(mappingFileRef);
+ if (!CollectionTools.isEmpty(mappingFileReplaceEdits)) {
+ IFile file = (IFile) mappingFileRef.getMappingFile().getResource();
+ this.mappingFileReplaceEdits.put(file, mappingFileReplaceEdits);
+ }
+ sm.worked(1);
+ }
+ }
+
+ protected Iterable<ReplaceEdit> createPersistenceXmlReplaceEditsCheckClasspath(PersistenceUnit persistenceUnit) {
+ //check isOnClassPath since there could be types with the same name in different projects
+ if (persistenceUnit.getJpaProject().getJavaProject().isOnClasspath(this.originalJavaElement)) {
+ return createPersistenceXmlReplaceEdits(persistenceUnit);
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected abstract Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit);
+
+ protected void addPersistenceXmlRenameEdits(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ Iterable<ReplaceEdit> replacePackageEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile);
+
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(this.getPersistenceXmlChangeName(), persistenceXmlFile);
+ //TODO probably need to figure out TextEditGroups since these can be used to show check boxes under the file in the preview dialog
+ //also used to add edits to existing changes??
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+// textChange.addTextEditGroup(new TextEditGroup("edit persistence unit", multiTextEdit));???
+ compositeChange.add(textChange);
+ }
+ this.addEdits(textChange, replacePackageEdits);
+ }
+
+ protected abstract String getPersistenceXmlChangeName();
+
+ protected Iterable<ReplaceEdit> createMappingFileReplaceEditsCheckClasspath(MappingFileRef mappingFileRef) {
+ //check isOnClassPath since there could be types with the same name in different projects
+ if (mappingFileRef.getJpaProject().getJavaProject().isOnClasspath(this.originalJavaElement)) {
+ return this.createMappingFileReplaceEdits(mappingFileRef);
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected abstract Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef);
+
+
+ protected void addMappingFileRenameEdits(IFile mappingFile, CompositeChange compositeChange) {
+ Iterable<ReplaceEdit> replacedTypeEdits = this.mappingFileReplaceEdits.get(mappingFile);
+
+ TextChange textChange = getTextChange(mappingFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(this.getMappingFileChangeName(), mappingFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ this.addEdits(textChange, replacedTypeEdits);
+ }
+
+ protected abstract String getMappingFileChangeName();
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException ex) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java
new file mode 100644
index 0000000000..5ff1a8444b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Localized messages used by Dali core.
+ */
+public class JpaCoreRefactoringMessages {
+
+ public static String JPA_DELETE_TYPE_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_DELETE_PACKAGE_OR_FOLDER_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_NAME;
+ public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
+ public static String JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME;
+
+ public static String JPA_DELETE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME;
+ public static String JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_NAME;
+ public static String JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+
+ public static String JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME;
+
+ public static String JPA_RENAME_TYPE_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_NAME;
+ public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
+ public static String JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME;
+
+ public static String JPA_RENAME_PACKAGE_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_NAME;
+ public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
+ public static String JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME;
+
+ public static String JPA_RENAME_FOLDER_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_RENAME_FOLDER_REFACTORING_CHANGE_NAME;
+ public static String JPA_RENAME_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ public static String JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME;
+
+ public static String JPA_RENAME_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME;
+ public static String JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_NAME;
+ public static String JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+
+ public static String JPA_MOVE_TYPE_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_NAME;
+ public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
+ public static String JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME;
+
+ public static String JPA_MOVE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME;
+ public static String JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_NAME;
+ public static String JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+
+ public static String JPA_MOVE_FOLDER_REFACTORING_PARTICIPANT_NAME;
+ public static String JPA_MOVE_FOLDER_REFACTORING_CHANGE_NAME;
+ public static String JPA_MOVE_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ public static String JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME;
+
+ private static final String BUNDLE_NAME = "jpa_core_refactoring"; //$NON-NLS-1$
+ private static final Class<?> BUNDLE_CLASS = JpaCoreRefactoringMessages.class;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
+ }
+
+ private JpaCoreRefactoringMessages() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
new file mode 100644
index 0000000000..9627149c6d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.DeleteArguments;
+import org.eclipse.ltk.core.refactoring.participants.DeleteParticipant;
+import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Participant in the delete refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
+ * If the deleted mapping file is listed in a persistence.xml file of any JpaProject
+ * then a Change object is created that will delete that reference from the file.
+ */
+public class JpaDeleteMappingFileParticipant
+ extends DeleteParticipant
+ implements ISharableParticipant
+{
+
+ /**
+ * Store the {@link IFile}s to be deleted with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
+ * and their corresponding {@link DeleteArguments}
+ */
+ protected final Map<IFile, DeleteArguments> mappingFiles;
+
+ /**
+ * Store the persistence.xml DeleteEdits in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<DeleteEdit>> persistenceXmlMappingFileDeleteEdits;
+
+ public JpaDeleteMappingFileParticipant() {
+ super();
+ this.mappingFiles = new HashMap<IFile, DeleteArguments>();
+ this.persistenceXmlMappingFileDeleteEdits = new HashMap<IFile, Iterable<DeleteEdit>>();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ this.addElement(element, getArguments());
+ return true;
+ }
+
+
+ //****************ISharableParticipant implementation *****************
+ /**
+ * This is used when multiple mapping files are deleted.
+ * RefactoringParticipant#initialize(Object) is called for the first deleted IFile.
+ * RefactoringParticipant#getArguments() only applies to the first deleted IFile
+ */
+ public void addElement(Object element, RefactoringArguments arguments) {
+ this.mappingFiles.put((IFile) element, (DeleteArguments) arguments);
+ }
+
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate DeleteEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ //since the progress bar will hang if a large JPA project is being loaded,
+ //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
+ sm.subTask(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
+ this.createDeleteEdits(jpaProject);
+ sm.worked(10);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile persistenceXmlFile : this.persistenceXmlMappingFileDeleteEdits.keySet()) {
+ deltaFactory.change(persistenceXmlFile);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ protected void createDeleteEdits(JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ Iterable<DeleteEdit> classRefDeleteEdits = this.createSpecifiedMappingFileRefDeleteEdits(persistenceUnit);
+ if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
+ this.persistenceXmlMappingFileDeleteEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
+ }
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlMappingFileDeleteEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileDeleteEdits.size());
+ sm.subTask(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
+ CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_NAME);
+ for (IFile persistenceXmlFile : this.persistenceXmlMappingFileDeleteEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addPersistenceXmlDeleteMappingFileChange(persistenceXmlFile, compositeChange);
+ }
+ //must check for children in case all changes were made in other participants TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+ private Iterable<DeleteEdit> createSpecifiedMappingFileRefDeleteEdits(final PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<DeleteEdit>(
+ new TransformationIterable<IFile, Iterable<DeleteEdit>>(this.mappingFiles.keySet()) {
+ @Override
+ protected Iterable<DeleteEdit> transform(IFile file) {
+ return persistenceUnit.createDeleteMappingFileEdits(file);
+ }
+ }
+ );
+ }
+
+ protected void addPersistenceXmlDeleteMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ Iterable<DeleteEdit> mappingFileDeleteEdits = this.persistenceXmlMappingFileDeleteEdits.get(persistenceXmlFile);
+ this.addEdits(textChange, mappingFileDeleteEdits);
+ }
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException e) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(e);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
new file mode 100644
index 0000000000..e2ce790017
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceProxy;
+import org.eclipse.core.resources.IResourceProxyVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.text.edits.DeleteEdit;
+
+public class JpaDeletePackageOrFolderParticipant
+ extends AbstractJpaDeleteTypeParticipant
+ implements ISharableParticipant
+{
+
+ /**
+ * The folders that are going to be deleted.
+ * Only folders which are not also IPackageFragments or IPackageFragmentRoots are added to this collection.
+ */
+ protected final Collection<IFolder> folders;
+
+ /**
+ * The IPackageFragments that are going to be deleted.
+ */
+ protected final Collection<IPackageFragment> packageFragments;
+
+ public JpaDeletePackageOrFolderParticipant() {
+ super();
+ this.folders = new ArrayList<IFolder>();
+ this.packageFragments = new ArrayList<IPackageFragment>();
+ }
+
+ //**************** RefactoringParticipant implementation *****************
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_DELETE_PACKAGE_OR_FOLDER_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if (getProcessor() instanceof RenameProcessor) {
+ //Renaming a package that then ends up with no subpackages or types will call the delete folder participant.
+ //We do not want to delete references in the persistence.xml and mapping files in this case, will be handled
+ //with the rename participant
+ return false;
+ }
+ this.addElement(element, getArguments());
+ return true;
+ }
+
+ //**************** ISharableParticipant implementation *****************
+ /**
+ * This is used when multiple IPackageFraments/IFolders are deleted.
+ * RefactoringParticipant#initialize(Object) is called for the first deleted IPackageFragment/IFolder.
+ * RefactoringParticipant#getArguments() only applies to the first deleted IPackageFragment/IFolder
+ */
+ public void addElement(Object element, RefactoringArguments arguments) {
+ if (element instanceof IFolder) {
+ IJavaElement javaElement = JavaCore.create((IFolder) element);
+ if (javaElement != null) {
+ if (javaElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT) {
+ this.addPackageFragmentRoot((IPackageFragmentRoot) javaElement);
+ }
+ else {
+ this.addPackageFragment((IPackageFragment) javaElement);
+ }
+ }
+ else {
+ this.addFolder((IFolder) element);
+ }
+ }
+ else {
+ this.addPackageFragment((IPackageFragment) element);
+ }
+ }
+
+ protected void addFolder(IFolder folder) {
+ this.folders.add(folder);
+ }
+
+ protected void addPackageFragmentRoot(IPackageFragmentRoot root) {
+ if (JDTTools.packageFragmentRootIsSourceFolder(root)) {
+ IJavaElement[] children = JDTTools.getJDTChildren(root);
+ for (IJavaElement child : children) {
+ this.addPackageFragment((IPackageFragment) child);
+ }
+ }
+ }
+
+ protected void addPackageFragment(IPackageFragment packageFragment) {
+ this.packageFragments.add(packageFragment);
+ Collection<IType> allDeletedTypes = new HashSet<IType>();
+ addAffectedTypes(allDeletedTypes, packageFragment);
+ for (IType deletedType : allDeletedTypes) {
+ this.addType(deletedType);
+ }
+ }
+
+ //nestedTypes are handled in AbstractJpaDeleteTypeParticipant
+ static void addAffectedTypes(Collection<IType> types, IPackageFragment fragment) {
+ try {
+ if (fragment.containsJavaResources()) {
+ ICompilationUnit[] cunits = fragment.getCompilationUnits();
+ IType type = null;
+ for (int i = 0; i < cunits.length; i++) {
+ type = cunits[i].findPrimaryType();
+ if (type == null) {
+ continue;
+ }
+ types.add(type);
+ }
+ }
+ }
+ catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ /**
+ * Add mapping file delete edits here, super.createPersistenceXmlDeleteEdits() is
+ * called to add the type delete edits.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<DeleteEdit> createPersistenceXmlDeleteEdits(final PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<DeleteEdit>(
+ super.createPersistenceXmlDeleteEdits(persistenceUnit),
+ new CompositeIterable<DeleteEdit>(
+ new TransformationIterable<IFile, Iterable<DeleteEdit>>(this.getMappingFilesOnClasspath(persistenceUnit.getJpaProject())) {
+ @Override
+ protected Iterable<DeleteEdit> transform(IFile file) {
+ return persistenceUnit.createDeleteMappingFileEdits(file);
+ }
+ }
+ )
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<IFile> getMappingFilesOnClasspath(final JpaProject jpaProject) {
+ final IJavaProject javaProject = jpaProject.getJavaProject();
+ return new FilteringIterable<IFile>(new CompositeIterable<IFile>(
+ getPossibleMappingFilesInFolders(),
+ getPossibleMappingFilesInPackageFragments()))
+ {
+ @Override
+ protected boolean accept(IFile file) {
+ return javaProject.isOnClasspath(file)
+ && PlatformTools.getContentType(file).isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ }
+ };
+ }
+
+ protected Iterable<IFile> getPossibleMappingFilesInFolders() {
+ Collection<IFile> files = new ArrayList<IFile>();
+ FolderResourceProxyVisitor visitor = new FolderResourceProxyVisitor(files);
+ for (IFolder folder : this.folders) {
+ visitor.visitFolder(folder);
+ }
+ return files;
+ }
+
+ protected Iterable<IFile> getPossibleMappingFilesInPackageFragments() {
+ return new CompositeIterable<IFile>(
+ new TransformationIterable<IPackageFragment, Iterable<IFile>>(this.packageFragments) {
+ @Override
+ protected Iterable<IFile> transform(IPackageFragment packageFragment) {
+ return getNonJavaFiles(packageFragment);
+ }
+ }
+ );
+ }
+
+ protected static Iterable<IFile> getNonJavaFiles(IPackageFragment packageFragment) {
+ Collection<IFile> files = new ArrayList<IFile>();
+ Object[] resources = getNonJavaResources(packageFragment);
+ for (Object resource : resources) {
+ if (resource instanceof IFile) {
+ files.add((IFile) resource);
+ }
+ }
+ return files;
+ }
+
+ protected static Object[] getNonJavaResources(IPackageFragment packageFragment) {
+ try {
+ return packageFragment.getNonJavaResources();
+ }
+ catch (JavaModelException e) {
+ JptJpaCorePlugin.log(e);
+ return EMPTY_OBJECT_ARRAY;
+ }
+ }
+
+ private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+ protected class FolderResourceProxyVisitor implements IResourceProxyVisitor {
+ private Collection<IFile> files;
+ protected FolderResourceProxyVisitor(Collection<IFile> files) {
+ super();
+ this.files = files;
+ }
+ protected void visitFolder(IFolder folder) {
+ try {
+ folder.accept(this, IResource.NONE);
+ } catch (CoreException ex) {
+ // shouldn't happen - we don't throw any CoreExceptions
+ throw new RuntimeException(ex);
+ }
+ }
+ public boolean visit(IResourceProxy resource) {
+ switch (resource.getType()) {
+ case IResource.FOLDER :
+ return true; // visit children
+ case IResource.FILE :
+ this.files.add((IFile) resource.requestResource());
+ return false; // no children
+ default :
+ return false; // no children
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java
new file mode 100644
index 0000000000..7801496e65
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
+
+public class JpaDeleteTypeParticipant
+ extends AbstractJpaDeleteTypeParticipant
+ implements ISharableParticipant
+{
+
+ public JpaDeleteTypeParticipant() {
+ super();
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ this.addElement(element, getArguments());
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_PARTICIPANT_NAME;
+ }
+
+
+ //****************ISharableParticipant implementation *****************
+
+ /**
+ * This is used when multiple ITypes are deleted.
+ * RefactoringParticipant#initialize(Object) is called for the first deleted IType.
+ * RefactoringParticipant#getArguments() only applies to the first deleted IType
+ */
+ public void addElement(Object element, RefactoringArguments arguments) {
+ this.addType((IType) element);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
new file mode 100644
index 0000000000..160e216b3c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
+import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
+import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Participant in the move refactoring of {@link IFolders}s.
+ * Any mapping file references in the persistence.xml will be updated to reflect the new location.
+ */
+public class JpaMoveFolderParticipant
+ extends MoveParticipant
+ implements ISharableParticipant
+{
+
+ /**
+ * Store the {@link IFolder}s to be moved and their corresponding MoveArguments
+ */
+ protected final Map<IFolder, MoveArguments> originalFolders;
+
+ /**
+ * Store the persistence.xml ReplaceEdit in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
+
+ public JpaMoveFolderParticipant() {
+ super();
+ this.originalFolders = new HashMap<IFolder, MoveArguments>();
+ this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if (!getArguments().getUpdateReferences()) {
+ return false;
+ }
+ this.addElement(element, getArguments());
+ return true;
+ }
+
+ //****************ISharableParticipant implementation *****************
+
+ /**
+ * This is used when multiple folders are moved.
+ * RefactoringParticipant#initialize(Object) is called for the first moved IFolder.
+ * RefactoringParticipant#getArguments() only applies to the first moved IFolder.
+ */
+ public void addElement(Object element, RefactoringArguments arguments) {
+ this.originalFolders.put((IFolder) element, (MoveArguments) arguments);
+ }
+
+ protected MoveArguments getArguments(IFolder element) {
+ return this.originalFolders.get(element);
+ }
+
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ //since the progress bar will hang if a large JPA project is being loaded,
+ //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
+ sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME);
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
+ this.createReplaceEdits(jpaProject);
+ sm.worked(10);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
+ deltaFactory.change(persistenceXmlFile);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ Iterable<ReplaceEdit> replaceEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit);
+ if (!CollectionTools.isEmpty(replaceEdits)) {
+ this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
+ }
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlReplaceEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size());
+ sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME);
+ CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_CHANGE_NAME);
+ for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addPersistenceXmlRenameChange(persistenceXmlFile, compositeChange);
+ }
+ //must check for children in case all changes were made in other participants TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+ protected Iterable<ReplaceEdit> createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<IFolder, Iterable<ReplaceEdit>>(this.getOriginalFoldersOnClasspath(persistenceUnit.getJpaProject())) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(IFolder folder) {
+ return createPersistenceUnitReplaceEdits(persistenceUnit, folder, (IContainer) getArguments(folder).getDestination());
+ }
+ }
+ );
+ }
+
+ protected Iterable<IFolder> getOriginalFoldersOnClasspath(final JpaProject jpaProject) {
+ final IJavaProject javaProject = jpaProject.getJavaProject();
+ return new FilteringIterable<IFolder>(this.originalFolders.keySet()) {
+ @Override
+ protected boolean accept(IFolder folder) {
+ return javaProject.isOnClasspath(folder);
+ }
+ };
+ }
+
+ protected Iterable<ReplaceEdit> createPersistenceUnitReplaceEdits(PersistenceUnit persistenceUnit, IFolder folder, IContainer destination) {
+ IProject project = destination.getProject();
+ IPath fullPath = destination.getFullPath().append(folder.getName());
+ IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath);
+ return persistenceUnit.createMoveFolderEdits(folder, runtimePath);
+ }
+
+ protected void addPersistenceXmlRenameChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile);
+ this.addEdits(textChange, mappingFileReplaceEdits);
+ }
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException e) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(e);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
new file mode 100644
index 0000000000..0adac39634
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
+import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
+import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
+ * If the renamed mapping file is listed in a persistence.xml file of any JpaProject
+ * then a Change object is created that will rename that reference from the file.
+ * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
+ */
+public class JpaMoveMappingFileParticipant
+ extends MoveParticipant
+ implements ISharableParticipant
+{
+
+ /**
+ * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
+ * and their corresponding {@link MoveArguments}
+ */
+ protected final Map<IFile, MoveArguments> originalMappingFiles;
+
+ /**
+ * Store the persistence.xml ReplaceEdit in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlMappingFileReplaceEdits;
+
+ public JpaMoveMappingFileParticipant() {
+ super();
+ this.originalMappingFiles = new HashMap<IFile, MoveArguments>();
+ this.persistenceXmlMappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if (!getArguments().getUpdateReferences()) {
+ return false;
+ }
+ this.addElement(element, getArguments());
+ return true;
+ }
+
+ //****************ISharableParticipant implementation *****************
+
+ /**
+ * This is used when multiple mapping files are deleted.
+ * RefactoringParticipant#initialize(Object) is called for the first deleted IFile.
+ * RefactoringParticipant#getArguments() only applies to the first deleted IFile
+ */
+ public void addElement(Object element, RefactoringArguments arguments) {
+ this.originalMappingFiles.put((IFile) element, (MoveArguments) arguments);
+ }
+
+ protected MoveArguments getArguments(IFile element) {
+ return this.originalMappingFiles.get(element);
+ }
+
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ //since the progress bar will hang if a large JPA project is being loaded,
+ //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
+ sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
+ this.createReplaceEdits(jpaProject);
+ sm.worked(10);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
+ deltaFactory.change(persistenceXmlFile);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ Iterable<ReplaceEdit> replaceEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit);
+ if (!CollectionTools.isEmpty(replaceEdits)) {
+ this.persistenceXmlMappingFileReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
+ }
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlMappingFileReplaceEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileReplaceEdits.size());
+ sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
+ CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_NAME);
+ for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addPersistenceXmlRenameMappingFileChange(persistenceXmlFile, compositeChange);
+ }
+ //must check for children in case all changes were made in other participants TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+
+ protected Iterable<ReplaceEdit> createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<IFile, Iterable<ReplaceEdit>>(this.getOriginalFoldersOnClasspath(persistenceUnit.getJpaProject())) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(IFile mappingFile) {
+ return createPersistenceUnitReplaceEdits(persistenceUnit, mappingFile, (IFolder) getArguments(mappingFile).getDestination());
+ }
+ }
+ );
+ }
+
+ protected Iterable<IFile> getOriginalFoldersOnClasspath(final JpaProject jpaProject) {
+ final IJavaProject javaProject = jpaProject.getJavaProject();
+ return new FilteringIterable<IFile>(this.originalMappingFiles.keySet()) {
+ @Override
+ protected boolean accept(IFile file) {
+ return javaProject.isOnClasspath(file);
+ }
+ };
+ }
+
+ private Iterable<ReplaceEdit> createPersistenceUnitReplaceEdits(PersistenceUnit persistenceUnit, IFile mappingFile, IFolder destination) {
+ IProject project = destination.getProject();
+ IPath fullPath = destination.getFullPath();
+ IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath);
+ return persistenceUnit.createMoveMappingFileEdits(mappingFile, runtimePath);
+ }
+
+ protected void addPersistenceXmlRenameMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlMappingFileReplaceEdits.get(persistenceXmlFile);
+ this.addEdits(textChange, mappingFileReplaceEdits);
+ }
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException e) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(e);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java
new file mode 100644
index 0000000000..969ad22c60
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class JpaMoveTypeParticipant
+ extends AbstractJpaMoveJavaElementParticipant {
+
+ public JpaMoveTypeParticipant() {
+ super();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ @Override
+ public void addElement(Object element, RefactoringArguments arguments) {
+ super.addElement(element, arguments);
+ this.addNestedTypes((IType) element, arguments);
+ }
+
+ protected void addNestedType(IType renamedType, RefactoringArguments arguments) {
+ super.addElement(renamedType, arguments);
+ this.addNestedTypes(renamedType, arguments);
+ }
+
+ private void addNestedTypes(IType renamedType, RefactoringArguments arguments) {
+ IType[] nestedTypes;
+ try {
+ nestedTypes = renamedType.getTypes();
+ }
+ catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return;
+ }
+
+ for (IType nestedType : nestedTypes) {
+ this.addNestedType(nestedType, arguments);
+ }
+ }
+
+
+ //**************** AbstractJpaRenameJavaElementParticipant implementation *****************
+
+ @Override
+ protected Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit, IJavaElement javaElement, Object destination) {
+ IType type = (IType) javaElement;
+ if (((IJavaElement) destination).getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
+ return persistenceUnit.createMoveTypeEdits(type, (IPackageFragment) destination);
+ }
+ return persistenceUnit.createRenameTypeEdits(type, getNewNameForNestedType(type, (IType) destination));
+ }
+
+ @Override
+ protected Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef, IJavaElement javaElement, Object destination) {
+ IType type = (IType) javaElement;
+ if (((IJavaElement) destination).getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
+ return mappingFileRef.createMoveTypeEdits(type, (IPackageFragment) destination);
+ }
+ return mappingFileRef.createRenameTypeEdits(type, getNewNameForNestedType(type, (IType) destination));
+ }
+
+ protected String getNewNameForNestedType(IType nestedType, IType destination) {
+ return nestedType.getTypeQualifiedName('$').replaceFirst(nestedType.getDeclaringType().getElementName(), destination.getElementName());
+ }
+
+ protected IPackageFragment getNewPackage() {
+ return (IPackageFragment) getArguments().getDestination();
+ }
+
+ @Override
+ protected String getCheckConditionsSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ @Override
+ protected String getCreateChangeSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ @Override
+ protected String getCompositeChangeName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_NAME;
+ }
+
+ @Override
+ protected String getPersistenceXmlChangeName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ }
+
+ @Override
+ protected String getMappingFileChangeName() {
+ return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
new file mode 100644
index 0000000000..57cd8b335d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Participant in the rename refactoring of {@link IFolders}s.
+ * If the renamed mapping file is listed in a persistence.xml file of any JpaProject
+ * then a Change object is created that will rename that reference from the file.
+ * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
+ */
+public class JpaRenameFolderParticipant
+ extends RenameParticipant
+{
+
+ /**
+ * Store the {@link IFolder}s to be renamed
+ */
+
+ protected IFolder originalFolder;
+
+ /**
+ * Store the persistence.xml ReplaceEdit in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
+
+ public JpaRenameFolderParticipant() {
+ super();
+ this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if (!getArguments().getUpdateReferences()) {
+ return false;
+ }
+ this.originalFolder = (IFolder) element;
+ return true;
+ }
+
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ //since the progress bar will hang if a large JPA project is being loaded,
+ //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
+ sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME);
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
+ this.createReplaceEdits(jpaProject);
+ sm.worked(10);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
+ deltaFactory.change(persistenceXmlFile);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ Iterable<ReplaceEdit> replaceEdits = this.createPersistenceUnitReplaceEdits(persistenceUnit);
+ if (!CollectionTools.isEmpty(replaceEdits)) {
+ this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
+ }
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlReplaceEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size());
+ sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME);
+ CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_CHANGE_NAME);
+ for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addPersistenceXmlRenameChange(persistenceXmlFile, compositeChange);
+ }
+ //must check for children in case all changes were made in other participants TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+ private Iterable<ReplaceEdit> createPersistenceUnitReplaceEdits(final PersistenceUnit persistenceUnit) {
+ if (persistenceUnit.getJpaProject().getJavaProject().isOnClasspath(this.originalFolder) || persistenceUnit.getJpaProject().getProject() == this.originalFolder.getProject()) {
+ return persistenceUnit.createRenameFolderEdits(this.originalFolder, getArguments().getNewName());
+ }
+ return EmptyIterable.instance();
+ }
+
+ protected void addPersistenceXmlRenameChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile);
+ this.addEdits(textChange, mappingFileReplaceEdits);
+ }
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException e) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(e);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
new file mode 100644
index 0000000000..69349e3481
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
+ * If the renamed mapping file is listed in a persistence.xml file of any JpaProject
+ * then a Change object is created that will rename that reference from the file.
+ * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
+ */
+public class JpaRenameMappingFileParticipant
+ extends RenameParticipant
+{
+
+ /**
+ * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
+ */
+
+ protected IFile originalMappingFile;
+
+ /**
+ * Store the persistence.xml ReplaceEdit in the checkConditions() call
+ * to avoid duplicated effort in createChange().
+ */
+ protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlMappingFileReplaceEdits;
+
+ public JpaRenameMappingFileParticipant() {
+ super();
+ this.persistenceXmlMappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if (!getArguments().getUpdateReferences()) {
+ return false;
+ }
+ this.originalMappingFile = (IFile) element;
+ return true;
+ }
+
+
+ //**************** RefactoringParticipant implementation *****************
+
+ /**
+ * Inform the refactoring processor of any files that are going to change. In the process of determining
+ * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
+ */
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
+ //since the progress bar will hang if a large JPA project is being loaded,
+ //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
+ monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
+ JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
+ if (jpaProjectManager.getJpaProjectsSize() == 0) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
+ sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
+ ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
+ IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
+
+ for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
+ this.createReplaceEdits(jpaProject);
+ sm.worked(10);
+ }
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
+ deltaFactory.change(persistenceXmlFile);
+ }
+ sm.worked(1);
+
+ return null;
+ }
+
+ protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
+ PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
+ if (persistenceUnit == null) {
+ return;
+ }
+ Iterable<ReplaceEdit> replaceEdits = this.createMappingFileRefReplaceEdits(persistenceUnit);
+ if (!CollectionTools.isEmpty(replaceEdits)) {
+ this.persistenceXmlMappingFileReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
+ }
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
+ if (this.persistenceXmlMappingFileReplaceEdits.isEmpty()) {
+ return null;
+ }
+ SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileReplaceEdits.size());
+ sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
+ CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_NAME);
+ for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
+ if (sm.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ this.addPersistenceXmlRenameMappingFileChange(persistenceXmlFile, compositeChange);
+ }
+ //must check for children in case all changes were made in other participants TextChanges,
+ //want to return null so our node does not appear in the preview tree
+ return compositeChange.getChildren().length == 0 ? null : compositeChange;
+ }
+
+ private Iterable<ReplaceEdit> createMappingFileRefReplaceEdits(final PersistenceUnit persistenceUnit) {
+ return persistenceUnit.createRenameMappingFileEdits(this.originalMappingFile, getArguments().getNewName());
+ }
+
+ protected void addPersistenceXmlRenameMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
+ TextChange textChange = getTextChange(persistenceXmlFile);
+ if (textChange == null) {
+ textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ textChange.setEdit(multiTextEdit);
+ compositeChange.add(textChange);
+ }
+ Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlMappingFileReplaceEdits.get(persistenceXmlFile);
+ this.addEdits(textChange, mappingFileReplaceEdits);
+ }
+
+ private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return null;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return null;
+ }
+ if (persistence.persistenceUnitsSize() != 1) {
+ return null; // the context model currently only supports 1 persistence unit
+ }
+ return persistence.persistenceUnits().next();
+ }
+
+ private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
+ for (TextEdit textEdit : textEdits) {
+ try {
+ textChange.addEdit(textEdit);
+ }
+ catch (MalformedTreeException e) {
+ //log exception and don't add this persistence.xml type deletion to the conflicting change object
+ JptJpaCorePlugin.log(e);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java
new file mode 100644
index 0000000000..830c6c86be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class JpaRenamePackageParticipant
+ extends AbstractJpaRenameJavaElementParticipant {
+
+
+ public JpaRenamePackageParticipant() {
+ super();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ protected IPackageFragment getOriginalPackage() {
+ return (IPackageFragment) super.getOriginalJavaElement();
+ }
+
+
+ //**************** AbstractJpaRenameJavaElementParticipant implementation *****************
+
+ @Override
+ protected Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit) {
+ return persistenceUnit.createRenamePackageEdits(this.getOriginalPackage(), this.getNewName());
+ }
+
+ @Override
+ protected Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef) {
+ return mappingFileRef.createRenamePackageEdits(this.getOriginalPackage(), this.getNewName());
+ }
+
+ protected String getNewName() {
+ return getArguments().getNewName();
+ }
+
+ @Override
+ protected String getCheckConditionsSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ @Override
+ protected String getCreateChangeSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ @Override
+ protected String getCompositeChangeName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_NAME;
+ }
+
+ @Override
+ protected String getPersistenceXmlChangeName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ }
+
+ @Override
+ protected String getMappingFileChangeName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java
new file mode 100644
index 0000000000..c72b74c34c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.refactoring;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.text.edits.ReplaceEdit;
+
+//TODO RenameTypeArguments.updateSimilarDeclarations() - http://www.eclipse.org/jdt/ui/r3_2/RenameType.html
+public class JpaRenameTypeParticipant
+ extends AbstractJpaRenameJavaElementParticipant {
+
+ protected final Collection<IType> nestedTypes;
+
+ public JpaRenameTypeParticipant() {
+ super();
+ this.nestedTypes = new ArrayList<IType>();
+ }
+
+ @Override
+ public String getName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_PARTICIPANT_NAME;
+ }
+
+ protected IType getOriginalType() {
+ return (IType) super.getOriginalJavaElement();
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ boolean initialize = super.initialize(element);
+ if (initialize) {
+ this.addNestedTypes(this.getOriginalType());
+ return true;
+ }
+ return false;
+ }
+
+ protected void addNestedType(IType renamedType) {
+ this.nestedTypes.add(renamedType);
+ this.addNestedTypes(renamedType);
+ }
+
+ private void addNestedTypes(IType renamedType) {
+ IType[] nestedTypes;
+ try {
+ nestedTypes = renamedType.getTypes();
+ }
+ catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return;
+ }
+
+ for (IType nestedType : nestedTypes) {
+ this.addNestedType(nestedType);
+ }
+ }
+
+
+ //**************** AbstractJpaRenameJavaElementParticipant implementation *****************
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.createPersistenceXmlReplaceOriginalTypeEdits(persistenceUnit),
+ this.createPersistenceXmlReplaceNestedTypeEdits(persistenceUnit));
+ }
+
+ private Iterable<ReplaceEdit> createPersistenceXmlReplaceOriginalTypeEdits(PersistenceUnit persistenceUnit) {
+ return persistenceUnit.createRenameTypeEdits(this.getOriginalType(), this.getNewName());
+ }
+
+ private Iterable<ReplaceEdit> createPersistenceXmlReplaceNestedTypeEdits(final PersistenceUnit persistenceUnit) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<IType, Iterable<ReplaceEdit>>(this.nestedTypes) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(IType nestedType) {
+ String newName = getNewNameForNestedType(nestedType);
+ return persistenceUnit.createRenameTypeEdits(nestedType, newName);
+ }
+ }
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef) {
+ return new CompositeIterable<ReplaceEdit>(
+ this.createMappingFileReplaceOriginalTypeEdits(mappingFileRef),
+ this.createMappingFileReplaceNestedTypeEdits(mappingFileRef));
+ }
+
+ private Iterable<ReplaceEdit> createMappingFileReplaceOriginalTypeEdits(MappingFileRef mappingFileRef) {
+ return mappingFileRef.createRenameTypeEdits(this.getOriginalType(), this.getNewName());
+ }
+
+ private Iterable<ReplaceEdit> createMappingFileReplaceNestedTypeEdits(final MappingFileRef mappingFileRef) {
+ return new CompositeIterable<ReplaceEdit>(
+ new TransformationIterable<IType, Iterable<ReplaceEdit>>(this.nestedTypes) {
+ @Override
+ protected Iterable<ReplaceEdit> transform(IType nestedType) {
+ String newName = getNewNameForNestedType(nestedType);
+ return mappingFileRef.createRenameTypeEdits(nestedType, newName);
+ }
+ }
+ );
+ }
+
+ protected String getNewName() {
+ String newName = getArguments().getNewName();
+ try {
+ if (this.getOriginalType().isMember()) {
+ newName = this.getOriginalType().getTypeQualifiedName().substring(0, this.getOriginalType().getTypeQualifiedName().lastIndexOf('$')) + '$' + newName;
+ }
+ }
+ catch (JavaModelException e) {
+ JptJpaCorePlugin.log(e);
+ }
+ return newName;
+ }
+
+ protected String getNewNameForNestedType(IType nestedType) {
+ return nestedType.getTypeQualifiedName('$').replaceFirst(this.getOriginalType().getElementName(), getArguments().getNewName());
+ }
+
+ @Override
+ protected String getCheckConditionsSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ @Override
+ protected String getCreateChangeSubTaskName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME;
+ }
+
+ @Override
+ protected String getCompositeChangeName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_NAME;
+ }
+
+ @Override
+ protected String getPersistenceXmlChangeName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
+ }
+
+ @Override
+ protected String getMappingFileChangeName() {
+ return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java
new file mode 100644
index 0000000000..7f5320de28
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.contenttypes;
+
+import java.io.InputStream;
+import java.io.Reader;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.ITextContentDescriber;
+
+/**
+ * This class simply returns INDETERMINATE for any contents it receives.
+ *
+ * It is used currently for org.eclipse.jpt.jpa.core.content.baseJpaContent in order
+ * to make that content type act as an "abstract" content type.
+ *
+ * This is in its own package so that it can be excluded from bundle activation in the plugin.xml.
+ * Content describers must be self-contained and not trigger auto-activation.
+ */
+public class IndeterminateContentDescriber implements ITextContentDescriber
+{
+ public int describe(InputStream contents, IContentDescription description) {
+ return INDETERMINATE;
+ }
+
+ public int describe(Reader contents, IContentDescription description) {
+ return INDETERMINATE;
+ }
+
+ public QualifiedName[] getSupportedOptions() {
+ return new QualifiedName[0];
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java
new file mode 100644
index 0000000000..8cb4a5f3d2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport;
+import org.eclipse.jpt.common.utility.internal.model.ChangeSupport;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * Java resource containment hierarchy
+ */
+public abstract class AbstractJavaResourceNode
+ extends AbstractModel
+ implements JavaResourceNode
+{
+ protected final JavaResourceNode parent;
+
+
+ // ********** constructor **********
+
+ protected AbstractJavaResourceNode(JavaResourceNode parent) {
+ super();
+ this.checkParent(parent);
+ this.parent = parent;
+ }
+
+
+ // ********** parent **********
+
+ public JavaResourceNode getParent() {
+ return this.parent;
+ }
+
+ protected void checkParent(JavaResourceNode p) {
+ if (p == null) {
+ if (this.requiresParent()) {
+ throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$
+ }
+ } else {
+ if (this.forbidsParent()) {
+ throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ protected boolean requiresParent() {
+ return true;
+ }
+
+ protected boolean forbidsParent() {
+ return ! this.requiresParent(); // assume 'parent' is not optional
+ }
+
+
+ // ********** change support callback hook **********
+
+ @Override
+ protected final ChangeSupport buildChangeSupport() {
+ return new AspectChangeSupport(this, this.buildChangeSupportListener());
+ }
+
+ private AspectChangeSupport.Listener buildChangeSupportListener() {
+ return new AspectChangeSupport.Listener() {
+ public void aspectChanged(String aspectName) {
+ AbstractJavaResourceNode.this.aspectChanged(aspectName);
+ }
+ };
+ }
+
+ /**
+ * ignore the aspect name, we notify listeners of *every* change
+ */
+ protected void aspectChanged(@SuppressWarnings("unused") String aspectName) {
+ this.getRoot().resourceModelChanged();
+ }
+
+
+ // ********** JavaResourceNode implementation **********
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompilationUnit#getRoot()
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPackageFragmentRoot#getRoot()
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPersistentTypeCache#getRoot()
+ */
+ public Root getRoot() {
+ return this.parent.getRoot();
+ }
+
+ public IFile getFile() {
+ return this.getRoot().getFile();
+ }
+
+
+ // ********** misc **********
+
+ protected JpaAnnotationProvider getAnnotationProvider() {
+ return this.getRoot().getAnnotationProvider();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
new file mode 100644
index 0000000000..d92334b88b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryAssociationOverride1_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceAssociationOverride1_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.AssociationOverride
+ */
+public final class AssociationOverrideAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new AssociationOverrideAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private AssociationOverrideAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourceAssociationOverride1_0Annotation.buildAssociationOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryAssociationOverride1_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverrideAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
new file mode 100644
index 0000000000..42561b2853
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryAssociationOverrides1_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceAssociationOverrides1_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.AssociationOverrides
+ */
+public final class AssociationOverridesAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new AssociationOverridesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private AssociationOverridesAnnotationDefinition() {
+ super();
+ }
+
+ public AssociationOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceAssociationOverrides1_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public AssociationOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryAssociationOverrides1_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverridesAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
new file mode 100644
index 0000000000..e0c82a25cc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.AttributeOverride
+ */
+public final class AttributeOverrideAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private AttributeOverrideAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourceAttributeOverrideAnnotation.buildAttributeOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryAttributeOverrideAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return AttributeOverrideAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
new file mode 100644
index 0000000000..8e0629aca6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.AttributeOverrides
+ */
+public final class AttributeOverridesAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new AttributeOverridesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private AttributeOverridesAnnotationDefinition() {
+ super();
+ }
+
+ public AttributeOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceAttributeOverridesAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public AttributeOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryAttributeOverridesAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return AttributeOverridesAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java
new file mode 100644
index 0000000000..a5f249a48d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBasicAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBasicAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Basic
+ */
+public final class BasicAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new BasicAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private BasicAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceBasicAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryBasicAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return BasicAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java
new file mode 100644
index 0000000000..56fec881a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryColumnAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * javax.persistence.Column
+ */
+public final class ColumnAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ColumnAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceColumnAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement, SourceColumnAnnotation.MAPPING_DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullColumnAnnotation(parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryColumnAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ColumnAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
new file mode 100644
index 0000000000..a9d8797d59
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.DiscriminatorColumn
+ */
+public final class DiscriminatorColumnAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new DiscriminatorColumnAnnotationDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private DiscriminatorColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return DiscriminatorColumnAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
new file mode 100644
index 0000000000..1150a7d7a4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.DiscriminatorValue
+ */
+public final class DiscriminatorValueAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new DiscriminatorValueAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private DiscriminatorValueAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceDiscriminatorValueAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullDiscriminatorValueAnnotation((JavaResourcePersistentType) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryDiscriminatorValueAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return DiscriminatorValueAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java
new file mode 100644
index 0000000000..995417e071
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Embeddable
+ */
+public final class EmbeddableAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new EmbeddableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private EmbeddableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceEmbeddableAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryEmbeddableAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return EmbeddableAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java
new file mode 100644
index 0000000000..50818c215e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Embedded
+ */
+public final class EmbeddedAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new EmbeddedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private EmbeddedAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return EmbeddedAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
new file mode 100644
index 0000000000..572fde6d2c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedIdAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedIdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.EmbeddedId
+ */
+public final class EmbeddedIdAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new EmbeddedIdAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private EmbeddedIdAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return EmbeddedIdAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java
new file mode 100644
index 0000000000..f13e842fbc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEntityAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Entity
+ */
+public final class EntityAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new EntityAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private EntityAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceEntityAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryEntityAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return EntityAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java
new file mode 100644
index 0000000000..79ce931c82
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Enumerated
+ */
+public final class EnumeratedAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new EnumeratedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private EnumeratedAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceEnumeratedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullEnumeratedAnnotation((JavaResourcePersistentAttribute) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryEnumeratedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return EnumeratedAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
new file mode 100644
index 0000000000..0cc96173bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryGeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceGeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.GeneratedValue
+ */
+public final class GeneratedValueAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new GeneratedValueAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private GeneratedValueAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceGeneratedValueAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryGeneratedValueAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return GeneratedValueAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java
new file mode 100644
index 0000000000..8628cfede1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Id
+ */
+public final class IdAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new IdAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private IdAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return IdAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java
new file mode 100644
index 0000000000..e5cbb6c281
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdClassAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.IdClass
+ */
+public final class IdClassAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new IdClassAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private IdClassAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceIdClassAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryIdClassAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return IdClassAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java
new file mode 100644
index 0000000000..d0d4734830
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryInheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceInheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Inheritance
+ */
+public final class InheritanceAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new InheritanceAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private InheritanceAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceInheritanceAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullInheritanceAnnotation((JavaResourcePersistentType) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryInheritanceAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return InheritanceAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java
new file mode 100644
index 0000000000..8430099980
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+
+/**
+ * javax.persistence.JoinColumn
+ */
+public final class JoinColumnAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new JoinColumnAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private JoinColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourceJoinColumnAnnotation.createJoinColumn((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryJoinColumnAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return JoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
new file mode 100644
index 0000000000..e0e07b6efd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+
+/**
+ * javax.persistence.JoinColumns
+ */
+public final class JoinColumnsAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new JoinColumnsAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private JoinColumnsAnnotationDefinition() {
+ super();
+ }
+
+ public JoinColumnsAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceJoinColumnsAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public JoinColumnsAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryJoinColumnsAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return JoinColumnsAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java
new file mode 100644
index 0000000000..ad35ea19e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * javax.persistence.JoinTable
+ */
+public final class JoinTableAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new JoinTableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private JoinTableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceJoinTableAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullJoinTableAnnotation(parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryJoinTableAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return JoinTableAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java
new file mode 100644
index 0000000000..593295e108
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryLobAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceLobAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+
+/**
+ * javax.persistence.Lob
+ */
+public final class LobAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new LobAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private LobAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceLobAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryLobAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return LobAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java
new file mode 100644
index 0000000000..173ae215c9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToManyAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToManyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
+
+/**
+ * javax.persistence.ManyToMany
+ */
+public final class ManyToManyAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ManyToManyAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ManyToManyAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceManyToManyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryManyToManyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ManyToManyAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java
new file mode 100644
index 0000000000..7d8571e116
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToOneAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToOneAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
+
+/**
+ * javax.persistence.ManyToOne
+ */
+public final class ManyToOneAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ManyToOneAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ManyToOneAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceManyToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryManyToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ManyToOneAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java
new file mode 100644
index 0000000000..db92373fe0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMapKeyAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMapKeyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+
+/**
+ * javax.persistence.MapKey
+ */
+public final class MapKeyAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MapKeyAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MapKeyAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMapKeyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMapKeyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MapKeyAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
new file mode 100644
index 0000000000..2d03a17fe4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMappedSuperclassAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMappedSuperclassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+
+/**
+ * javax.persistence.MappedSuperclass
+ */
+public final class MappedSuperclassAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MappedSuperclassAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MappedSuperclassAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceMappedSuperclassAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryMappedSuperclassAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MappedSuperclassAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
new file mode 100644
index 0000000000..64d1419a8c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedNativeQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedNativeQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
+
+/**
+ * javax.persistence.NamedNativeQueries
+ */
+public final class NamedNativeQueriesAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new NamedNativeQueriesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private NamedNativeQueriesAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedNativeQueriesAnnotation(parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryNamedNativeQueriesAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return NamedNativeQueriesAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
new file mode 100644
index 0000000000..07aa297403
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+
+/**
+ * javax.persistence.NamedNativeQuery
+ */
+public final class NamedNativeQueryAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new NamedNativeQueryAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private NamedNativeQueryAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourceNamedNativeQueryAnnotation.createNamedNativeQuery(parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryNamedNativeQueryAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return NamedNativeQueryAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
new file mode 100644
index 0000000000..4636029019
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryNamedQueries1_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueries1_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
+
+/**
+ * javax.persistence.NamedQueries
+ */
+public final class NamedQueriesAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new NamedQueriesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private NamedQueriesAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedQueries1_0Annotation(parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryNamedQueries1_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return NamedQueriesAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java
new file mode 100644
index 0000000000..3b49b07818
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryNamedQuery1_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+
+/**
+ * javax.persistence.NamedQuery
+ */
+public final class NamedQueryAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private NamedQueryAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedQuery1_0Annotation(parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryNamedQuery1_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return NamedQueryAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java
new file mode 100644
index 0000000000..ab7a3377a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * Simplify null annotation classes.
+ */
+public abstract class NullAnnotation<A extends Annotation>
+ extends AbstractJavaResourceNode
+ implements Annotation
+{
+ protected NullAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // do nothing
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isUnset() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void storeOn(Map<String, Object> map) {
+ // NOP
+ }
+
+ public void restoreFrom(Map<String, Object> map) {
+ // NOP
+ }
+
+ public TextRange getTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Convenience method: Cast the annotation's parent to a
+ * persistent member.
+ */
+ protected JavaResourcePersistentMember getMember() {
+ return (JavaResourcePersistentMember) this.parent;
+ }
+
+ /**
+ * Convenience method: Add the type or attribute's annotation
+ * and return it.
+ * <p>
+ * Pre-condition: The annotation's parent must be a persistent member
+ * (type or attribute).
+ */
+ @SuppressWarnings("unchecked")
+ protected A addAnnotation() {
+ return (A) this.addAnnotation_();
+ }
+
+ protected Annotation addAnnotation_() {
+ return this.getMember().addAnnotation(this.getAnnotationName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java
new file mode 100644
index 0000000000..8271825126
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+
+/**
+ * <code>javax.persistence.Column</code>
+ */
+public final class NullAttributeOverrideColumnAnnotation
+ extends NullColumnAnnotation
+{
+ public NullAttributeOverrideColumnAnnotation(AttributeOverrideAnnotation parent) {
+ super(parent);
+ }
+
+ private AttributeOverrideAnnotation getAttributeOverrideAnnotation() {
+ return (AttributeOverrideAnnotation) this.parent;
+ }
+
+ @Override
+ protected ColumnAnnotation addAnnotation() {
+ return this.getAttributeOverrideAnnotation().addColumn();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java
new file mode 100644
index 0000000000..44696dab1c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.Column</code>
+ * <li><code>javax.persistence.JoinColumn</code>
+ * <li><code>javax.persistence.MapKeyColumn</code>
+ * </ul>
+ */
+public abstract class NullBaseColumnAnnotation<A extends BaseColumnAnnotation>
+ extends NullNamedColumnAnnotation<A>
+ implements BaseColumnAnnotation
+{
+ protected NullBaseColumnAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ // ***** table
+ public String getTable() {
+ return null;
+ }
+
+ public void setTable(String table) {
+ if (table != null) {
+ this.addAnnotation().setTable(table);
+ }
+ }
+
+ public TextRange getTableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ // ***** unique
+ public Boolean getUnique() {
+ return null;
+ }
+
+ public void setUnique(Boolean unique) {
+ if (unique != null) {
+ this.addAnnotation().setUnique(unique);
+ }
+ }
+
+ public TextRange getUniqueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** updatable
+ public Boolean getUpdatable() {
+ return null;
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ if (updatable != null) {
+ this.addAnnotation().setUpdatable(updatable);
+ }
+ }
+
+ public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** insertable
+ public Boolean getInsertable() {
+ return null;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ if (insertable != null) {
+ this.addAnnotation().setInsertable(insertable);
+ }
+ }
+
+ public TextRange getInsertableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** nullable
+ public Boolean getNullable() {
+ return null;
+ }
+
+ public void setNullable(Boolean nullable) {
+ if (nullable != null) {
+ this.addAnnotation().setNullable(nullable);
+ }
+ }
+
+ public TextRange getNullableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java
new file mode 100644
index 0000000000..931b3cd56a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.Table</code>
+ * <li><code>javax.persistence.JoinTable</code>
+ * <li><code>javax.persistence.CollectionTable</code>
+ * <ul>
+ */
+public abstract class NullBaseTableAnnotation<A extends BaseTableAnnotation>
+ extends NullAnnotation<A>
+ implements BaseTableAnnotation
+{
+ protected NullBaseTableAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public boolean isSpecified() {
+ return false;
+ }
+
+ // ***** name
+ public String getName() {
+ return null;
+ }
+
+ public void setName(String name) {
+ if (name != null) {
+ this.addAnnotation().setName(name);
+ }
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ // ***** schema
+ public String getSchema() {
+ return null;
+ }
+
+ public void setSchema(String schema) {
+ if (schema != null) {
+ this.addAnnotation().setSchema(schema);
+ }
+ }
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ // ***** catalog
+ public String getCatalog() {
+ return null;
+ }
+
+ public void setCatalog(String catalog) {
+ if (catalog != null) {
+ this.addAnnotation().setCatalog(catalog);
+ }
+ }
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ // ***** unique constraints
+ public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
+ return EmptyListIterator.instance();
+ }
+
+ public int uniqueConstraintsSize() {
+ return 0;
+ }
+
+ public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
+ throw new UnsupportedOperationException();
+ }
+
+ public UniqueConstraintAnnotation addUniqueConstraint(int index) {
+ return this.addAnnotation().addUniqueConstraint(index);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeUniqueConstraint(int index) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java
new file mode 100644
index 0000000000..92e9045040
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <code>javax.persistence.Column</code>
+ */
+public class NullColumnAnnotation
+ extends NullBaseColumnAnnotation<ColumnAnnotation>
+ implements ColumnAnnotation
+{
+ public NullColumnAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** length
+ public Integer getLength() {
+ return null;
+ }
+
+ public void setLength(Integer length) {
+ if (length != null) {
+ this.addAnnotation().setLength(length);
+ }
+ }
+
+ public TextRange getLengthTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** scale
+ public Integer getScale() {
+ return null;
+ }
+
+ public void setScale(Integer scale) {
+ if (scale != null) {
+ this.addAnnotation().setScale(scale);
+ }
+ }
+
+ public TextRange getScaleTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** precision
+ public Integer getPrecision() {
+ return null;
+ }
+
+ public void setPrecision(Integer precision) {
+ if (precision != null) {
+ this.addAnnotation().setPrecision(precision);
+ }
+ }
+
+ public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
new file mode 100644
index 0000000000..54add2a0a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * <code>javax.persistence.DiscriminatorColumn</code>
+ */
+public final class NullDiscriminatorColumnAnnotation
+ extends NullNamedColumnAnnotation<DiscriminatorColumnAnnotation>
+ implements DiscriminatorColumnAnnotation
+{
+ public NullDiscriminatorColumnAnnotation(JavaResourcePersistentType parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** discriminator type
+ public DiscriminatorType getDiscriminatorType() {
+ return null;
+ }
+
+ public void setDiscriminatorType(DiscriminatorType discriminatorType) {
+ if (discriminatorType != null) {
+ this.addAnnotation().setDiscriminatorType(discriminatorType);
+ }
+ }
+
+ // ***** length
+ public Integer getLength() {
+ return null;
+ }
+
+ public void setLength(Integer length) {
+ if (length != null) {
+ this.addAnnotation().setLength(length);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
new file mode 100644
index 0000000000..0169a216f2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * <code>javax.persistence.DiscriminatorValue</code>
+ */
+public final class NullDiscriminatorValueAnnotation
+ extends NullAnnotation<DiscriminatorValueAnnotation>
+ implements DiscriminatorValueAnnotation
+{
+ protected NullDiscriminatorValueAnnotation(JavaResourcePersistentType parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** value
+ public String getValue() {
+ return null;
+ }
+
+ public void setValue(String value) {
+ if (value != null) {
+ this.addAnnotation().setValue(value);
+ }
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java
new file mode 100644
index 0000000000..288cdd0964
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.EnumType;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * <code>javax.persistence.Enumerated</code>
+ */
+public final class NullEnumeratedAnnotation
+ extends NullAnnotation<EnumeratedAnnotation>
+ implements EnumeratedAnnotation
+{
+ protected NullEnumeratedAnnotation(JavaResourcePersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** value
+ public EnumType getValue() {
+ return null;
+ }
+
+ public void setValue(EnumType value) {
+ if (value != null) {
+ this.addAnnotation().setValue(value);
+ }
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java
new file mode 100644
index 0000000000..3e1db48102
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * <code>javax.persistence.Inheritance</code>
+ */
+public final class NullInheritanceAnnotation
+ extends NullAnnotation<InheritanceAnnotation>
+ implements InheritanceAnnotation
+{
+ protected NullInheritanceAnnotation(JavaResourcePersistentType parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** strategy
+ public InheritanceType getStrategy() {
+ return null;
+ }
+
+ public void setStrategy(InheritanceType strategy) {
+ if (strategy != null) {
+ this.addAnnotation().setStrategy(strategy);
+ }
+ }
+
+ public TextRange getStrategyTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java
new file mode 100644
index 0000000000..b5cbdec77b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.JoinColumn</code>
+ */
+public final class NullJoinColumnAnnotation
+ extends NullBaseColumnAnnotation<JoinColumnAnnotation>
+ implements JoinColumnAnnotation
+{
+ public NullJoinColumnAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** referenced column name
+ public String getReferencedColumnName() {
+ return null;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java
new file mode 100644
index 0000000000..7fce754e00
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * <code>javax.persistence.JoinTable</code>
+ */
+public class NullJoinTableAnnotation
+ extends NullBaseTableAnnotation<JoinTableAnnotation>
+ implements JoinTableAnnotation
+{
+ public NullJoinTableAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return EmptyListIterator.instance();
+ }
+
+ public int joinColumnsSize() {
+ return 0;
+ }
+
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return null;
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ // the JoinTable annotation is missing, add both it and a join column at the same time
+ return this.addAnnotation().addJoinColumn(index);
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** inverse join columns
+ public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
+ return EmptyListIterator.instance();
+ }
+
+ public int inverseJoinColumnsSize() {
+ return 0;
+ }
+
+ public JoinColumnAnnotation inverseJoinColumnAt(int index) {
+ return null;
+ }
+
+ public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JoinColumnAnnotation addInverseJoinColumn(int index) {
+ // the JoinTable annotation is missing, add both it and a join column at the same time
+ return this.addAnnotation().addInverseJoinColumn(index);
+ }
+
+ public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeInverseJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java
new file mode 100644
index 0000000000..61f04b9e6b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.Column</code>
+ * <li><code>javax.persistence.JoinColumn</code>
+ * <li><code>javax.persistence.MapKeyColumn</code>
+ * <li><code>javax.persistence.DiscriminatorColumn</code>
+ * <li><code>javax.persistence.OrderColumn</code>
+ * <li><code>javax.persistence.PrimaryKeyJoinColumn</code>
+ * </ul>
+ */
+public abstract class NullNamedColumnAnnotation<A extends NamedColumnAnnotation>
+ extends NullAnnotation<A>
+ implements NamedColumnAnnotation
+{
+ protected NullNamedColumnAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public boolean isSpecified() {
+ return false;
+ }
+
+ // ***** name
+ public String getName() {
+ return null;
+ }
+
+ public void setName(String name) {
+ if (name != null) {
+ this.addAnnotation().setName(name);
+ }
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ // ***** column definition
+ public String getColumnDefinition() {
+ return null;
+ }
+
+ public void setColumnDefinition(String columnDefinition) {
+ if (columnDefinition != null) {
+ this.addAnnotation().setColumnDefinition(columnDefinition);
+ }
+ }
+
+ public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
new file mode 100644
index 0000000000..730c7398df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.PrimaryKeyJoinColumn</code>
+ */
+public final class NullPrimaryKeyJoinColumnAnnotation
+ extends NullNamedColumnAnnotation<PrimaryKeyJoinColumnAnnotation>
+ implements PrimaryKeyJoinColumnAnnotation
+{
+ public NullPrimaryKeyJoinColumnAnnotation(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** referenced column name
+ public String getReferencedColumnName() {
+ return null;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java
new file mode 100644
index 0000000000..3ffc637bd2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
+
+/**
+ * <code>javax.persistence.Table</code>
+ */
+public final class NullTableAnnotation
+ extends NullBaseTableAnnotation<TableAnnotation>
+ implements TableAnnotation
+{
+ protected NullTableAnnotation(JavaResourcePersistentType parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java
new file mode 100644
index 0000000000..ce77b832e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
+
+/**
+ * <code>javax.persistence.Temporal</code>
+ */
+public final class NullTemporalAnnotation
+ extends NullAnnotation<TemporalAnnotation>
+ implements TemporalAnnotation
+{
+ protected NullTemporalAnnotation(JavaResourcePersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ***** value
+ public TemporalType getValue() {
+ return null;
+ }
+
+ public void setValue(TemporalType value) {
+ if (value != null) {
+ this.addAnnotation().setValue(value);
+ }
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java
new file mode 100644
index 0000000000..9f0ccaf7c1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOneToManyAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOneToManyAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
+
+/**
+ * javax.persistence.OneToMany
+ */
+public final class OneToManyAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new OneToManyAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private OneToManyAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceOneToManyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryOneToManyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return OneToManyAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java
new file mode 100644
index 0000000000..d909ad2552
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOneToOneAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOneToOneAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
+
+/**
+ * javax.persistence.OneToOne
+ */
+public final class OneToOneAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new OneToOneAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private OneToOneAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceOneToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryOneToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return OneToOneAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java
new file mode 100644
index 0000000000..21a6687fe3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOrderByAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOrderByAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
+
+/**
+ * javax.persistence.OrderBy
+ */
+public final class OrderByAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new OrderByAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private OrderByAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceOrderByAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryOrderByAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return OrderByAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
new file mode 100644
index 0000000000..2a46e8d96a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+
+/**
+ * javax.persistence.PrimaryKeyJoinColumn
+ */
+public final class PrimaryKeyJoinColumnAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private PrimaryKeyJoinColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourcePrimaryKeyJoinColumnAnnotation.createPrimaryKeyJoinColumn((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryPrimaryKeyJoinColumnAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
new file mode 100644
index 0000000000..6c93d75044
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+
+/**
+ * javax.persistence.PrimaryKeyJoinColumns
+ */
+public final class PrimaryKeyJoinColumnsAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnsAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private PrimaryKeyJoinColumnsAnnotationDefinition() {
+ super();
+ }
+
+ public PrimaryKeyJoinColumnsAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourcePrimaryKeyJoinColumnsAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public PrimaryKeyJoinColumnsAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryPrimaryKeyJoinColumnsAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
new file mode 100644
index 0000000000..2ab5857808
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+
+/**
+ * javax.persistence.SecondaryTable
+ */
+public final class SecondaryTableAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new SecondaryTableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private SecondaryTableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return SourceSecondaryTableAnnotation.createSecondaryTable((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinarySecondaryTableAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return SecondaryTableAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
new file mode 100644
index 0000000000..d30934de34
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySecondaryTablesAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSecondaryTablesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
+
+/**
+ * javax.persistence.SecondaryTables
+ */
+public final class SecondaryTablesAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new SecondaryTablesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private SecondaryTablesAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceSecondaryTablesAnnotation((JavaResourcePersistentType) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinarySecondaryTablesAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return SecondaryTablesAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
new file mode 100644
index 0000000000..3e03fa5a0f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinarySequenceGenerator1_0Annotation;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceSequenceGenerator1_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+
+/**
+ * javax.persistence.SequenceGenerator
+ */
+public final class SequenceGeneratorAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new SequenceGeneratorAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ protected SequenceGeneratorAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceSequenceGenerator1_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinarySequenceGenerator1_0Annotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return SequenceGeneratorAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java
new file mode 100644
index 0000000000..d5ea08d3ff
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
+
+/**
+ * javax.persistence.Table
+ */
+public final class TableAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new TableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private TableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceTableAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullTableAnnotation((JavaResourcePersistentType) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryTableAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return TableAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
new file mode 100644
index 0000000000..3c043df606
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+
+/**
+ * javax.persistence.TableGenerator
+ */
+public final class TableGeneratorAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new TableGeneratorAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private TableGeneratorAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceTableGeneratorAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryTableGeneratorAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return TableGeneratorAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java
new file mode 100644
index 0000000000..47cc40ebdb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTemporalAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTemporalAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+/**
+ * javax.persistence.Temporal
+ */
+public final class TemporalAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new TemporalAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private TemporalAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceTemporalAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ return new NullTemporalAnnotation((JavaResourcePersistentAttribute) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryTemporalAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return TemporalAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java
new file mode 100644
index 0000000000..ab9f9f0220
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTransientAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTransientAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
+
+/**
+ * javax.persistence.Transient
+ */
+public final class TransientAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new TransientAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private TransientAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceTransientAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryTransientAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return TransientAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java
new file mode 100644
index 0000000000..c1719af680
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryVersionAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceVersionAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
+
+/**
+ * javax.persistence.Version
+ */
+public final class VersionAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new VersionAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private VersionAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceVersionAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return new BinaryVersionAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return VersionAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java
new file mode 100644
index 0000000000..3ab6aca048
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * binary annotated element
+ */
+abstract class BinaryAnnotatedElement
+ extends BinaryNode
+ implements JavaResourceAnnotatedElement
+{
+ /** JDT annotated element adapter */
+ final Adapter adapter;
+
+ /** annotations */
+ final Vector<Annotation> annotations = new Vector<Annotation>();
+
+ /**
+ * these are built as needed
+ */
+ private final HashMap<String, Annotation> nullAnnotationsCache = new HashMap<String, Annotation>();
+
+
+ // ********** construction/initialization **********
+
+ public BinaryAnnotatedElement(JavaResourceNode parent, Adapter adapter) {
+ super(parent);
+ this.adapter = adapter;
+ this.initializeAnnotations();
+ }
+
+ private void initializeAnnotations() {
+ for (IAnnotation annotation : this.getJdtAnnotations()) {
+ this.addAnnotation(annotation);
+ }
+ }
+
+ private void addAnnotation(IAnnotation jdtAnnotation) {
+ if (this.annotationIsValid(jdtAnnotation)) {
+ this.annotations.add(this.buildAnnotation(jdtAnnotation));
+ }
+ }
+
+
+ // ********** updating **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateAnnotations();
+ }
+
+ // TODO
+ private void updateAnnotations() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** annotations **********
+
+ public Iterator<Annotation> annotations() {
+ return this.getAnnotations().iterator();
+ }
+
+ private Iterable<Annotation> getAnnotations() {
+ return new LiveCloneIterable<Annotation>(this.annotations);
+ }
+
+ public int annotationsSize() {
+ return this.annotations.size();
+ }
+
+ public Annotation getAnnotation(String annotationName) {
+ return this.selectAnnotationNamed(this.getAnnotations(), annotationName);
+ }
+
+ public Annotation getNonNullAnnotation(String annotationName) {
+ Annotation annotation = this.getAnnotation(annotationName);
+ return (annotation != null) ? annotation : this.getNullAnnotation(annotationName);
+ }
+
+ private synchronized Annotation getNullAnnotation(String annotationName) {
+ Annotation annotation = this.nullAnnotationsCache.get(annotationName);
+ if (annotation == null) {
+ annotation = this.buildNullAnnotation(annotationName);
+ this.nullAnnotationsCache.put(annotationName, annotation);
+ }
+ return annotation;
+ }
+
+ public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
+ if (containerAnnotation != null) {
+ return containerAnnotation.getNestedAnnotations().iterator();
+ }
+ NestableAnnotation nestableAnnotation = this.getNestableAnnotation(nestableAnnotationName);
+ return (nestableAnnotation == null) ?
+ EmptyListIterator.<NestableAnnotation>instance() :
+ new SingleElementIterator<NestableAnnotation>(nestableAnnotation);
+ }
+
+ private NestableAnnotation getNestableAnnotation(String annotationName) {
+ return (NestableAnnotation) this.getAnnotation(annotationName);
+ }
+
+ @SuppressWarnings("unchecked")
+ private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) {
+ return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName);
+ }
+
+ private boolean annotationIsValid(IAnnotation jdtAnnotation) {
+ return CollectionTools.contains(this.validAnnotationNames(), jdtAnnotation.getElementName());
+ }
+
+ abstract Iterator<String> validAnnotationNames();
+
+ abstract Annotation buildAnnotation(IAnnotation jdtAnnotation);
+
+ abstract Annotation buildNullAnnotation(String annotationName);
+
+
+ // ********** simple state **********
+
+ public boolean isAnnotated() {
+ return ! this.annotations.isEmpty();
+ }
+
+
+ // ********** misc **********
+
+ IJavaElement getAnnotatedElement() {
+ return this.adapter.getElement();
+ }
+
+ private Annotation selectAnnotationNamed(Iterable<Annotation> annotationList, String annotationName) {
+ for (Annotation annotation : annotationList) {
+ if (annotation.getAnnotationName().equals(annotationName)) {
+ return annotation;
+ }
+ }
+ return null;
+ }
+
+ private IAnnotation[] getJdtAnnotations() {
+ try {
+ return this.adapter.getAnnotations();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return EMPTY_JDT_ANNOTATION_ARRAY;
+ }
+ }
+ private static final IAnnotation[] EMPTY_JDT_ANNOTATION_ARRAY = new IAnnotation[0];
+
+
+ // ********** IJavaElement adapter **********
+
+ interface Adapter {
+ /**
+ * Return the adapter's JDT element (IPackageFragment, IType, IField, IMethod).
+ */
+ IJavaElement getElement();
+
+ /**
+ * Return the adapter's element's JDT annotations.
+ */
+ IAnnotation[] getAnnotations() throws JavaModelException;
+ }
+
+
+ // ********** unsupported JavaResourcePersistentMember implementation **********
+
+ public Annotation addAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java
new file mode 100644
index 0000000000..8f59feac5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Map;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * JAR annotation
+ */
+public abstract class BinaryAnnotation
+ extends BinaryNode
+ implements Annotation
+{
+ final IAnnotation jdtAnnotation;
+
+ protected BinaryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent);
+ this.jdtAnnotation = jdtAnnotation;
+ }
+
+
+ // ********** convenience methods **********
+
+ /**
+ * Return the values of the JDT annotation's member with the specified name.
+ */
+ protected Object[] getJdtMemberValues(String memberName) {
+ Object[] values = (Object[]) this.getJdtMemberValue(memberName);
+ return (values != null) ? values : EMPTY_OBJECT_ARRAY;
+ }
+ private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+ /**
+ * Return the value of the JDT annotation's member with the specified name.
+ */
+ protected Object getJdtMemberValue(String memberName) {
+ IMemberValuePair pair = this.getJdtMemberValuePair(memberName);
+ return (pair == null) ? null : pair.getValue();
+ }
+
+ /**
+ * Return the JDT annotation's member-value pair with the specified name.
+ */
+ private IMemberValuePair getJdtMemberValuePair(String memberName) {
+ for (IMemberValuePair pair : this.getJdtMemberValuePairs()) {
+ if (pair.getMemberName().equals(memberName)) {
+ return pair;
+ }
+ }
+ return null;
+ }
+
+ private IMemberValuePair[] getJdtMemberValuePairs() {
+ try {
+ return this.jdtAnnotation.getMemberValuePairs();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return EMPTY_MEMBER_VALUE_PAIR_ARRAY;
+ }
+ }
+ private static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0];
+
+
+ // ********** Annotation implementation **********
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+ public boolean isUnset() {
+ throw new UnsupportedOperationException();
+ }
+
+ // ********** NestableAnnotation implementation **********
+ public void moveAnnotation(@SuppressWarnings("unused") int index) {
+ throw new UnsupportedOperationException();
+ }
+ public void convertToNested(@SuppressWarnings("unused") ContainerAnnotation<? extends NestableAnnotation> containerAnnotation, @SuppressWarnings("unused") DeclarationAnnotationAdapter containerAnnotationAdapter, @SuppressWarnings("unused") int index) {
+ throw new UnsupportedOperationException();
+ }
+ public void convertToStandAlone() {
+ throw new UnsupportedOperationException();
+ }
+
+ // ********** misc **********
+ public void storeOn(Map<String, Object> map) {
+ throw new UnsupportedOperationException();
+ }
+ public void restoreFrom(Map<String, Object> map) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
new file mode 100644
index 0000000000..f7573033bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+
+/**
+ * javax.persistence.AssociationOverride
+ */
+public abstract class BinaryAssociationOverrideAnnotation
+ extends BinaryOverrideAnnotation
+ implements NestableAssociationOverrideAnnotation
+{
+ private final Vector<JoinColumnAnnotation> joinColumns;
+
+
+ protected BinaryAssociationOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.joinColumns = this.buildJoinColumns();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinColumns();
+ }
+
+
+ // ********** BinaryOverrideAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.ASSOCIATION_OVERRIDE__NAME;
+ }
+
+
+ // ********** AssociationOverrideAnnotation implementation **********
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<JoinColumnAnnotation> buildJoinColumns() {
+ Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS);
+ Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
+ for (Object jdtJoinColumn : jdtJoinColumns) {
+ result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
+ }
+ return result;
+ }
+
+ // TODO
+ private void updateJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
new file mode 100644
index 0000000000..7ecda6b2f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+
+/**
+ * javax.persistence.AssociationOverrides
+ */
+public abstract class BinaryAssociationOverridesAnnotation
+ extends BinaryContainerAnnotation<NestableAssociationOverrideAnnotation>
+ implements AssociationOverridesAnnotation
+{
+ private final Vector<NestableAssociationOverrideAnnotation> associationOverrides;
+
+
+ protected BinaryAssociationOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.associationOverrides = this.buildAssociationOverrides();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableAssociationOverrideAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableAssociationOverrideAnnotation>(this.associationOverrides);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.associationOverrides.size();
+ }
+
+ private Vector<NestableAssociationOverrideAnnotation> buildAssociationOverrides() {
+ Object[] jdtAssociationOverrides = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDES__VALUE);
+ Vector<NestableAssociationOverrideAnnotation> result = new Vector<NestableAssociationOverrideAnnotation>(jdtAssociationOverrides.length);
+ for (Object jdtAssociationOverride : jdtAssociationOverrides) {
+ result.add(buildAssociationOverride(jdtAssociationOverride));
+ }
+ return result;
+ }
+
+ protected abstract NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride);
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateAssociationOverrides();
+ }
+
+ // TODO
+ private void updateAssociationOverrides() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
new file mode 100644
index 0000000000..e7a6c90119
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
+
+/**
+ * javax.persistence.AttributeOverride
+ */
+public final class BinaryAttributeOverrideAnnotation
+ extends BinaryOverrideAnnotation
+ implements NestableAttributeOverrideAnnotation
+{
+ private ColumnAnnotation column;
+ private final ColumnAnnotation nullColumn;
+
+
+ public BinaryAttributeOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.column = this.buildColumn();
+ this.nullColumn = this.buildNullColumn();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateColumn();
+ }
+
+
+ //************ BinaryOverrideAnnotation implementation ****************
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.ATTRIBUTE_OVERRIDE__NAME;
+ }
+
+
+ //************ AttributeOverride implementation ****************
+
+ // ***** column
+ public ColumnAnnotation getColumn() {
+ return this.column;
+ }
+
+ public ColumnAnnotation getNonNullColumn() {
+ return (this.column != null) ? this.column : this.nullColumn;
+ }
+
+ public ColumnAnnotation addColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ private ColumnAnnotation buildColumn() {
+ IAnnotation jdtColumn = this.getJdtColumn();
+ return (jdtColumn == null) ? null : this.buildColumn(jdtColumn);
+ }
+
+ private ColumnAnnotation buildNullColumn() {
+ return new NullAttributeOverrideColumnAnnotation(this);
+ }
+
+ private ColumnAnnotation buildColumn(IAnnotation jdtColumn) {
+ return new BinaryColumnAnnotation(this, jdtColumn);
+ }
+
+ private IAnnotation getJdtColumn() {
+ return (IAnnotation) this.getJdtMemberValue(JPA.ATTRIBUTE_OVERRIDE__COLUMN);
+ }
+
+ private void setColumn(ColumnAnnotation column) {
+ ColumnAnnotation old = this.column;
+ this.column = column;
+ this.firePropertyChanged(COLUMN_PROPERTY, old, column);
+ }
+
+ // TODO
+ private void updateColumn() {
+ throw new UnsupportedOperationException();
+// IAnnotation jdtColumn = this.getJdtColumn();
+// if (jdtColumn == null) {
+// this.setColumn(null);
+// } else {
+// if (this.column == null) {
+// this.setColumn(this.buildColumn(jdtColumn));
+// } else {
+// this.column.update(jdtColumn);
+// }
+// }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
new file mode 100644
index 0000000000..d4a73ac475
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
+
+/**
+ * javax.persistence.AttributeOverrides
+ */
+public final class BinaryAttributeOverridesAnnotation
+ extends BinaryContainerAnnotation<NestableAttributeOverrideAnnotation>
+ implements AttributeOverridesAnnotation
+{
+ private final Vector<NestableAttributeOverrideAnnotation> attributeOverrides;
+
+
+ public BinaryAttributeOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.attributeOverrides = this.buildAttributeOverrides();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableAttributeOverrideAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableAttributeOverrideAnnotation>(this.attributeOverrides);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.attributeOverrides.size();
+ }
+
+ private Vector<NestableAttributeOverrideAnnotation> buildAttributeOverrides() {
+ Object[] jdtAttributeOverrides = this.getJdtMemberValues(JPA.ATTRIBUTE_OVERRIDES__VALUE);
+ Vector<NestableAttributeOverrideAnnotation> result = new Vector<NestableAttributeOverrideAnnotation>(jdtAttributeOverrides.length);
+ for (Object jdtAttributeOverride : jdtAttributeOverrides) {
+ result.add(new BinaryAttributeOverrideAnnotation(this, (IAnnotation) jdtAttributeOverride));
+ }
+ return result;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateAttributeOverrides();
+ }
+
+ // TODO
+ private void updateAttributeOverrides() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
new file mode 100644
index 0000000000..31f4a617f4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.Column
+ * javax.persistence.JoinColumn
+ */
+public abstract class BinaryBaseColumnAnnotation
+ extends BinaryNamedColumnAnnotation
+ implements BaseColumnAnnotation
+{
+ private String table;
+ private Boolean unique;
+ private Boolean nullable;
+ private Boolean insertable;
+ private Boolean updatable;
+
+
+ protected BinaryBaseColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.table = this.buildTable();
+ this.unique = this.buildUnique();
+ this.nullable = this.buildNullable();
+ this.insertable = this.buildInsertable();
+ this.updatable = this.buildUpdatable();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setTable_(this.buildTable());
+ this.setUnique_(this.buildUnique());
+ this.setNullable_(this.buildNullable());
+ this.setInsertable_(this.buildInsertable());
+ this.setUpdatable_(this.buildUpdatable());
+ }
+
+
+ //************* BaseColumnAnnotation implementation *************
+
+ // ***** table
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String table) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setTable_(String table) {
+ String old = this.table;
+ this.table = table;
+ this.firePropertyChanged(TABLE_PROPERTY, old, table);
+ }
+
+ private String buildTable() {
+ return (String) this.getJdtMemberValue(this.getTableElementName());
+ }
+
+ protected abstract String getTableElementName();
+
+ public TextRange getTableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** unique
+ public Boolean getUnique() {
+ return this.unique;
+ }
+
+ public void setUnique(Boolean unique) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setUnique_(Boolean unique) {
+ Boolean old = this.unique;
+ this.unique = unique;
+ this.firePropertyChanged(UNIQUE_PROPERTY, old, unique);
+ }
+
+ private Boolean buildUnique() {
+ return (Boolean) this.getJdtMemberValue(this.getUniqueElementName());
+ }
+
+ protected abstract String getUniqueElementName();
+
+ public TextRange getUniqueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** nullable
+ public Boolean getNullable() {
+ return this.nullable;
+ }
+
+ public void setNullable(Boolean nullable) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setNullable_(Boolean nullable) {
+ Boolean old = this.nullable;
+ this.nullable = nullable;
+ this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable);
+ }
+
+ private Boolean buildNullable() {
+ return (Boolean) this.getJdtMemberValue(this.getNullableElementName());
+ }
+
+ protected abstract String getNullableElementName();
+
+ public TextRange getNullableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** insertable
+ public Boolean getInsertable() {
+ return this.insertable;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setInsertable_(Boolean insertable) {
+ Boolean old = this.insertable;
+ this.insertable = insertable;
+ this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable);
+ }
+
+ private Boolean buildInsertable() {
+ return (Boolean) this.getJdtMemberValue(this.getInsertableElementName());
+ }
+
+ protected abstract String getInsertableElementName();
+
+ public TextRange getInsertableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** updatable
+ public Boolean getUpdatable() {
+ return this.updatable;
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setUpdatable_(Boolean updatable) {
+ Boolean old = this.updatable;
+ this.updatable = updatable;
+ this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable);
+ }
+
+ private Boolean buildUpdatable() {
+ return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName());
+ }
+
+ protected abstract String getUpdatableElementName();
+
+ public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
new file mode 100644
index 0000000000..07acd58ce7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.EnumType;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.Enumerated
+ */
+public abstract class BinaryBaseEnumeratedAnnotation
+ extends BinaryAnnotation
+ implements EnumeratedAnnotation
+{
+ private EnumType value;
+
+
+ protected BinaryBaseEnumeratedAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** EnumeratedAnnotation implementation **********
+
+ // ***** value
+ public EnumType getValue() {
+ return this.value;
+ }
+
+ public void setValue(EnumType value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(EnumType value) {
+ EnumType old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private EnumType buildValue() {
+ return EnumType.fromJavaAnnotationValue(this.getJdtMemberValue(this.getValueElementName()));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected abstract String getValueElementName();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
new file mode 100644
index 0000000000..f8c35068ec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.BaseJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.JoinColumn
+ * javax.persistence.MapKeyJoinColumn
+ */
+public abstract class BinaryBaseJoinColumnAnnotation
+ extends BinaryBaseColumnAnnotation
+ implements BaseJoinColumnAnnotation
+{
+ private String referencedColumnName;
+
+
+ public BinaryBaseJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.referencedColumnName = this.buildReferencedColumnName();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setReferencedColumnName_(this.buildReferencedColumnName());
+ }
+
+ protected abstract String getReferencedColumnNameElementName();
+
+
+ //************ BaseJoinColumnAnnotation implementation ***************
+
+ // referenced column name
+ public String getReferencedColumnName() {
+ return this.referencedColumnName;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setReferencedColumnName_(String referencedColumnName) {
+ String old = this.referencedColumnName;
+ this.referencedColumnName = referencedColumnName;
+ this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
+ }
+
+ private String buildReferencedColumnName() {
+ return (String) this.getJdtMemberValue(JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
new file mode 100644
index 0000000000..7e410a1a7d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+/**
+ * javax.persistence.Table
+ * javax.persistence.JoinTable
+ * javax.persistence.SecondaryTable
+ */
+public abstract class BinaryBaseTableAnnotation
+ extends BinaryAnnotation
+ implements BaseTableAnnotation
+{
+ String name;
+ String schema;
+ String catalog;
+ final Vector<UniqueConstraintAnnotation> uniqueConstraints;
+
+
+ protected BinaryBaseTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.schema = this.buildSchema();
+ this.catalog = this.buildCatalog();
+ this.uniqueConstraints = this.buildUniqueConstraints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ this.setSchema_(this.buildSchema());
+ this.setCatalog_(this.buildCatalog());
+ this.updateUniqueConstraints();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** BaseTableAnnotation implementation **********
+
+ public boolean isSpecified() {
+ return true;
+ }
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(this.getNameElementName());
+ }
+
+ protected abstract String getNameElementName();
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** schema
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String schema) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setSchema_(String schema) {
+ String old = this.schema;
+ this.schema = schema;
+ this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
+ }
+
+ private String buildSchema() {
+ return (String) this.getJdtMemberValue(this.getSchemaElementName());
+ }
+
+ protected abstract String getSchemaElementName();
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** catalog
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String catalog) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCatalog_(String catalog) {
+ String old = this.catalog;
+ this.catalog = catalog;
+ this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
+ }
+
+ private String buildCatalog() {
+ return (String) this.getJdtMemberValue(this.getCatalogElementName());
+ }
+
+ protected abstract String getCatalogElementName();
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** unique constraints
+ public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
+ return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
+ return this.uniqueConstraints.indexOf(uniqueConstraint);
+ }
+
+ public UniqueConstraintAnnotation addUniqueConstraint(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeUniqueConstraint(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() {
+ Object[] jdtUniqueConstraints = this.getJdtMemberValues(this.getUniqueConstraintElementName());
+ Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length);
+ for (Object jdtUniqueConstraint : jdtUniqueConstraints) {
+ result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint));
+ }
+ return result;
+ }
+
+ protected abstract String getUniqueConstraintElementName();
+
+ // TODO
+ private void updateUniqueConstraints() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
new file mode 100644
index 0000000000..5c98ccf8b3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
+
+/**
+ * javax.persistence.Temporal
+ * javax.persistence.MapKeyTemporal
+ */
+public abstract class BinaryBaseTemporalAnnotation
+ extends BinaryAnnotation
+ implements TemporalAnnotation
+{
+ private TemporalType value;
+
+
+ protected BinaryBaseTemporalAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** TemporalAnnotation implementation **********
+
+ // ***** value
+ public TemporalType getValue() {
+ return this.value;
+ }
+
+ public void setValue(TemporalType value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(TemporalType value) {
+ TemporalType old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private TemporalType buildValue() {
+ return TemporalType.fromJavaAnnotationValue(this.getJdtMemberValue(getValueElementName()));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected abstract String getValueElementName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java
new file mode 100644
index 0000000000..17ba837fae
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.FetchType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Basic
+ */
+public final class BinaryBasicAnnotation
+ extends BinaryAnnotation
+ implements BasicAnnotation
+{
+ private Boolean optional;
+ private FetchType fetch;
+
+
+ public BinaryBasicAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.optional = this.buildOptional();
+ this.fetch = this.buildFetch();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setOptional_(this.buildOptional());
+ this.setFetch_(this.buildFetch());
+ }
+
+
+ //*************** Basic implementation ****************
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setOptional_(Boolean optional) {
+ Boolean old = this.optional;
+ this.optional = optional;
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
+ }
+
+ private Boolean buildOptional() {
+ return (Boolean) this.getJdtMemberValue(JPA.BASIC__OPTIONAL);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setFetch_(FetchType fetch) {
+ FetchType old = this.fetch;
+ this.fetch = fetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
+ }
+
+ private FetchType buildFetch() {
+ return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.BASIC__FETCH));
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java
new file mode 100644
index 0000000000..28721d9178
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceClassFile;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragment;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * binary class file
+ */
+final class BinaryClassFile
+ extends BinaryNode
+ implements JavaResourceClassFile
+{
+ /** JDT class file */
+ private final IClassFile classFile;
+
+ /** class file's persistent type */
+ private final JavaResourcePersistentType persistentType;
+
+
+ // ********** construction/initialization **********
+
+ /**
+ * The JDT type gets passed in because the package fragment inspects it
+ * beforehand to determine whether it is "persistable". (We only build
+ * class files for "persistable" types.)
+ */
+ BinaryClassFile(JavaResourcePackageFragment parent, IClassFile classFile, IType jdtType) {
+ super(parent);
+ this.classFile = classFile;
+ this.persistentType = this.buildPersistentType(jdtType);
+ }
+
+ private JavaResourcePersistentType buildPersistentType(IType jdtType) {
+ return new BinaryPersistentType(this, jdtType);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.classFile.getElementName());
+ }
+
+
+ // ********** JavaResourceClassFile implementation **********
+
+ public JavaResourcePersistentType getPersistentType() {
+ return this.persistentType;
+ }
+
+ // TODO
+ @Override
+ public void update() {
+ super.update();
+// this.persistentType.update(this.classFile.getType());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java
new file mode 100644
index 0000000000..840041256d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.Column
+ */
+public final class BinaryColumnAnnotation
+ extends BinaryCompleteColumnAnnotation
+ implements ColumnAnnotation
+{
+
+ public BinaryColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** BinaryBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA.COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA.COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA.COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA.COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA.COLUMN__UPDATABLE;
+ }
+
+
+ // ********** BinaryCompleteColumnAnnotation implementation **********
+
+ @Override
+ protected String getLengthElementName() {
+ return JPA.COLUMN__LENGTH;
+ }
+
+ @Override
+ protected String getPrecisionElementName() {
+ return JPA.COLUMN__PRECISION;
+ }
+
+ @Override
+ protected String getScaleElementName() {
+ return JPA.COLUMN__SCALE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
new file mode 100644
index 0000000000..b1bc0bd745
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * Abstract implementation of ColumnAnnotation to be used for JPA annotations:
+ * javax.persistence.Column
+ * javax.persistence.MapKeyColumn
+ */
+public abstract class BinaryCompleteColumnAnnotation
+ extends BinaryBaseColumnAnnotation
+ implements CompleteColumnAnnotation
+{
+ protected Integer length;
+ protected Integer precision;
+ protected Integer scale;
+
+
+ protected BinaryCompleteColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.length = this.buildLength();
+ this.precision = this.buildPrecision();
+ this.scale = this.buildScale();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setLength_(this.buildLength());
+ this.setPrecision_(this.buildPrecision());
+ this.setScale_(this.buildScale());
+ }
+
+
+ // ********** ColumnAnnotation implementation **********
+
+ // ***** length
+ public Integer getLength() {
+ return this.length;
+ }
+
+ public void setLength(Integer length) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setLength_(Integer length) {
+ Integer old = this.length;
+ this.length = length;
+ this.firePropertyChanged(LENGTH_PROPERTY, old, length);
+ }
+
+ private Integer buildLength() {
+ return (Integer) this.getJdtMemberValue(this.getLengthElementName());
+ }
+
+ public TextRange getLengthTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected abstract String getLengthElementName();
+
+ // ***** precision
+ public Integer getPrecision() {
+ return this.precision;
+ }
+
+ public void setPrecision(Integer precision) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setPrecision_(Integer precision) {
+ Integer old = this.precision;
+ this.precision = precision;
+ this.firePropertyChanged(PRECISION_PROPERTY, old, precision);
+ }
+
+ private Integer buildPrecision() {
+ return (Integer) this.getJdtMemberValue(this.getPrecisionElementName());
+ }
+
+ public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected abstract String getPrecisionElementName();
+
+ // ***** scale
+ public Integer getScale() {
+ return this.scale;
+ }
+
+ public void setScale(Integer scale) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setScale_(Integer scale) {
+ Integer old = this.scale;
+ this.scale = scale;
+ this.firePropertyChanged(SCALE_PROPERTY, old, scale);
+ }
+
+ private Integer buildScale() {
+ return (Integer) this.getJdtMemberValue(this.getScaleElementName());
+ }
+
+ public TextRange getScaleTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected abstract String getScaleElementName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java
new file mode 100644
index 0000000000..fdd3f152a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * JAR annotations do not support most of the container annotation protocol.
+ */
+public abstract class BinaryContainerAnnotation<T extends NestableAnnotation>
+ extends BinaryAnnotation
+ implements ContainerAnnotation<T>
+{
+
+ protected BinaryContainerAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getElementName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getNestedAnnotationName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public T addNestedAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public T moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public T removeNestedAnnotation(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeLastNestedAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
new file mode 100644
index 0000000000..3346100136
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.DiscriminatorColumn
+ */
+public final class BinaryDiscriminatorColumnAnnotation
+ extends BinaryNamedColumnAnnotation
+ implements DiscriminatorColumnAnnotation
+{
+ private DiscriminatorType discriminatorType;
+ private Integer length;
+
+
+ public BinaryDiscriminatorColumnAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.discriminatorType = this.buildDiscriminatorType();
+ this.length = this.buildLength();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDiscriminatorType_(this.buildDiscriminatorType());
+ this.setLength_(this.buildLength());
+ }
+
+
+ // ********** BinaryNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.DISCRIMINATOR_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** DiscriminatorColumnAnnotation implementation **********
+
+ // ***** discriminator type
+ public DiscriminatorType getDiscriminatorType() {
+ return null;
+ }
+
+ public void setDiscriminatorType(DiscriminatorType discriminatorType) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDiscriminatorType_(DiscriminatorType discriminatorType) {
+ DiscriminatorType old = this.discriminatorType;
+ this.discriminatorType = discriminatorType;
+ this.firePropertyChanged(DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
+ }
+
+ private DiscriminatorType buildDiscriminatorType() {
+ return DiscriminatorType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE));
+ }
+
+ // ***** length
+ public Integer getLength() {
+ return null;
+ }
+
+ public void setLength(Integer length) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setLength_(Integer length) {
+ Integer old = this.length;
+ this.length = length;
+ this.firePropertyChanged(LENGTH_PROPERTY, old, length);
+ }
+
+ private Integer buildLength() {
+ return (Integer) this.getJdtMemberValue(JPA.DISCRIMINATOR_COLUMN__LENGTH);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
new file mode 100644
index 0000000000..9b86088033
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.DiscriminatorValue
+ */
+public final class BinaryDiscriminatorValueAnnotation
+ extends BinaryAnnotation
+ implements DiscriminatorValueAnnotation
+{
+ private String value;
+
+
+ public BinaryDiscriminatorValueAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** DiscriminatorValueAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA.DISCRIMINATOR_VALUE__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
new file mode 100644
index 0000000000..7457e74476
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Embeddable
+ */
+public final class BinaryEmbeddableAnnotation
+ extends BinaryAnnotation
+ implements EmbeddableAnnotation
+{
+
+ public BinaryEmbeddableAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
new file mode 100644
index 0000000000..6f2bd59e8e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Embedded
+ */
+public final class BinaryEmbeddedAnnotation
+ extends BinaryAnnotation
+ implements EmbeddedAnnotation
+{
+
+ public BinaryEmbeddedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
new file mode 100644
index 0000000000..5636c3f215
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.EmbeddedId
+ */
+public final class BinaryEmbeddedIdAnnotation
+ extends BinaryAnnotation
+ implements EmbeddedIdAnnotation
+{
+
+ public BinaryEmbeddedIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java
new file mode 100644
index 0000000000..acb9b3de4a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Entity
+ */
+public final class BinaryEntityAnnotation
+ extends BinaryAnnotation
+ implements EntityAnnotation
+{
+ private String name;
+
+
+ public BinaryEntityAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** EntityAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(JPA.ENTITY__NAME);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
new file mode 100644
index 0000000000..73abbe72e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Enumerated
+ */
+public final class BinaryEnumeratedAnnotation
+ extends BinaryBaseEnumeratedAnnotation
+ implements EnumeratedAnnotation
+{
+
+ public BinaryEnumeratedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA.ENUMERATED__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
new file mode 100644
index 0000000000..f232dfaf42
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.GenerationType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.GeneratedValue
+ */
+public final class BinaryGeneratedValueAnnotation
+ extends BinaryAnnotation
+ implements GeneratedValueAnnotation
+{
+ private GenerationType strategy;
+ private String generator;
+
+
+ public BinaryGeneratedValueAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.strategy = this.buildStrategy();
+ this.generator = this.buildGenerator();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setStrategy_(this.buildStrategy());
+ this.setGenerator_(this.buildGenerator());
+ }
+
+
+ // ********** GeneratedValueAnnotation implementation **********
+
+ // ***** strategy
+ public GenerationType getStrategy() {
+ return this.strategy;
+ }
+
+ public void setStrategy(GenerationType strategy) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setStrategy_(GenerationType strategy) {
+ GenerationType old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ private GenerationType buildStrategy() {
+ return GenerationType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.GENERATED_VALUE__STRATEGY));
+ }
+
+ public TextRange getStrategyTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** generator
+ public String getGenerator() {
+ return this.generator;
+ }
+
+ public void setGenerator(String generator) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setGenerator_(String generator) {
+ String old = this.generator;
+ this.generator = generator;
+ this.firePropertyChanged(GENERATOR_PROPERTY, old, generator);
+ }
+
+ private String buildGenerator() {
+ return (String) this.getJdtMemberValue(JPA.GENERATED_VALUE__GENERATOR);
+ }
+
+ public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean generatorTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
new file mode 100644
index 0000000000..df5549d573
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.SequenceGenerator
+ * javax.persistence.TableGenerator
+ */
+abstract class BinaryGeneratorAnnotation
+ extends BinaryAnnotation
+ implements GeneratorAnnotation
+{
+ String name;
+ Integer initialValue;
+ Integer allocationSize;
+
+
+ BinaryGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.initialValue = this.buildInitialValue();
+ this.allocationSize = this.buildAllocationSize();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ this.setInitialValue_(this.buildInitialValue());
+ this.setAllocationSize_(this.buildAllocationSize());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** GeneratorAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(this.getNameElementName());
+ }
+
+ abstract String getNameElementName();
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** initial value
+ public Integer getInitialValue() {
+ return this.initialValue;
+ }
+
+ public void setInitialValue(Integer initialValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setInitialValue_(Integer initialValue) {
+ Integer old = this.initialValue;
+ this.initialValue = initialValue;
+ this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, initialValue);
+ }
+
+ private Integer buildInitialValue() {
+ return (Integer) this.getJdtMemberValue(this.getInitialValueElementName());
+ }
+
+ abstract String getInitialValueElementName();
+
+ public TextRange getInitialValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** name
+ public Integer getAllocationSize() {
+ return this.allocationSize;
+ }
+
+ public void setAllocationSize(Integer allocationSize) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setAllocationSize_(Integer allocationSize) {
+ Integer old = this.allocationSize;
+ this.allocationSize = allocationSize;
+ this.firePropertyChanged(NAME_PROPERTY, old, allocationSize);
+ }
+
+ private Integer buildAllocationSize() {
+ return (Integer) this.getJdtMemberValue(this.getAllocationSizeElementName());
+ }
+
+ abstract String getAllocationSizeElementName();
+
+ public TextRange getAllocationSizeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java
new file mode 100644
index 0000000000..5c3323827c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Id
+ */
+public final class BinaryIdAnnotation
+ extends BinaryAnnotation
+ implements IdAnnotation
+{
+
+ public BinaryIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
new file mode 100644
index 0000000000..5eef8693d8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.IdClass
+ */
+public final class BinaryIdClassAnnotation
+ extends BinaryAnnotation
+ implements IdClassAnnotation
+{
+ private String value;
+
+
+ public BinaryIdClassAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** IdClassAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA.ID_CLASS__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fully-qualified class name
+ /**
+ * binary is already fully-qualified
+ */
+ public String getFullyQualifiedClassName() {
+ return this.value;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
new file mode 100644
index 0000000000..41a01e25e0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Inheritance
+ */
+public final class BinaryInheritanceAnnotation
+ extends BinaryAnnotation
+ implements InheritanceAnnotation
+{
+ private InheritanceType strategy;
+
+
+ public BinaryInheritanceAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.strategy = this.buildStrategy();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setStrategy_(this.buildStrategy());
+ }
+
+
+ // ********** InheritanceAnnotation implementation **********
+
+ // ***** strategy
+ public InheritanceType getStrategy() {
+ return this.strategy;
+ }
+
+ public void setStrategy(InheritanceType strategy) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setStrategy_(InheritanceType strategy) {
+ InheritanceType old = this.strategy;
+ this.strategy = strategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ }
+
+ private InheritanceType buildStrategy() {
+ return InheritanceType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.INHERITANCE__STRATEGY));
+ }
+
+ public TextRange getStrategyTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
new file mode 100644
index 0000000000..6ec2b225cd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+
+/**
+ * javax.persistence.JoinColumn
+ */
+public final class BinaryJoinColumnAnnotation
+ extends BinaryBaseJoinColumnAnnotation
+ implements NestableJoinColumnAnnotation
+{
+
+ public BinaryJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** BinaryBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA.JOIN_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA.JOIN_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA.JOIN_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA.JOIN_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA.JOIN_COLUMN__UPDATABLE;
+ }
+
+
+ // ********** BinaryBaseJoinColumnAnnotation implementation **********
+
+ @Override
+ protected String getReferencedColumnNameElementName() {
+ return JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
new file mode 100644
index 0000000000..6a55a85ffb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+
+/**
+ * javax.persistence.JoinColumns
+ */
+public final class BinaryJoinColumnsAnnotation
+ extends BinaryContainerAnnotation<NestableJoinColumnAnnotation>
+ implements JoinColumnsAnnotation
+{
+ private final Vector<NestableJoinColumnAnnotation> joinColumns;
+
+
+ public BinaryJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.joinColumns = this.buildJoinColumns();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.joinColumns.size();
+ }
+
+ private Vector<NestableJoinColumnAnnotation> buildJoinColumns() {
+ Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_COLUMNS__VALUE);
+ Vector<NestableJoinColumnAnnotation> result = new Vector<NestableJoinColumnAnnotation>(jdtJoinColumns.length);
+ for (Object jdtJoinColumn : jdtJoinColumns) {
+ result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
+ }
+ return result;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinColumns();
+ }
+
+ // TODO
+ private void updateJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
new file mode 100644
index 0000000000..5113f1a2cd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * javax.persistence.JoinTable
+ */
+public final class BinaryJoinTableAnnotation
+ extends BinaryBaseTableAnnotation
+ implements JoinTableAnnotation
+{
+ private final Vector<JoinColumnAnnotation> joinColumns;
+ private final Vector<JoinColumnAnnotation> inverseJoinColumns;
+
+
+ public BinaryJoinTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.joinColumns = this.buildJoinColumns();
+ this.inverseJoinColumns = this.buildInverseJoinColumns();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateJoinColumns();
+ this.updateInverseJoinColumns();
+ }
+
+
+ // ********** BinaryBaseTableAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.JOIN_TABLE__NAME;
+ }
+
+ @Override
+ protected String getSchemaElementName() {
+ return JPA.JOIN_TABLE__SCHEMA;
+ }
+
+ @Override
+ protected String getCatalogElementName() {
+ return JPA.JOIN_TABLE__CATALOG;
+ }
+
+ @Override
+ protected String getUniqueConstraintElementName() {
+ return JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+
+ // ********** JoinTableAnnotation implementation **********
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<JoinColumnAnnotation> buildJoinColumns() {
+ Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_TABLE__JOIN_COLUMNS);
+ Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
+ for (Object jdtJoinColumn : jdtJoinColumns) {
+ result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
+ }
+ return result;
+ }
+
+ // TODO
+ private void updateJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ***** inverse join columns
+ public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns);
+ }
+
+ public int inverseJoinColumnsSize() {
+ return this.inverseJoinColumns.size();
+ }
+
+ public JoinColumnAnnotation inverseJoinColumnAt(int index) {
+ return this.inverseJoinColumns.get(index);
+ }
+
+ public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.inverseJoinColumns.indexOf(joinColumn);
+ }
+
+ public JoinColumnAnnotation addInverseJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeInverseJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<JoinColumnAnnotation> buildInverseJoinColumns() {
+ Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS);
+ Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
+ for (Object jdtJoinColumn : jdtJoinColumns) {
+ result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
+ }
+ return result;
+ }
+
+ // TODO
+ private void updateInverseJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java
new file mode 100644
index 0000000000..660ea9f218
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+
+/**
+ * javax.persistence.Lob
+ */
+public final class BinaryLobAnnotation
+ extends BinaryAnnotation
+ implements LobAnnotation
+{
+ public BinaryLobAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
new file mode 100644
index 0000000000..13e474a8b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToMany2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.ManyToMany
+ */
+public final class BinaryManyToManyAnnotation
+ extends BinaryRelationshipMappingAnnotation
+ implements ManyToMany2_0Annotation
+{
+ private String mappedBy;
+
+
+ public BinaryManyToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.mappedBy = this.buildMappedBy();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setMappedBy_(this.buildMappedBy());
+ }
+
+
+ // ********** BinaryRelationshipMappingAnnotation implementation **********
+
+ @Override
+ String getTargetEntityElementName() {
+ return JPA.MANY_TO_MANY__TARGET_ENTITY;
+ }
+
+ @Override
+ String getFetchElementName() {
+ return JPA.MANY_TO_MANY__FETCH;
+ }
+
+ @Override
+ String getCascadeElementName() {
+ return JPA.MANY_TO_MANY__CASCADE;
+ }
+
+
+ //**************** OwnableRelationshipMappingAnnotation implementation **************
+
+ // ***** mapped by
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String mappedBy) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setMappedBy_(String mappedBy) {
+ String old = this.mappedBy;
+ this.mappedBy = mappedBy;
+ this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
+ }
+
+ private String buildMappedBy() {
+ return (String) this.getJdtMemberValue(JPA.MANY_TO_MANY__MAPPED_BY);
+ }
+
+ public TextRange getMappedByTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
new file mode 100644
index 0000000000..f3f9ae511e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToOne2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.ManyToOne
+ */
+public final class BinaryManyToOneAnnotation
+ extends BinaryRelationshipMappingAnnotation
+ implements ManyToOne2_0Annotation
+{
+ private Boolean optional;
+
+
+ public BinaryManyToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.optional = this.buildOptional();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setOptional_(this.buildOptional());
+ }
+
+
+ // ********** BinaryRelationshipMappingAnnotation implementation **********
+
+ @Override
+ String getTargetEntityElementName() {
+ return JPA.MANY_TO_ONE__TARGET_ENTITY;
+ }
+
+ @Override
+ String getFetchElementName() {
+ return JPA.MANY_TO_ONE__FETCH;
+ }
+
+ @Override
+ String getCascadeElementName() {
+ return JPA.MANY_TO_ONE__CASCADE;
+ }
+
+
+ // ********** ManyToOneMappingAnnotation implementation **********
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setOptional_(Boolean optional) {
+ Boolean old = this.optional;
+ this.optional = optional;
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
+ }
+
+ private Boolean buildOptional() {
+ return (Boolean) this.getJdtMemberValue(JPA.MANY_TO_ONE__OPTIONAL);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
new file mode 100644
index 0000000000..06cced26d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+
+/**
+ * javax.persistence.MapKey
+ */
+public final class BinaryMapKeyAnnotation
+ extends BinaryAnnotation
+ implements MapKeyAnnotation
+{
+ private String name;
+
+
+ public BinaryMapKeyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** MapKeyAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(JPA.MAP_KEY__NAME);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
new file mode 100644
index 0000000000..94053e7423
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+
+public final class BinaryMappedSuperclassAnnotation
+ extends BinaryAnnotation
+ implements MappedSuperclassAnnotation
+{
+ public BinaryMappedSuperclassAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
new file mode 100644
index 0000000000..a10b169070
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
+
+/**
+ * javax.persistence.Column
+ * javax.persistence.JoinColumn
+ * javax.persistence.DiscriminatorColumn
+ * javax.persistence.PrimaryKeyJoinColumn.
+ */
+public abstract class BinaryNamedColumnAnnotation
+ extends BinaryAnnotation
+ implements NamedColumnAnnotation
+{
+ private String name;
+ private String columnDefinition;
+
+
+ protected BinaryNamedColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.columnDefinition = this.buildColumnDefinition();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ this.setColumnDefinition_(this.buildColumnDefinition());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** NamedColumn implementation **********
+
+ public boolean isSpecified() {
+ return true;
+ }
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(this.getNameElementName());
+ }
+
+ protected abstract String getNameElementName();
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** column definition
+ public String getColumnDefinition() {
+ return null;
+ }
+
+ public void setColumnDefinition(String columnDefinition) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setColumnDefinition_(String columnDefinition) {
+ String old = this.columnDefinition;
+ this.columnDefinition = columnDefinition;
+ this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
+ }
+
+ private String buildColumnDefinition() {
+ return (String) this.getJdtMemberValue(this.getColumnDefinitionElementName());
+ }
+
+ protected abstract String getColumnDefinitionElementName();
+
+ public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
new file mode 100644
index 0000000000..2163b1fd50
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
+
+/**
+ * javax.persistence.NamedNativeQueries
+ */
+public final class BinaryNamedNativeQueriesAnnotation
+ extends BinaryContainerAnnotation<NestableNamedNativeQueryAnnotation>
+ implements NamedNativeQueriesAnnotation
+{
+ private final Vector<NestableNamedNativeQueryAnnotation> namedNativeQueries;
+
+
+ public BinaryNamedNativeQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.namedNativeQueries = this.buildNamedNativeQueries();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableNamedNativeQueryAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableNamedNativeQueryAnnotation>(this.namedNativeQueries);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ private Vector<NestableNamedNativeQueryAnnotation> buildNamedNativeQueries() {
+ Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_NATIVE_QUERIES__VALUE);
+ Vector<NestableNamedNativeQueryAnnotation> result = new Vector<NestableNamedNativeQueryAnnotation>(jdtQueries.length);
+ for (Object jdtQuery : jdtQueries) {
+ result.add(new BinaryNamedNativeQueryAnnotation(this, (IAnnotation) jdtQuery));
+ }
+ return result;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNamedNativeQueries();
+ }
+
+ // TODO
+ private void updateNamedNativeQueries() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
new file mode 100644
index 0000000000..dfd105b1b6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
+
+/**
+ * javax.persistence.NamedNativeQuery
+ */
+public final class BinaryNamedNativeQueryAnnotation
+ extends BinaryQueryAnnotation
+ implements NestableNamedNativeQueryAnnotation
+{
+ private String resultClass;
+ private String resultSetMapping;
+
+
+ public BinaryNamedNativeQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.resultClass = this.buildResultClass();
+ this.resultSetMapping = this.buildResultSetMapping();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setResultClass_(this.buildResultClass());
+ this.setResultSetMapping_(this.buildResultSetMapping());
+ }
+
+
+ // ********** BinaryBaseNamedQueryAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return JPA.NAMED_NATIVE_QUERY__NAME;
+ }
+
+ @Override
+ String getQueryElementName() {
+ return JPA.NAMED_NATIVE_QUERY__QUERY;
+ }
+
+ @Override
+ String getHintsElementName() {
+ return JPA.NAMED_NATIVE_QUERY__HINTS;
+ }
+
+
+ // ********** NamedNativeQueryAnnotation implementation **********
+
+ // ***** result class
+ public String getResultClass() {
+ return this.resultClass;
+ }
+
+ public void setResultClass(String resultClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setResultClass_(String resultClass) {
+ String old = this.resultClass;
+ this.resultClass = resultClass;
+ this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
+ }
+
+ private String buildResultClass() {
+ return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS);
+ }
+
+ public TextRange getResultClassTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fully-qualified result class name
+ public String getFullyQualifiedResultClassName() {
+ return this.resultClass;
+ }
+
+ // ***** result set mapping
+ public String getResultSetMapping() {
+ return this.resultSetMapping;
+ }
+
+ public void setResultSetMapping(String resultSetMapping) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setResultSetMapping_(String resultSetMapping) {
+ String old = this.resultSetMapping;
+ this.resultSetMapping = resultSetMapping;
+ this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping);
+ }
+
+ private String buildResultSetMapping() {
+ return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS);
+ }
+
+ public TextRange getResultSetMappingTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
new file mode 100644
index 0000000000..9c6a2e4965
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+
+/**
+ * javax.persistence.NamedQueries
+ */
+public abstract class BinaryNamedQueriesAnnotation
+ extends BinaryContainerAnnotation<NestableNamedQueryAnnotation>
+ implements NamedQueriesAnnotation
+{
+ private final Vector<NestableNamedQueryAnnotation> namedQueries;
+
+
+ public BinaryNamedQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.namedQueries = this.buildNamedQueries();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableNamedQueryAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableNamedQueryAnnotation>(this.namedQueries);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.namedQueries.size();
+ }
+
+ private Vector<NestableNamedQueryAnnotation> buildNamedQueries() {
+ Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_QUERIES__VALUE);
+ Vector<NestableNamedQueryAnnotation> result = new Vector<NestableNamedQueryAnnotation>(jdtQueries.length);
+ for (Object jdtQuery : jdtQueries) {
+ result.add(this.buildNamedQuery(jdtQuery));
+ }
+ return result;
+ }
+
+ protected abstract NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery);
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateNamedQueries();
+ }
+
+ // TODO
+ private void updateNamedQueries() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
new file mode 100644
index 0000000000..938575cbb0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+
+/**
+ * javax.persistence.NamedQuery
+ */
+public abstract class BinaryNamedQueryAnnotation
+ extends BinaryQueryAnnotation
+ implements NestableNamedQueryAnnotation
+{
+ public BinaryNamedQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryBaseNamedQueryAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return JPA.NAMED_QUERY__NAME;
+ }
+
+ @Override
+ String getQueryElementName() {
+ return JPA.NAMED_QUERY__QUERY;
+ }
+
+ @Override
+ String getHintsElementName() {
+ return JPA.NAMED_QUERY__HINTS;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java
new file mode 100644
index 0000000000..a6d04d9229
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AbstractJavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * Binary convenience methods
+ */
+// TODO hopefully this class can go away with some sort of refactoring of the
+// source and binary hierarchies...
+public abstract class BinaryNode
+ extends AbstractJavaResourceNode
+{
+
+ // ********** construction **********
+
+ protected BinaryNode(JavaResourceNode parent) {
+ super(parent);
+ }
+
+
+ // ********** JavaResourceNode implementation **********
+
+ @Override
+ public IFile getFile() {
+ return null; // only BinaryPackageFragmentRoot has a file...
+ }
+
+ public void update() {
+ // nothing by default
+ }
+
+ public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
new file mode 100644
index 0000000000..67775fa2aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToMany2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.OneToMany
+ */
+public final class BinaryOneToManyAnnotation
+ extends BinaryRelationshipMappingAnnotation
+ implements OneToMany2_0Annotation
+{
+ private String mappedBy;
+
+ private Boolean orphanRemoval; //added in JPA 2.0
+
+ public BinaryOneToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.mappedBy = this.buildMappedBy();
+ this.orphanRemoval = this.buildOrphanRemoval();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setMappedBy_(this.buildMappedBy());
+ this.setOrphanRemoval_(this.buildOrphanRemoval());
+ }
+
+
+ // ********** BinaryRelationshipMappingAnnotation implementation **********
+
+ @Override
+ String getTargetEntityElementName() {
+ return JPA.ONE_TO_MANY__TARGET_ENTITY;
+ }
+
+ @Override
+ String getFetchElementName() {
+ return JPA.ONE_TO_MANY__FETCH;
+ }
+
+ @Override
+ String getCascadeElementName() {
+ return JPA.ONE_TO_MANY__CASCADE;
+ }
+
+
+ //**************** OwnableRelationshipMappingAnnotation implementation **************
+
+ // ***** mapped by
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String mappedBy) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setMappedBy_(String mappedBy) {
+ String old = this.mappedBy;
+ this.mappedBy = mappedBy;
+ this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
+ }
+
+ private String buildMappedBy() {
+ return (String) this.getJdtMemberValue(JPA.ONE_TO_MANY__MAPPED_BY);
+ }
+
+ public TextRange getMappedByTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** OneToMany2_0Annotation implementation **********
+
+ public Boolean getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ public void setOrphanRemoval(Boolean orphanRemoval) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Boolean buildOrphanRemoval() {
+ return (Boolean) this.getJdtMemberValue(JPA2_0.ONE_TO_MANY__ORPHAN_REMOVAL);
+ }
+
+ private void setOrphanRemoval_(Boolean orphanRemoval) {
+ Boolean old = this.orphanRemoval;
+ this.orphanRemoval = orphanRemoval;
+ this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
new file mode 100644
index 0000000000..ac9bce72a0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToOne2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.OneToOne
+ */
+public class BinaryOneToOneAnnotation
+ extends BinaryRelationshipMappingAnnotation
+ implements OneToOne2_0Annotation
+{
+ private Boolean optional;
+ private String mappedBy;
+ private Boolean orphanRemoval; //added in JPA 2.0
+
+ public BinaryOneToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.optional = this.buildOptional();
+ this.mappedBy = this.buildMappedBy();
+ this.orphanRemoval = this.buildOrphanRemoval();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setOptional_(this.buildOptional());
+ this.setMappedBy_(this.buildMappedBy());
+ this.setOrphanRemoval_(this.buildOrphanRemoval());
+ }
+
+
+ // ********** BinaryRelationshipMappingAnnotation implementation **********
+
+ @Override
+ String getTargetEntityElementName() {
+ return JPA.ONE_TO_ONE__TARGET_ENTITY;
+ }
+
+ @Override
+ String getFetchElementName() {
+ return JPA.ONE_TO_ONE__FETCH;
+ }
+
+ @Override
+ String getCascadeElementName() {
+ return JPA.ONE_TO_ONE__CASCADE;
+ }
+
+
+ //**************** OwnableRelationshipMappingAnnotation implementation **************
+
+ // ***** mapped by
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String mappedBy) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setMappedBy_(String mappedBy) {
+ String old = this.mappedBy;
+ this.mappedBy = mappedBy;
+ this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
+ }
+
+ private String buildMappedBy() {
+ return (String) this.getJdtMemberValue(JPA.ONE_TO_ONE__MAPPED_BY);
+ }
+
+ public TextRange getMappedByTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ //**************** OneToOneAnnotation implementation **************
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setOptional_(Boolean optional) {
+ Boolean old = this.optional;
+ this.optional = optional;
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
+ }
+
+ private Boolean buildOptional() {
+ return (Boolean) this.getJdtMemberValue(JPA.ONE_TO_ONE__OPTIONAL);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** OneToOne2_0Annotation implementation **********
+
+ public Boolean getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ public void setOrphanRemoval(Boolean orphanRemoval) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Boolean buildOrphanRemoval() {
+ return (Boolean) this.getJdtMemberValue(JPA2_0.ONE_TO_ONE__ORPHAN_REMOVAL);
+ }
+
+ private void setOrphanRemoval_(Boolean orphanRemoval) {
+ Boolean old = this.orphanRemoval;
+ this.orphanRemoval = orphanRemoval;
+ this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
new file mode 100644
index 0000000000..1f9df3c60c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
+
+/**
+ * javax.persistence.OrderBy
+ */
+public final class BinaryOrderByAnnotation
+ extends BinaryAnnotation
+ implements OrderByAnnotation
+{
+ private String value;
+
+
+ public BinaryOrderByAnnotation(JavaResourcePersistentAttribute parent, IAnnotation annotation) {
+ super(parent, annotation);
+ this.value = this.buildValue();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** OrderByAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA.ORDER_BY__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
new file mode 100644
index 0000000000..642e936e55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
+
+/**
+ * Common behavior for
+ * javax.persistence.AttributeOverride
+ * javax.persistence.AssociationOverride
+ */
+public abstract class BinaryOverrideAnnotation
+ extends BinaryAnnotation
+ implements OverrideAnnotation
+{
+ private String name;
+
+
+ public BinaryOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** OverrideAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(this.getNameElementName());
+ }
+
+ protected abstract String getNameElementName();
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java
new file mode 100644
index 0000000000..cc8623e16f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceClassFile;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragment;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * binary package fragment
+ */
+final class BinaryPackageFragment
+ extends BinaryNode
+ implements JavaResourcePackageFragment
+{
+ /** JDT package fragment */
+ private final IPackageFragment packageFragment;
+
+ /**
+ * class files in the package fragment;
+ * we only hold class files/types that are actually annotated;
+ * if the unannotated types are needed (e.g. for orm.xml or an
+ * inheritance tree) they can be discovered on the classpath as needed
+ */
+ private final Vector<JavaResourceClassFile> classFiles = new Vector<JavaResourceClassFile>();
+
+
+ // ********** construction/initialization **********
+
+ BinaryPackageFragment(JavaResourcePackageFragmentRoot parent, IPackageFragment packageFragment) {
+ super(parent);
+ this.packageFragment = packageFragment;
+ this.classFiles.addAll(this.buildClassFiles());
+ }
+
+ private Collection<JavaResourceClassFile> buildClassFiles() {
+ IJavaElement[] children = this.getJDTChildren();
+ ArrayList<JavaResourceClassFile> result = new ArrayList<JavaResourceClassFile>(children.length);
+ for (IJavaElement child : children) {
+ IClassFile jdtClassFile = (IClassFile) child;
+ IType jdtType = jdtClassFile.getType();
+ if (BinaryPersistentType.typeIsPersistable(jdtType)) {
+ JavaResourceClassFile classFile = new BinaryClassFile(this, jdtClassFile, jdtType);
+ if (classFile.getPersistentType().isAnnotated()) { // we only hold annotated types
+ result.add(classFile);
+ }
+ }
+ }
+ return result;
+ }
+
+
+ // ********** JarResourceNode implementation **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateClassFiles();
+ }
+
+ // TODO
+ private void updateClassFiles() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** JavaResourcePackageFragment implementation **********
+
+ public ListIterator<JavaResourceClassFile> classFiles() {
+ return new CloneListIterator<JavaResourceClassFile>(this.classFiles);
+ }
+
+ public int classFilesSize() {
+ return this.classFiles.size();
+ }
+
+ public Iterator<JavaResourcePersistentType> persistedTypes() {
+ return new TransformationIterator<JavaResourceClassFile, JavaResourcePersistentType>(this.classFiles()) {
+ @Override
+ protected JavaResourcePersistentType transform(JavaResourceClassFile classFile) {
+ return classFile.getPersistentType(); // we only hold annotated types
+ }
+ };
+ }
+
+
+ // ********** misc **********
+
+ private IJavaElement[] getJDTChildren() {
+ try {
+ return this.packageFragment.getChildren();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return EMPTY_JAVA_ELEMENT_ARRAY;
+ }
+ }
+ protected static final IJavaElement[] EMPTY_JAVA_ELEMENT_ARRAY = new IJavaElement[0];
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.packageFragment.getElementName());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
new file mode 100644
index 0000000000..e941d2b7e0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragment;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * binary package fragment root
+ */
+public final class BinaryPackageFragmentRoot
+ extends RootBinaryNode
+ implements JavaResourcePackageFragmentRoot
+{
+ /** JDT package fragment root */
+ private final IPackageFragmentRoot packageFragmentRoot;
+
+ /** package fragments in the JAR */
+ private final Vector<JavaResourcePackageFragment> packageFragments = new Vector<JavaResourcePackageFragment>();
+
+
+ // ********** construction/initialization **********
+
+ public BinaryPackageFragmentRoot(IPackageFragmentRoot packageFragmentRoot, JpaAnnotationProvider annotationProvider) {
+ super(null, annotationProvider); // the package fragment root is the root of its sub-tree
+ this.packageFragmentRoot = packageFragmentRoot;
+ this.packageFragments.addAll(this.buildPackageFragments());
+ }
+
+ private Collection<JavaResourcePackageFragment> buildPackageFragments() {
+ IJavaElement[] jdtChildren = this.getJDTChildren();
+ ArrayList<JavaResourcePackageFragment> result = new ArrayList<JavaResourcePackageFragment>(jdtChildren.length);
+ for (IJavaElement child : jdtChildren) {
+ result.add(new BinaryPackageFragment(this, (IPackageFragment) child));
+ }
+ return result;
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ public IFile getFile() {
+ return (IFile) this.packageFragmentRoot.getResource();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updatePackageFragments();
+ }
+
+ // TODO
+ private void updatePackageFragments() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** JavaResourceNode.Root implementation **********
+
+ /**
+ * NB: we hold only annotated types
+ */
+ public Iterator<JavaResourcePersistentType> persistentTypes() {
+ return new CompositeIterator<JavaResourcePersistentType>(this.persistedTypesLists());
+ }
+
+ private Iterator<Iterator<JavaResourcePersistentType>> persistedTypesLists() {
+ return new TransformationIterator<JavaResourcePackageFragment, Iterator<JavaResourcePersistentType>>(this.packageFragments()) {
+ @Override
+ protected Iterator<JavaResourcePersistentType> transform(JavaResourcePackageFragment fragment) {
+ return fragment.persistedTypes();
+ }
+ };
+ }
+
+
+ // ********** JavaResourcePackageFragmentRoot implementation **********
+
+ public Iterator<JavaResourcePackageFragment> packageFragments() {
+ return new CloneIterator<JavaResourcePackageFragment>(this.packageFragments);
+ }
+
+ public int packageFragmentsSize() {
+ return this.packageFragments.size();
+ }
+
+
+ // ********** misc **********
+
+ private IJavaElement[] getJDTChildren() {
+ return JDTTools.getJDTChildren(this.packageFragmentRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java
new file mode 100644
index 0000000000..5dd4678578
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java
@@ -0,0 +1,657 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools;
+import org.eclipse.jpt.common.utility.MethodSignature;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.NameTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * binary persistent attribute (field or property)
+ */
+final class BinaryPersistentAttribute
+ extends BinaryPersistentMember
+ implements JavaResourcePersistentAttribute
+{
+ private int modifiers;
+
+ private String typeName;
+
+ private boolean typeIsInterface;
+
+ private boolean typeIsEnum;
+
+ private final Vector<String> typeSuperclassNames = new Vector<String>();
+
+ private final Vector<String> typeInterfaceNames = new Vector<String>();
+
+ private final Vector<String> typeTypeArgumentNames = new Vector<String>();
+
+
+ BinaryPersistentAttribute(JavaResourcePersistentType parent, IField field) {
+ this(parent, new FieldAdapter(field));
+ }
+
+ BinaryPersistentAttribute(JavaResourcePersistentType parent, IMethod method) {
+ this(parent, new MethodAdapter(method));
+ }
+
+ private BinaryPersistentAttribute(JavaResourcePersistentType parent, Adapter adapter) {
+ super(parent, adapter);
+ this.modifiers = this.buildModifiers();
+ this.typeName = this.buildTypeName();
+
+ IType type = this.getType(); // shouldn't be an array...
+ this.typeIsInterface = this.buildTypeIsInterface(type);
+ this.typeIsEnum = this.buildTypeIsEnum(type);
+ this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(type));
+ this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(type));
+
+ this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames());
+ }
+
+
+ // ******** overrides ********
+
+ @Override
+ public void update() {
+ super.update();
+ this.setModifiers(this.buildModifiers());
+ this.setTypeName(this.buildTypeName());
+
+ IType type = this.getType(); // shouldn't be an array...
+ this.setTypeIsInterface(this.buildTypeIsInterface(type));
+ this.setTypeIsEnum(this.buildTypeIsEnum(type));
+ this.setTypeSuperclassNames(this.buildTypeSuperclassNames(type));
+ this.setTypeInterfaceNames(this.buildTypeInterfaceNames(type));
+
+ this.setTypeTypeArgumentNames(this.buildTypeTypeArgumentNames());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+
+
+ // ********** BinaryPersistentMember implementation **********
+
+ private Adapter getAdapter() {
+ return (Adapter) this.adapter;
+ }
+
+ @Override
+ Iterator<String> validAnnotationNames() {
+ return this.getAnnotationProvider().attributeAnnotationNames();
+ }
+
+ @Override
+ Annotation buildAnnotation(IAnnotation jdtAnnotation) {
+ return this.getAnnotationProvider().buildAttributeAnnotation(this, jdtAnnotation);
+ }
+
+ Annotation buildNullAnnotation_(String annotationName) {
+ return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
+ }
+
+
+ // ********** JavaResourcePersistentAttribute implementation **********
+
+ @Override
+ public JavaResourcePersistentType getParent() {
+ return (JavaResourcePersistentType) super.getParent();
+ }
+
+ public JavaResourcePersistentType getResourcePersistentType() {
+ return this.getParent();
+ }
+
+ public String getName() {
+ return this.getAdapter().getAttributeName();
+ }
+
+ @Override
+ public Annotation buildNullAnnotation(String annotationName) {
+ return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
+ }
+
+ public boolean isField() {
+ return this.getAdapter().isField();
+ }
+
+ public boolean isProperty() {
+ return ! this.isField();
+ }
+
+ public boolean isFor(MethodSignature methodSignature, int occurrence) {
+ throw new UnsupportedOperationException();
+ }
+
+ public AccessType getSpecifiedAccess() {
+ Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
+ return accessAnnotation == null ? null : accessAnnotation.getValue();
+ }
+
+ public boolean typeIsSubTypeOf(String tn) {
+ return ((this.typeName != null) && this.typeName.equals(tn))
+ || this.typeInterfaceNames.contains(tn)
+ || this.typeSuperclassNames.contains(tn);
+ }
+
+ public boolean typeIsVariablePrimitive() {
+ return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName);
+ }
+
+ // ***** modifiers
+ public int getModifiers() {
+ return this.modifiers;
+ }
+
+ private void setModifiers(int modifiers) {
+ int old = this.modifiers;
+ this.modifiers = modifiers;
+ this.firePropertyChanged(MODIFIERS_PROPERTY, old, modifiers);
+ }
+
+ /**
+ * zero seems like a reasonable default...
+ */
+ private int buildModifiers() {
+ try {
+ return this.getMember().getFlags();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return 0;
+ }
+ }
+
+ // ***** type name
+ public String getTypeName() {
+ return this.typeName;
+ }
+
+ private void setTypeName(String typeName) {
+ String old = this.typeName;
+ this.typeName = typeName;
+ this.firePropertyChanged(TYPE_NAME_PROPERTY, old, typeName);
+ }
+
+ /**
+ * JARs don't have array types;
+ * also, no generic type parameters
+ */
+ private String buildTypeName() {
+ return convertTypeSignatureToTypeName(this.getTypeSignature());
+ }
+
+ // ***** type is interface
+ public boolean typeIsInterface() {
+ return this.typeIsInterface;
+ }
+
+ private void setTypeIsInterface(boolean typeIsInterface) {
+ boolean old = this.typeIsInterface;
+ this.typeIsInterface = typeIsInterface;
+ this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, typeIsInterface);
+ }
+
+ private boolean buildTypeIsInterface(IType type) {
+ try {
+ return (type != null) && type.isInterface();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ // ***** type is enum
+ public boolean typeIsEnum() {
+ return this.typeIsEnum;
+ }
+
+ private void setTypeIsEnum(boolean typeIsEnum) {
+ boolean old = this.typeIsEnum;
+ this.typeIsEnum = typeIsEnum;
+ this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, typeIsEnum);
+ }
+
+ private boolean buildTypeIsEnum(IType type) {
+ try {
+ return (type != null) && type.isEnum();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ // ***** type superclass hierarchy
+ public ListIterator<String> typeSuperclassNames() {
+ return new CloneListIterator<String>(this.typeSuperclassNames);
+ }
+
+ public boolean typeSuperclassNamesContains(String superclassName) {
+ return this.typeSuperclassNames.contains(superclassName);
+ }
+
+ private void setTypeSuperclassNames(List<String> typeSuperclassNames) {
+ this.synchronizeList(typeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST);
+ }
+
+ private List<String> buildTypeSuperclassNames(IType type) {
+ if (type == null) {
+ return Collections.emptyList();
+ }
+
+ ArrayList<String> names = new ArrayList<String>();
+ type = this.findSuperclass(type);
+ while (type != null) {
+ names.add(type.getFullyQualifiedName('.')); // no parameters are included here
+ type = this.findSuperclass(type);
+ }
+ return names;
+ }
+
+ // ***** type interface hierarchy
+ public Iterator<String> typeInterfaceNames() {
+ return new CloneIterator<String>(this.typeInterfaceNames);
+ }
+
+ public boolean typeInterfaceNamesContains(String interfaceName) {
+ return this.typeInterfaceNames.contains(interfaceName);
+ }
+
+ private void setTypeInterfaceNames(Collection<String> typeInterfaceNames) {
+ this.synchronizeCollection(typeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION);
+ }
+
+ private Collection<String> buildTypeInterfaceNames(IType type) {
+ if (type == null) {
+ return Collections.emptySet();
+ }
+
+ HashSet<String> names = new HashSet<String>();
+ while (type != null) {
+ this.addInterfaceNamesTo(type, names);
+ type = this.findSuperclass(type);
+ }
+ return names;
+ }
+
+ private void addInterfaceNamesTo(IType type, HashSet<String> names) {
+ for (String interfaceSignature : this.getSuperInterfaceTypeSignatures(type)) {
+ String interfaceName = convertTypeSignatureToTypeName(interfaceSignature);
+ names.add(interfaceName);
+ IType interfaceType = this.findType(interfaceName);
+ if (interfaceType != null) {
+ this.addInterfaceNamesTo(interfaceType, names); // recurse
+ }
+ }
+ }
+
+ // ***** type type argument names
+ public ListIterator<String> typeTypeArgumentNames() {
+ return new CloneListIterator<String>(this.typeTypeArgumentNames);
+ }
+
+ public int typeTypeArgumentNamesSize() {
+ return this.typeTypeArgumentNames.size();
+ }
+
+ public String getTypeTypeArgumentName(int index) {
+ return this.typeTypeArgumentNames.get(index);
+ }
+
+ private void setTypeTypeArgumentNames(List<String> typeTypeArgumentNames) {
+ this.synchronizeList(typeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST);
+ }
+
+ /**
+ * these types can be arrays (e.g. "java.lang.String[]");
+ * but they won't have any further nested generic type arguments
+ * (e.g. "java.util.Collection<java.lang.String>")
+ */
+ private List<String> buildTypeTypeArgumentNames() {
+ String typeSignature = this.getTypeSignature();
+ if (typeSignature == null) {
+ return Collections.emptyList();
+ }
+
+ String[] typeArgumentSignatures = Signature.getTypeArguments(typeSignature);
+ if (typeArgumentSignatures.length == 0) {
+ return Collections.emptyList();
+ }
+
+ ArrayList<String> names = new ArrayList<String>(typeArgumentSignatures.length);
+ for (String typeArgumentSignature : typeArgumentSignatures) {
+ names.add(convertTypeSignatureToTypeName(typeArgumentSignature));
+ }
+ return names;
+ }
+
+
+ // ********** convenience methods **********
+
+ private String getTypeSignature() {
+ try {
+ return this.getAdapter().getTypeSignature();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ private IType findSuperclass(IType type) {
+ return this.findTypeBySignature(this.getSuperclassSignature(type));
+ }
+
+ private String getSuperclassSignature(IType type) {
+ try {
+ return type.getSuperclassTypeSignature();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ private String[] getSuperInterfaceTypeSignatures(IType type) {
+ try {
+ return type.getSuperInterfaceTypeSignatures();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return StringTools.EMPTY_STRING_ARRAY;
+ }
+ }
+
+ private IType findTypeBySignature(String typeSignature) {
+ return (typeSignature == null) ? null : this.findType(convertTypeSignatureToTypeName_(typeSignature));
+ }
+
+ private IType getType() {
+ return (this.typeName == null) ? null : this.findType(this.typeName);
+ }
+
+ private IType findType(String fullyQualifiedName) {
+ try {
+ return this.getJavaProject().findType(fullyQualifiedName);
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ private IJavaProject getJavaProject() {
+ return this.getMember().getJavaProject();
+ }
+
+
+
+ // ********** adapters **********
+
+ /**
+ * Adapt an IField or IMethod.
+ */
+ interface Adapter
+ extends BinaryPersistentMember.Adapter
+ {
+ /**
+ * Return the field or getter method's "attribute" name
+ * (e.g. field "foo" -> "foo"; method "getFoo" -> "foo").
+ */
+ String getAttributeName();
+
+ /**
+ * Return whether the attribute is a Java field (as opposed to a method).
+ */
+ boolean isField();
+
+ /**
+ * Return the attribute's type signature.
+ */
+ String getTypeSignature() throws JavaModelException;
+ }
+
+ /**
+ * IField adapter
+ */
+ static class FieldAdapter
+ implements Adapter
+ {
+ final IField field;
+
+ FieldAdapter(IField field) {
+ super();
+ this.field = field;
+ }
+
+ public IField getElement() {
+ return this.field;
+ }
+
+ public boolean isPersistable() {
+ return this.field.exists() && JPTTools.fieldIsPersistable(new JPTToolsAdapter());
+ }
+
+ public IAnnotation[] getAnnotations() throws JavaModelException {
+ return this.field.getAnnotations();
+ }
+
+ public String getAttributeName() {
+ return this.field.getElementName();
+ }
+
+ public boolean isField() {
+ return true;
+ }
+
+ public String getTypeSignature() throws JavaModelException {
+ return this.field.getTypeSignature();
+ }
+
+ /**
+ * JPTTools needs an adapter so it can work with either an IField
+ * or an IVariableBinding etc.
+ */
+ class JPTToolsAdapter implements JPTTools.FieldAdapter {
+ public int getModifiers() {
+ try {
+ return FieldAdapter.this.field.getFlags();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return 0;
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * IMethod adapter
+ */
+ static class MethodAdapter
+ implements Adapter
+ {
+ final IMethod method;
+ static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0];
+
+ MethodAdapter(IMethod method) {
+ super();
+ this.method = method;
+ }
+
+ public IMethod getElement() {
+ return this.method;
+ }
+
+ public boolean isPersistable() {
+ return JPTTools.methodIsPersistablePropertyGetter(new JPTToolsAdapter());
+ }
+
+ public IAnnotation[] getAnnotations() throws JavaModelException {
+ return this.method.getAnnotations();
+ }
+
+ public String getAttributeName() {
+ return NameTools.convertGetterSetterMethodNameToPropertyName(this.method.getElementName());
+ }
+
+ public boolean isField() {
+ return false;
+ }
+
+ public String getTypeSignature() throws JavaModelException {
+ return this.method.getReturnType();
+ }
+
+ /**
+ * JPTTools needs an adapter so it can work with either an IMethod
+ * or an IMethodBinding etc.
+ */
+ abstract static class AbstractJPTToolsAdapter
+ implements JPTTools.SimpleMethodAdapter
+ {
+ AbstractJPTToolsAdapter() {
+ super();
+ }
+
+ abstract IMethod getMethod();
+
+ public int getModifiers() {
+ try {
+ return this.getMethod().getFlags();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return 0;
+ }
+ }
+
+ public String getReturnTypeErasureName() {
+ return convertTypeSignatureToTypeName(this.getReturnTypeSignature());
+ }
+
+ private String getReturnTypeSignature() {
+ try {
+ return this.getMethod().getReturnType();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ public boolean isConstructor() {
+ try {
+ return this.getMethod().isConstructor();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ }
+
+ static class SimpleJPTToolsAdapter
+ extends AbstractJPTToolsAdapter
+ {
+ private final IMethod method;
+
+ SimpleJPTToolsAdapter(IMethod method) {
+ super();
+ this.method = method;
+ }
+
+ @Override
+ IMethod getMethod() {
+ return this.method;
+ }
+
+ }
+
+ class JPTToolsAdapter
+ extends AbstractJPTToolsAdapter
+ implements JPTTools.MethodAdapter
+ {
+ JPTToolsAdapter() {
+ super();
+ }
+
+ @Override
+ IMethod getMethod() {
+ return MethodAdapter.this.method;
+ }
+
+ public String getName() {
+ return this.getMethod().getElementName();
+ }
+
+ public int getParametersLength() {
+ return this.getMethod().getParameterTypes().length;
+ }
+
+ public JPTTools.SimpleMethodAdapter getSibling(String name) {
+ for (IMethod sibling : this.getSiblings()) {
+ if ((sibling.getParameterTypes().length == 0)
+ && sibling.getElementName().equals(name)) {
+ return new SimpleJPTToolsAdapter(sibling);
+ }
+ }
+ return null;
+ }
+
+ public JPTTools.SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName) {
+ for (IMethod sibling : this.getSiblings()) {
+ String[] parmTypes = sibling.getParameterTypes();
+ if ((parmTypes.length == 1)
+ && sibling.getElementName().equals(name)
+ && convertTypeSignatureToTypeName(parmTypes[0]).equals(parameterTypeErasureName)) {
+ return new SimpleJPTToolsAdapter(sibling);
+ }
+ }
+ return null;
+ }
+
+ private IMethod[] getSiblings() {
+ try {
+ return this.getMethod().getDeclaringType().getMethods();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return EMPTY_METHOD_ARRAY;
+ }
+ }
+
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java
new file mode 100644
index 0000000000..90fc759dca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * binary persistent member
+ */
+abstract class BinaryPersistentMember
+ extends BinaryAnnotatedElement
+ implements JavaResourcePersistentMember
+{
+
+ boolean persistable;
+
+ private boolean final_; // 'final' is a reserved word
+
+
+ // ********** construction/initialization **********
+
+ public BinaryPersistentMember(JavaResourceNode parent, Adapter adapter) {
+ super(parent, adapter);
+ this.persistable = this.buildPersistable();
+ this.final_ = this.buildFinal();
+ }
+
+
+ private Adapter getAdapter() {
+ return (Adapter) this.adapter;
+ }
+
+ // ********** updating **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.setPersistable(this.buildPersistable());
+ this.setFinal(this.buildFinal());
+ }
+
+
+ // ********** simple state **********
+
+ public boolean isPersistable() {
+ return this.persistable;
+ }
+
+ private void setPersistable(boolean persistable) {
+ boolean old = this.persistable;
+ this.persistable = persistable;
+ this.firePropertyChanged(PERSISTABLE_PROPERTY, old, persistable);
+ }
+
+ private boolean buildPersistable() {
+ return this.getAdapter().isPersistable();
+ }
+
+ // ***** final
+ public boolean isFinal() {
+ return this.final_;
+ }
+
+ private void setFinal(boolean final_) {
+ boolean old = this.final_;
+ this.final_ = final_;
+ this.firePropertyChanged(FINAL_PROPERTY, old, final_);
+ }
+
+ private boolean buildFinal() {
+ try {
+ return Flags.isFinal(this.getMember().getFlags());
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+
+ // ********** miscellaneous **********
+
+ IMember getMember() {
+ return (IMember) this.adapter.getElement();
+ }
+
+ /**
+ * convenience method
+ */
+ <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) {
+ @SuppressWarnings("unchecked")
+ Filter<T> filter = (Filter<T>) PERSISTABLE_MEMBER_FILTER;
+ return new FilteringIterator<T>(members, filter);
+ }
+
+ /**
+ * Strip off the type signature's parameters if present.
+ * Convert to a readable string.
+ */
+ static String convertTypeSignatureToTypeName(String typeSignature) {
+ return (typeSignature == null) ? null : convertTypeSignatureToTypeName_(typeSignature);
+ }
+
+ /**
+ * no null check
+ */
+ static String convertTypeSignatureToTypeName_(String typeSignature) {
+ return Signature.toString(Signature.getTypeErasure(typeSignature));
+ }
+
+
+ // ********** IMember adapter **********
+
+ interface Adapter extends BinaryAnnotatedElement.Adapter {
+ /**
+ * Return the adapter's JDT member (IType, IField, IMethod).
+ */
+ IMember getElement();
+
+ /**
+ * Return whether the adapter's member is "persistable"
+ * (i.e. according to the JPA spec the member can be mapped)
+ */
+ boolean isPersistable();
+ }
+
+
+ // ********** unsupported JavaResourceAnnotatedElement implementation **********
+
+ @Override
+ public Annotation addAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void resolveTypes(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isFor(String memberName, int occurrence) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java
new file mode 100644
index 0000000000..b14ac9804a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java
@@ -0,0 +1,694 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools;
+import org.eclipse.jpt.common.utility.MethodSignature;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * binary persistent type
+ */
+final class BinaryPersistentType
+ extends BinaryPersistentMember
+ implements JavaResourcePersistentType2_0
+{
+ private String name;
+
+ private String qualifiedName;
+
+ private String packageName;
+
+ private String superclassQualifiedName;
+
+ private String declaringTypeName;
+
+ private boolean abstract_; // 'abstract' is a reserved word
+
+ private boolean static_; // 'static' is a reserved word
+
+ private boolean memberType;
+
+ private boolean hasPrivateNoArgConstructor;
+
+ private boolean hasNoArgConstructor;
+
+ private final Vector<JavaResourcePersistentAttribute> fields;
+
+ private final Vector<JavaResourcePersistentAttribute> methods;
+
+
+ // ********** construction/initialization **********
+
+ BinaryPersistentType(JavaResourceNode parent, IType type) {
+ super(parent, new TypeAdapter(type));
+ this.name = this.buildName();
+ this.qualifiedName = this.buildQualifiedName();
+ this.packageName = this.buildPackageName();
+ this.superclassQualifiedName = this.buildSuperclassQualifiedName();
+ this.declaringTypeName = this.buildDeclaringTypeName();
+ this.abstract_ = this.buildAbstract();
+ this.static_ = this.buildStatic();
+ this.memberType = this.buildMemberType();
+ this.hasNoArgConstructor = this.buildHasNoArgConstructor();
+ this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor();
+ this.fields = this.buildFields();
+ this.methods = this.buildMethods();
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName(this.buildName());
+ this.setQualifiedName(this.buildQualifiedName());
+ this.setPackageName(this.buildPackageName());
+ this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName());
+ this.setDeclaringTypeName(this.buildDeclaringTypeName());
+ this.setAbstract(this.buildAbstract());
+ this.setStatic(this.buildStatic());
+ this.setMemberType(this.buildMemberType());
+ this.setHasNoArgConstructor(this.buildHasNoArgConstructor());
+ this.setHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor());
+ this.updateFields();
+ this.updateMethods();
+ }
+
+ // TODO
+ private void updateFields() {
+ throw new UnsupportedOperationException();
+ }
+
+ // TODO
+ private void updateMethods() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** BinaryPersistentMember implementation **********
+
+ @Override
+ Annotation buildAnnotation(IAnnotation jdtAnnotation) {
+ return this.getAnnotationProvider().buildTypeAnnotation(this, jdtAnnotation);
+ }
+
+ @Override
+ Annotation buildNullAnnotation(String annotationName) {
+ return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName);
+ }
+
+ @Override
+ Iterator<String> validAnnotationNames() {
+ return this.getAnnotationProvider().typeAnnotationNames();
+ }
+
+
+ // ********** JavaResourcePersistentType implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ private void setName(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return this.getMember().getElementName();
+ }
+
+ // ***** qualified name
+ public String getQualifiedName() {
+ return this.qualifiedName;
+ }
+
+ private void setQualifiedName(String qualifiedName) {
+ String old = this.qualifiedName;
+ this.qualifiedName = qualifiedName;
+ this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, qualifiedName);
+ }
+
+ private String buildQualifiedName() {
+ return this.getMember().getFullyQualifiedName('.'); // no parameters are included here
+ }
+
+ // ***** package
+ public String getPackageName() {
+ return this.packageName;
+ }
+
+ private void setPackageName(String packageName) {
+ String old = this.packageName;
+ this.packageName = packageName;
+ this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, packageName);
+ }
+
+ private String buildPackageName() {
+ return this.getMember().getPackageFragment().getElementName();
+ }
+
+ public boolean isIn(IPackageFragment packageFragment) {
+ return StringTools.stringsAreEqual(packageFragment.getElementName(), this.packageName);
+ }
+
+ // ***** superclass qualified name
+ public String getSuperclassQualifiedName() {
+ return this.superclassQualifiedName;
+ }
+
+ private void setSuperclassQualifiedName(String superclassQualifiedName) {
+ String old = this.superclassQualifiedName;
+ this.superclassQualifiedName = superclassQualifiedName;
+ this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, superclassQualifiedName);
+ }
+
+ private String buildSuperclassQualifiedName() {
+ return convertTypeSignatureToTypeName(this.getSuperclassTypeSignature());
+ }
+
+ private String getSuperclassTypeSignature() {
+ try {
+ return this.getMember().getSuperclassTypeSignature();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return null;
+ }
+ }
+
+ // ***** declaring type name
+ public String getDeclaringTypeName() {
+ return this.declaringTypeName;
+ }
+
+ private void setDeclaringTypeName(String declaringTypeName) {
+ String old = this.declaringTypeName;
+ this.declaringTypeName = declaringTypeName;
+ this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, declaringTypeName);
+ }
+
+ private String buildDeclaringTypeName() {
+ IType declaringType = this.getMember().getDeclaringType();
+ return (declaringType == null) ? null : declaringType.getFullyQualifiedName('.'); // no parameters are included here
+ }
+
+ // ***** abstract
+ public boolean isAbstract() {
+ return this.abstract_;
+ }
+
+ private void setAbstract(boolean abstract_) {
+ boolean old = this.abstract_;
+ this.abstract_ = abstract_;
+ this.firePropertyChanged(ABSTRACT_PROPERTY, old, abstract_);
+ }
+
+ private boolean buildAbstract() {
+ try {
+ return Flags.isAbstract(this.getMember().getFlags());
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ // ***** static
+ public boolean isStatic() {
+ return this.static_;
+ }
+
+ private void setStatic(boolean static_) {
+ boolean old = this.static_;
+ this.static_ = static_;
+ this.firePropertyChanged(STATIC_PROPERTY, old, static_);
+ }
+
+ private boolean buildStatic() {
+ try {
+ return Flags.isStatic(this.getMember().getFlags());
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ // ***** member
+ public boolean isMemberType() {
+ return this.memberType;
+ }
+
+ private void setMemberType(boolean memberType) {
+ boolean old = this.memberType;
+ this.memberType = memberType;
+ this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, memberType);
+ }
+
+ private boolean buildMemberType() {
+ try {
+ return this.getMember().isMember();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ // ***** no-arg constructor
+ public boolean hasNoArgConstructor() {
+ return this.hasNoArgConstructor;
+ }
+
+ private void setHasNoArgConstructor(boolean hasNoArgConstructor) {
+ boolean old = this.hasNoArgConstructor;
+ this.hasNoArgConstructor = hasNoArgConstructor;
+ this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, hasNoArgConstructor);
+ }
+
+ private boolean buildHasNoArgConstructor() {
+ return this.findNoArgConstructor() != null;
+ }
+
+ private IMethod findNoArgConstructor() {
+ try {
+ for (IMethod method : this.getMember().getMethods()) {
+ if (method.isConstructor()) {
+ return method;
+ }
+ }
+ }
+ catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ return null;
+ }
+
+ // ***** private no-arg constructor
+ public boolean hasPrivateNoArgConstructor() {
+ return this.hasPrivateNoArgConstructor;
+ }
+
+ private void setHasPrivateNoArgConstructor(boolean hasPrivateNoArgConstructor) {
+ boolean old = this.hasPrivateNoArgConstructor;
+ this.hasPrivateNoArgConstructor = hasPrivateNoArgConstructor;
+ this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, hasPrivateNoArgConstructor);
+ }
+
+ private boolean buildHasPrivateNoArgConstructor() {
+ IMethod method = this.findNoArgConstructor();
+ try {
+ return method != null && Flags.isPrivate(method.getFlags());
+ }
+ catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+
+ // ********** misc **********
+
+ public boolean isMapped() {
+ for (Annotation each : CollectionTools.iterable(annotations())) {
+ if (CollectionTools.contains(
+ getAnnotationProvider().typeMappingAnnotationNames(),
+ each.getAnnotationName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * check only persistable attributes
+ */
+ public boolean hasAnyAnnotatedAttributes() {
+ for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) {
+ if (stream.next().isAnnotated()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public IType getMember() {
+ return (IType) super.getMember();
+ }
+
+
+ // ********** fields **********
+
+ public Iterator<JavaResourcePersistentAttribute> fields() {
+ return this.getFields().iterator();
+ }
+
+ private Iterable<JavaResourcePersistentAttribute> getFields() {
+ return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.fields);
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableFields() {
+ return this.persistableMembers(this.fields());
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() {
+ return new FilteringIterator<JavaResourcePersistentAttribute>(
+ this.persistableFields(),
+ FIELD_ACCESS_TYPE_FILTER
+ );
+ }
+
+ private void addField(JavaResourcePersistentAttribute field) {
+ this.addItemToCollection(field, this.fields, FIELDS_COLLECTION);
+ }
+
+ private JavaResourcePersistentAttribute getField(String fieldName, int occurrence) {
+ for (JavaResourcePersistentAttribute field : this.getFields()) {
+ if (field.isFor(fieldName, occurrence)) {
+ return field;
+ }
+ }
+ return null;
+ }
+
+ private void removeFields(Collection<JavaResourcePersistentAttribute> remove) {
+ this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION);
+ }
+
+ private Vector<JavaResourcePersistentAttribute> buildFields() {
+ IField[] jdtFields = this.getFields(this.getMember());
+ Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtFields.length);
+ for (IField jdtField : jdtFields) {
+ result.add(this.buildField(jdtField));
+ }
+ return result;
+ }
+
+ private IField[] getFields(IType type) {
+ try {
+ return type.getFields();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return EMPTY_FIELD_ARRAY;
+ }
+ }
+ private static final IField[] EMPTY_FIELD_ARRAY = new IField[0];
+
+ private JavaResourcePersistentAttribute buildField(IField jdtField) {
+ return new BinaryPersistentAttribute(this, jdtField);
+ }
+
+
+ // ********** methods **********
+
+ public Iterator<JavaResourcePersistentAttribute> methods() {
+ return this.getMethods().iterator();
+ }
+
+ private Iterable<JavaResourcePersistentAttribute> getMethods() {
+ return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.methods);
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableProperties() {
+ return persistableMembers(this.methods());
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() {
+ return new FilteringIterator<JavaResourcePersistentAttribute>(
+ this.persistableProperties(),
+ PROPERTY_ACCESS_TYPE_FILTER
+ );
+ }
+
+ private JavaResourcePersistentAttribute getMethod(MethodSignature signature, int occurrence) {
+ for (JavaResourcePersistentAttribute method : this.getMethods()) {
+ if (method.isFor(signature, occurrence)) {
+ return method;
+ }
+ }
+ return null;
+ }
+
+ private void addMethod(JavaResourcePersistentAttribute method) {
+ this.addItemToCollection(method, this.methods, METHODS_COLLECTION);
+ }
+
+ private void removeMethods(Collection<JavaResourcePersistentAttribute> remove) {
+ this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION);
+ }
+
+ private Vector<JavaResourcePersistentAttribute> buildMethods() {
+ IMethod[] jdtMethods = this.getMethods(this.getMember());
+ Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtMethods.length);
+ for (IMethod jdtMethod : jdtMethods) {
+ result.add(this.buildMethod(jdtMethod));
+ }
+ return result;
+ }
+
+ private IMethod[] getMethods(IType type) {
+ try {
+ return type.getMethods();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return EMPTY_METHOD_ARRAY;
+ }
+ }
+ private static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0];
+
+ private JavaResourcePersistentAttribute buildMethod(IMethod jdtMethod) {
+ return new BinaryPersistentAttribute(this, jdtMethod);
+ }
+
+
+ // ********** attributes **********
+
+ @SuppressWarnings("unchecked")
+ public Iterator<JavaResourcePersistentAttribute> persistableAttributes() {
+ return new CompositeIterator<JavaResourcePersistentAttribute>(
+ this.persistableFields(),
+ this.persistableProperties()
+ );
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess) {
+ switch (specifiedAccess) {
+ case FIELD :
+ return this.persistableAttributesForFieldAccessType();
+ case PROPERTY :
+ return this.persistableAttributesForPropertyAccessType();
+ default :
+ throw new IllegalArgumentException("unknown access: " + specifiedAccess); //$NON-NLS-1$
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private Iterator<JavaResourcePersistentAttribute> persistableAttributesForFieldAccessType() {
+ return new CompositeIterator<JavaResourcePersistentAttribute>(
+ this.persistableFields(),
+ this.persistablePropertiesWithSpecifiedPropertyAccess()
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ private Iterator<JavaResourcePersistentAttribute> persistableAttributesForPropertyAccessType() {
+ return new CompositeIterator<JavaResourcePersistentAttribute>(
+ this.persistableProperties(),
+ this.persistableFieldsWithSpecifiedFieldAccess()
+ );
+ }
+
+
+ // ********** IType adapter **********
+
+ static class TypeAdapter implements Adapter {
+ private final IType type;
+
+ TypeAdapter(IType type) {
+ super();
+ this.type = type;
+ }
+
+ public IType getElement() {
+ return this.type;
+ }
+
+ public boolean isPersistable() {
+ return true; // we only build a JAR type if it is "persistable"
+ }
+
+ public IAnnotation[] getAnnotations() throws JavaModelException {
+ return this.type.getAnnotations();
+ }
+
+ }
+
+
+ // ********** "persistable" check **********
+
+ static boolean typeIsPersistable(IType type) {
+ return (type != null)
+ && type.exists()
+ && JPTTools.typeIsPersistable(new JPTToolsAdapter(type));
+ }
+
+
+ // ********** JPT tools adapter **********
+
+ /**
+ * JPTTools needs an adapter so it can work with either an IType
+ * or an ITypeBinding etc.
+ */
+ static class JPTToolsAdapter implements JPTTools.TypeAdapter {
+ private final IType type;
+
+ protected JPTToolsAdapter(IType type) {
+ super();
+ if (type == null) {
+ throw new NullPointerException();
+ }
+ this.type = type;
+ }
+
+ public int getModifiers() {
+ try {
+ return this.type.getFlags();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return 0;
+ }
+ }
+
+ public boolean isAnnotation() {
+ try {
+ return this.type.isAnnotation();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ public boolean isAnonymous() {
+ try {
+ return this.type.isAnonymous();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ public boolean isArray() {
+ return false; // ???
+ }
+
+ public boolean isEnum() {
+ try {
+ return this.type.isEnum();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ public boolean isInterface() {
+ try {
+ return this.type.isInterface();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ public boolean isLocal() {
+ try {
+ return this.type.isLocal();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ public boolean isMember() {
+ try {
+ return this.type.isMember();
+ } catch (JavaModelException ex) {
+ JptJpaCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ public boolean isPrimitive() {
+ return false; // ???
+ }
+
+ }
+
+
+ // ********** unsupported JavaResourcePersistentType implementation **********
+
+ public Iterator<JavaResourcePersistentType> types() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator<JavaResourcePersistentType> allTypes() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator<JavaResourcePersistentType> persistableTypes() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isGeneratedMetamodelTopLevelType(IPackageFragmentRoot sourceFolder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isGeneratedMetamodelTopLevelType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isMetamodel() {
+ throw new UnsupportedOperationException();
+ }
+
+ public GeneratedAnnotation getGeneratedAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
new file mode 100644
index 0000000000..6452d7a519
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache;
+
+/**
+ * cache used to hold binary "external" Java resource persistent types
+ * (typically derived from JARs on the project's build path)
+ */
+public final class BinaryPersistentTypeCache
+ extends RootBinaryNode
+ implements JavaResourcePersistentTypeCache
+{
+ /** populated on-demand */
+ private final Vector<Entry> entries = new Vector<Entry>();
+
+
+ // ********** construction **********
+
+ public BinaryPersistentTypeCache(JpaAnnotationProvider annotationProvider) {
+ super(null, annotationProvider);
+ }
+
+
+ // ********** JavaResourceNode.Root implementation **********
+
+ public Iterator<JavaResourcePersistentType> persistentTypes() {
+ return this.getPersistentTypes().iterator();
+ }
+
+ private Iterable<JavaResourcePersistentType> getPersistentTypes() {
+ return new TransformationIterable<Entry, JavaResourcePersistentType>(this.getEntries()) {
+ @Override
+ protected JavaResourcePersistentType transform(Entry entry) {
+ return entry.persistentType;
+ }
+ };
+ }
+
+ private Iterable<Entry> getEntries() {
+ return new LiveCloneIterable<Entry>(this.entries);
+ }
+
+
+ // ********** JavaResourcePersistentTypeCache implementation **********
+
+ public int persistentTypesSize() {
+ return this.entries.size();
+ }
+
+ public JavaResourcePersistentType addPersistentType(IType jdtType) {
+ Entry entry = this.buildEntry(jdtType);
+ this.entries.add(entry);
+ this.fireItemAdded(PERSISTENT_TYPES_COLLECTION, entry.persistentType);
+ return entry.persistentType;
+ }
+
+ private Entry buildEntry(IType jdtType) {
+ return new Entry(this.buildPersistentType(jdtType), jdtType.getResource());
+ }
+
+ private JavaResourcePersistentType buildPersistentType(IType jdtType) {
+ return new BinaryPersistentType(this, jdtType);
+ }
+
+ public boolean removePersistentTypes(IFile jarFile) {
+ boolean modified = false;
+ for (Entry entry : this.getEntries()) {
+ IResource resource = entry.resource;
+ if ((resource != null) && resource.equals(jarFile)) {
+ this.removeEntry(entry);
+ modified = true;
+ }
+ }
+ return modified;
+ }
+
+ private void removeEntry(Entry entry) {
+ this.entries.remove(entry);
+ this.fireItemRemoved(PERSISTENT_TYPES_COLLECTION, entry.persistentType);
+ }
+
+
+ // ********** overrides **********
+
+ /**
+ * Ignore changes to this collection. Adds can be ignored since they are triggered
+ * by requests that will, themselves, trigger updates (typically during the
+ * update of an object that calls a setter with the newly-created resource
+ * type). Deletes will be accompanied by manual updates.
+ */
+ @Override
+ protected void aspectChanged(String aspectName) {
+ if ((aspectName != null) && ! aspectName.equals(PERSISTENT_TYPES_COLLECTION)) {
+ super.aspectChanged(aspectName);
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.entries);
+ }
+
+
+ // ********** cache entry **********
+
+ /**
+ * Associate a persistent type with its resource.
+ * This will be a JAR in the case of a type loaded from a JAR that is in
+ * the Eclipse workspace. The resource will be null for a type loaded
+ * from a JAR or class directory outside of the workspace.
+ */
+ static class Entry {
+ final JavaResourcePersistentType persistentType;
+ final IResource resource;
+
+ Entry(JavaResourcePersistentType persistentType, IResource resource) {
+ super();
+ this.persistentType = persistentType;
+ this.resource = resource;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.persistentType);
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
new file mode 100644
index 0000000000..9165a8395b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
+
+/**
+ * javax.persistence.PrimaryKeyJoinColumn
+ */
+public final class BinaryPrimaryKeyJoinColumnAnnotation
+ extends BinaryNamedColumnAnnotation
+ implements NestablePrimaryKeyJoinColumnAnnotation
+{
+ private String referencedColumnName;
+
+
+ public BinaryPrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.referencedColumnName = this.buildReferencedColumnName();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setReferencedColumnName_(this.buildReferencedColumnName());
+ }
+
+
+ // ********** BinaryNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** PrimaryKeyJoinColumnAnnotation implementation **********
+
+ // ***** referenced column name
+ public String getReferencedColumnName() {
+ return this.referencedColumnName;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setReferencedColumnName_(String referencedColumnName) {
+ String old = this.referencedColumnName;
+ this.referencedColumnName = referencedColumnName;
+ this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
+ }
+
+ private String buildReferencedColumnName() {
+ return (String) this.getJdtMemberValue(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
new file mode 100644
index 0000000000..e24dedd4c4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+
+/**
+ * javax.persistence.PrimaryKeyJoinColumns
+ */
+public final class BinaryPrimaryKeyJoinColumnsAnnotation
+ extends BinaryContainerAnnotation<NestablePrimaryKeyJoinColumnAnnotation>
+ implements PrimaryKeyJoinColumnsAnnotation
+{
+ private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns;
+
+
+ public BinaryPrimaryKeyJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.pkJoinColumns = this.buildPkJoinColumns();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.pkJoinColumns.size();
+ }
+
+ private Vector<NestablePrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() {
+ Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE);
+ Vector<NestablePrimaryKeyJoinColumnAnnotation> result = new Vector<NestablePrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length);
+ for (Object jdtJoinColumn : jdtJoinColumns) {
+ result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
+ }
+ return result;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updatePkJoinColumns();
+ }
+
+ // TODO
+ private void updatePkJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java
new file mode 100644
index 0000000000..bc528de494
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+
+/**
+ * javax.persistence.NamedQuery
+ * javax.persistence.NamedNativeQuery
+ */
+abstract class BinaryQueryAnnotation
+ extends BinaryAnnotation
+ implements QueryAnnotation
+{
+ String name;
+ String query;
+ final Vector<QueryHintAnnotation> hints;
+
+
+ BinaryQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.query = this.buildQuery();
+ this.hints = this.buildHints();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ this.setQuery_(this.buildQuery());
+ this.updateHints();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** BaseNamedQueryAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(this.getNameElementName());
+ }
+
+ abstract String getNameElementName();
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** query
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String query) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setQuery_(String query) {
+ String old = this.query;
+ this.query = query;
+ this.firePropertyChanged(QUERY_PROPERTY, old, query);
+ }
+
+ private String buildQuery() {
+ return (String) this.getJdtMemberValue(this.getQueryElementName());
+ }
+
+ abstract String getQueryElementName();
+
+ public TextRange getQueryTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** hints
+ public ListIterator<QueryHintAnnotation> hints() {
+ return new CloneListIterator<QueryHintAnnotation>(this.hints);
+ }
+
+ public int hintsSize() {
+ return this.hints.size();
+ }
+
+ public QueryHintAnnotation hintAt(int index) {
+ return this.hints.get(index);
+ }
+
+ public int indexOfHint(QueryHintAnnotation queryHint) {
+ return this.hints.indexOf(queryHint);
+ }
+
+ public QueryHintAnnotation addHint(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveHint(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeHint(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<QueryHintAnnotation> buildHints() {
+ Object[] jdtHints = this.getJdtMemberValues(this.getHintsElementName());
+ Vector<QueryHintAnnotation> result = new Vector<QueryHintAnnotation>(jdtHints.length);
+ for (Object jdtHint : jdtHints) {
+ result.add(new BinaryQueryHintAnnotation(this, (IAnnotation) jdtHint));
+ }
+ return result;
+ }
+
+ abstract String getHintsElementName();
+
+ // TODO
+ private void updateHints() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
new file mode 100644
index 0000000000..f1d4ac8f92
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+
+/**
+ * javax.persistence.QueryHint
+ */
+class BinaryQueryHintAnnotation
+ extends BinaryAnnotation
+ implements QueryHintAnnotation
+{
+ private String name;
+ private String value;
+
+
+ BinaryQueryHintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ this.setValue_(this.buildValue());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** QueryHintAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(JPA.QUERY_HINT__NAME);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA.QUERY_HINT__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
new file mode 100644
index 0000000000..365d2e5263
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.CascadeType;
+import org.eclipse.jpt.jpa.core.resource.java.FetchType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.ManyToMany
+ * javax.persistence.ManyToOne
+ * javax.persistence.OneToMany
+ * javax.persistence.OneToOne
+ */
+abstract class BinaryRelationshipMappingAnnotation
+ extends BinaryAnnotation
+ implements RelationshipMapping2_0Annotation
+{
+ String targetEntity;
+ FetchType fetch;
+ boolean cascadeAll;
+ boolean cascadeMerge;
+ boolean cascadePersist;
+ boolean cascadeRefresh;
+ boolean cascadeRemove;
+ boolean cascadeDetach; //added in JPA 2.0
+
+
+ BinaryRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.targetEntity = this.buildTargetEntity();
+ this.fetch = this.buildFetch();
+ this.initializeCascadeTypes(this.buildCascadeTypes());
+ }
+
+ protected void initializeCascadeTypes(CascadeType[] cascadeTypes) {
+ this.cascadeAll = ArrayTools.contains(cascadeTypes, CascadeType.ALL);
+ this.cascadeMerge = ArrayTools.contains(cascadeTypes, CascadeType.MERGE);
+ this.cascadePersist = ArrayTools.contains(cascadeTypes, CascadeType.PERSIST);
+ this.cascadeRefresh = ArrayTools.contains(cascadeTypes, CascadeType.REFRESH);
+ this.cascadeRemove = ArrayTools.contains(cascadeTypes, CascadeType.REMOVE);
+ this.cascadeDetach = ArrayTools.contains(cascadeTypes, CascadeType.DETACH);
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setTargetEntity_(this.buildTargetEntity());
+ this.setFetch_(this.buildFetch());
+ this.updateCascadeTypes(this.buildCascadeTypes());
+ }
+
+ protected void updateCascadeTypes(CascadeType[] cascadeTypes) {
+ this.setCascadeAll_(ArrayTools.contains(cascadeTypes, CascadeType.ALL));
+ this.setCascadeMerge_(ArrayTools.contains(cascadeTypes, CascadeType.MERGE));
+ this.setCascadePersist_(ArrayTools.contains(cascadeTypes, CascadeType.PERSIST));
+ this.setCascadeRefresh_(ArrayTools.contains(cascadeTypes, CascadeType.REFRESH));
+ this.setCascadeRemove_(ArrayTools.contains(cascadeTypes, CascadeType.REMOVE));
+ this.setCascadeDetach_(ArrayTools.contains(cascadeTypes, CascadeType.DETACH));
+ }
+
+ // ********** RelationshipMappingAnnotation implementation **********
+
+ // ***** target entity
+ public String getTargetEntity() {
+ return this.targetEntity;
+ }
+
+ public void setTargetEntity(String targetEntity) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setTargetEntity_(String targetEntity) {
+ String old = this.targetEntity;
+ this.targetEntity = targetEntity;
+ this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, targetEntity);
+ }
+
+ private String buildTargetEntity() {
+ return (String) this.getJdtMemberValue(this.getTargetEntityElementName());
+ }
+
+ abstract String getTargetEntityElementName();
+
+ public TextRange getTargetEntityTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** fully-qualified target entity class name
+ public String getFullyQualifiedTargetEntityClassName() {
+ return this.targetEntity;
+ }
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setFetch_(FetchType fetch) {
+ FetchType old = this.fetch;
+ this.fetch = fetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
+ }
+
+ private FetchType buildFetch() {
+ return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(this.getFetchElementName()));
+ }
+
+ abstract String getFetchElementName();
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** cascade
+ private CascadeType[] buildCascadeTypes() {
+ return CascadeType.fromJavaAnnotationValues(this.getJdtMemberValues(this.getCascadeElementName()));
+ }
+
+ abstract String getCascadeElementName();
+
+ public TextRange getCascadeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** cascade all
+ public boolean isCascadeAll() {
+ return this.cascadeAll;
+ }
+
+ public void setCascadeAll(boolean cascadeAll) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCascadeAll_(boolean cascadeAll) {
+ boolean old = this.cascadeAll;
+ this.cascadeAll = cascadeAll;
+ this.firePropertyChanged(CASCADE_ALL_PROPERTY, old, cascadeAll);
+ }
+
+ // ***** cascade merge
+ public boolean isCascadeMerge() {
+ return this.cascadeMerge;
+ }
+
+ public void setCascadeMerge(boolean cascadeMerge) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCascadeMerge_(boolean cascadeMerge) {
+ boolean old = this.cascadeMerge;
+ this.cascadeMerge = cascadeMerge;
+ this.firePropertyChanged(CASCADE_MERGE_PROPERTY, old, cascadeMerge);
+ }
+
+ // ***** cascade persist
+ public boolean isCascadePersist() {
+ return this.cascadePersist;
+ }
+
+ public void setCascadePersist(boolean cascadePersist) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCascadePersist_(boolean cascadePersist) {
+ boolean old = this.cascadePersist;
+ this.cascadePersist = cascadePersist;
+ this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist);
+ }
+
+ // ***** cascade refresh
+ public boolean isCascadeRefresh() {
+ return this.cascadeRefresh;
+ }
+
+ public void setCascadeRefresh(boolean cascadeRefresh) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCascadeRefresh_(boolean cascadeRefresh) {
+ boolean old = this.cascadeRefresh;
+ this.cascadeRefresh = cascadeRefresh;
+ this.firePropertyChanged(CASCADE_REFRESH_PROPERTY, old, cascadeRefresh);
+ }
+
+ // ***** cascade remove
+ public boolean isCascadeRemove() {
+ return this.cascadeRemove;
+ }
+
+ public void setCascadeRemove(boolean cascadeRemove) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCascadeRemove_(boolean cascadeRemove) {
+ boolean old = this.cascadeRemove;
+ this.cascadeRemove = cascadeRemove;
+ this.firePropertyChanged(CASCADE_REMOVE_PROPERTY, old, cascadeRemove);
+ }
+
+ // ***** cascade detach - JPA 2.0
+ public boolean isCascadeDetach() {
+ return this.cascadeDetach;
+ }
+
+ public void setCascadeDetach(boolean cascadeDetach) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCascadeDetach_(boolean cascadeDetach) {
+ boolean old = this.cascadeDetach;
+ this.cascadeDetach = cascadeDetach;
+ this.firePropertyChanged(CASCADE_DETACH_PROPERTY, old, cascadeDetach);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
new file mode 100644
index 0000000000..f5c1983fea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+
+/**
+ * javax.persistence.SecondaryTable
+ */
+public final class BinarySecondaryTableAnnotation
+ extends BinaryBaseTableAnnotation
+ implements NestableSecondaryTableAnnotation
+{
+ private final Vector<PrimaryKeyJoinColumnAnnotation> pkJoinColumns;
+
+ public BinarySecondaryTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.pkJoinColumns = this.buildPkJoinColumns();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updatePkJoinColumns();
+ }
+
+
+ // ********** BinaryBaseTableAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.SECONDARY_TABLE__NAME;
+ }
+
+ @Override
+ protected String getSchemaElementName() {
+ return JPA.SECONDARY_TABLE__SCHEMA;
+ }
+
+ @Override
+ protected String getCatalogElementName() {
+ return JPA.SECONDARY_TABLE__CATALOG;
+ }
+
+ @Override
+ protected String getUniqueConstraintElementName() {
+ return JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+
+ // ************* SecondaryTableAnnotation implementation *******************
+
+ // ***** pk join columns
+ public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() {
+ return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
+ }
+
+ public int pkJoinColumnsSize() {
+ return this.pkJoinColumns.size();
+ }
+
+ public PrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
+ return this.pkJoinColumns.get(index);
+ }
+
+ public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumn) {
+ return this.pkJoinColumns.indexOf(pkJoinColumn);
+ }
+
+ public PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void movePkJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removePkJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<PrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() {
+ Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS);
+ Vector<PrimaryKeyJoinColumnAnnotation> result = new Vector<PrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length);
+ for (Object jdtJoinColumn : jdtJoinColumns) {
+ result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
+ }
+ return result;
+ }
+
+ // TODO
+ private void updatePkJoinColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
new file mode 100644
index 0000000000..08d36f54c1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
+
+/**
+ * javax.persistence.SecondaryTables
+ */
+public final class BinarySecondaryTablesAnnotation
+ extends BinaryContainerAnnotation<NestableSecondaryTableAnnotation>
+ implements SecondaryTablesAnnotation
+{
+ private final Vector<NestableSecondaryTableAnnotation> secondaryTables;
+
+
+ public BinarySecondaryTablesAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.secondaryTables = this.buildSecondaryTables();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableSecondaryTableAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableSecondaryTableAnnotation>(this.secondaryTables);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.secondaryTables.size();
+ }
+
+ private Vector<NestableSecondaryTableAnnotation> buildSecondaryTables() {
+ Object[] jdtSecondaryTables = this.getJdtMemberValues(JPA.SECONDARY_TABLES__VALUE);
+ Vector<NestableSecondaryTableAnnotation> result = new Vector<NestableSecondaryTableAnnotation>(jdtSecondaryTables.length);
+ for (Object jdtSecondaryTable : jdtSecondaryTables) {
+ result.add(new BinarySecondaryTableAnnotation(this, (IAnnotation) jdtSecondaryTable));
+ }
+ return result;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateSecondaryTables();
+ }
+
+ // TODO
+ private void updateSecondaryTables() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
new file mode 100644
index 0000000000..e4d09f7098
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+
+/**
+ * javax.persistence.SequenceGenerator
+ */
+public abstract class BinarySequenceGeneratorAnnotation
+ extends BinaryGeneratorAnnotation
+ implements SequenceGeneratorAnnotation
+{
+ private String sequenceName;
+
+
+ protected BinarySequenceGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.sequenceName = this.buildSequenceName();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setSequenceName_(this.buildSequenceName());
+ }
+
+
+ // ********** BinaryGeneratorAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return JPA.SEQUENCE_GENERATOR__NAME;
+ }
+
+ @Override
+ String getInitialValueElementName() {
+ return JPA.SEQUENCE_GENERATOR__INITIAL_VALUE;
+ }
+
+ @Override
+ String getAllocationSizeElementName() {
+ return JPA.SEQUENCE_GENERATOR__ALLOCATION_SIZE;
+ }
+
+
+ // ********** SequenceGeneratorAnnotation implementation **********
+
+ // ***** sequence name
+ public String getSequenceName() {
+ return this.sequenceName;
+ }
+
+ public void setSequenceName(String sequenceName) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setSequenceName_(String sequenceName) {
+ String old = this.sequenceName;
+ this.sequenceName = sequenceName;
+ this.firePropertyChanged(SEQUENCE_NAME_PROPERTY, old, sequenceName);
+ }
+
+ private String buildSequenceName() {
+ return (String) this.getJdtMemberValue(JPA.SEQUENCE_GENERATOR__SEQUENCE_NAME);
+ }
+
+ public TextRange getSequenceNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java
new file mode 100644
index 0000000000..939515dea4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
+
+/**
+ * javax.persistence.Table
+ */
+public final class BinaryTableAnnotation
+ extends BinaryBaseTableAnnotation
+ implements TableAnnotation
+{
+ public BinaryTableAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryBaseTableAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.TABLE__NAME;
+ }
+
+ @Override
+ protected String getSchemaElementName() {
+ return JPA.TABLE__SCHEMA;
+ }
+
+ @Override
+ protected String getCatalogElementName() {
+ return JPA.TABLE__CATALOG;
+ }
+
+ @Override
+ protected String getUniqueConstraintElementName() {
+ return JPA.TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
new file mode 100644
index 0000000000..4c3540ae1d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+/**
+ * javax.persistence.TableGenerator
+ */
+public final class BinaryTableGeneratorAnnotation
+ extends BinaryGeneratorAnnotation
+ implements TableGeneratorAnnotation
+{
+ private String table;
+ private String schema;
+ private String catalog;
+ private String pkColumnName;
+ private String valueColumnName;
+ private String pkColumnValue;
+ private final Vector<UniqueConstraintAnnotation> uniqueConstraints;
+
+
+ public BinaryTableGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.table = this.buildTable();
+ this.schema = this.buildSchema();
+ this.catalog = this.buildCatalog();
+ this.pkColumnName = this.buildPkColumnName();
+ this.valueColumnName = this.buildValueColumnName();
+ this.pkColumnValue = this.buildPkColumnValue();
+ this.uniqueConstraints = this.buildUniqueConstraints();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setTable_(this.buildTable());
+ this.setSchema_(this.buildSchema());
+ this.setCatalog_(this.buildCatalog());
+ this.setPkColumnName_(this.buildPkColumnName());
+ this.setValueColumnName_(this.buildValueColumnName());
+ this.setPkColumnValue_(this.buildPkColumnValue());
+ this.updateUniqueConstraints();
+ }
+
+
+ // ********** AbstractGeneratorAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return JPA.TABLE_GENERATOR__NAME;
+ }
+
+ @Override
+ String getInitialValueElementName() {
+ return JPA.TABLE_GENERATOR__INITIAL_VALUE;
+ }
+
+ @Override
+ String getAllocationSizeElementName() {
+ return JPA.TABLE_GENERATOR__ALLOCATION_SIZE;
+ }
+
+
+ // ********** TableGeneratorAnnotation implementation **********
+
+ // ***** table
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String table) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setTable_(String table) {
+ String old = this.table;
+ this.table = table;
+ this.firePropertyChanged(TABLE_PROPERTY, old, table);
+ }
+
+ private String buildTable() {
+ return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__TABLE);
+ }
+
+ public TextRange getTableTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** schema
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String schema) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setSchema_(String schema) {
+ String old = this.schema;
+ this.schema = schema;
+ this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
+ }
+
+ private String buildSchema() {
+ return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__SCHEMA);
+ }
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** catalog
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String catalog) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCatalog_(String catalog) {
+ String old = this.catalog;
+ this.catalog = catalog;
+ this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
+ }
+
+ private String buildCatalog() {
+ return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__CATALOG);
+ }
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** pk column name
+ public String getPkColumnName() {
+ return this.pkColumnName;
+ }
+
+ public void setPkColumnName(String pkColumnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setPkColumnName_(String pkColumnName) {
+ String old = this.pkColumnName;
+ this.pkColumnName = pkColumnName;
+ this.firePropertyChanged(PK_COLUMN_NAME_PROPERTY, old, pkColumnName);
+ }
+
+ private String buildPkColumnName() {
+ return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
+ }
+
+ public TextRange getPkColumnNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** value column name
+ public String getValueColumnName() {
+ return this.valueColumnName;
+ }
+
+ public void setValueColumnName(String valueColumnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValueColumnName_(String valueColumnName) {
+ String old = this.valueColumnName;
+ this.valueColumnName = valueColumnName;
+ this.firePropertyChanged(VALUE_COLUMN_NAME_PROPERTY, old, valueColumnName);
+ }
+
+ private String buildValueColumnName() {
+ return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
+ }
+
+ public TextRange getValueColumnNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** pk column value
+ public String getPkColumnValue() {
+ return this.pkColumnValue;
+ }
+
+ public void setPkColumnValue(String pkColumnValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setPkColumnValue_(String pkColumnValue) {
+ String old = this.pkColumnValue;
+ this.pkColumnValue = pkColumnValue;
+ this.firePropertyChanged(PK_COLUMN_VALUE_PROPERTY, old, pkColumnValue);
+ }
+
+ private String buildPkColumnValue() {
+ return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
+ }
+
+ public TextRange getPkColumnValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean pkColumnValueTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** unique constraints
+ public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
+ return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
+ return this.uniqueConstraints.indexOf(uniqueConstraint);
+ }
+
+ public UniqueConstraintAnnotation addUniqueConstraint(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeUniqueConstraint(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() {
+ Object[] jdtUniqueConstraints = this.getJdtMemberValues(JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
+ Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length);
+ for (Object jdtUniqueConstraint : jdtUniqueConstraints) {
+ result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint));
+ }
+ return result;
+ }
+
+ // TODO
+ private void updateUniqueConstraints() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
new file mode 100644
index 0000000000..c8faac2678
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+/**
+ * javax.persistence.Temporal
+ */
+public final class BinaryTemporalAnnotation
+ extends BinaryBaseTemporalAnnotation
+ implements TemporalAnnotation
+{
+
+ public BinaryTemporalAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA.TEMPORAL__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java
new file mode 100644
index 0000000000..dd7ad500ac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
+
+/**
+ * javax.persistence.Transient
+ */
+public final class BinaryTransientAnnotation
+ extends BinaryAnnotation
+ implements TransientAnnotation
+{
+
+ public BinaryTransientAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
new file mode 100644
index 0000000000..c88b2370bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+/**
+ * javax.persistence.UniqueConstraint
+ */
+final class BinaryUniqueConstraintAnnotation
+ extends BinaryAnnotation
+ implements UniqueConstraintAnnotation
+{
+ private final Vector<String> columnNames;
+
+
+ BinaryUniqueConstraintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.columnNames = this.buildColumnNames();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateColumnNames();
+ }
+
+ // TODO
+ private void updateColumnNames() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** UniqueConstraintAnnotation implementation **********
+
+ // ***** column names
+ public ListIterator<String> columnNames() {
+ return new CloneListIterator<String>(this.columnNames);
+ }
+
+ public int columnNamesSize() {
+ return this.columnNames.size();
+ }
+
+ private Vector<String> buildColumnNames() {
+ Object[] jdtColumnNames = this.getJdtMemberValues(JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
+ Vector<String> result = new Vector<String>(jdtColumnNames.length);
+ for (Object jdtColumnName : jdtColumnNames) {
+ result.add((String) jdtColumnName);
+ }
+ return result;
+ }
+
+ public void addColumnName(String columnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addColumnName(int index, String columnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveColumnName(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeColumnName(String columnName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeColumnName(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java
new file mode 100644
index 0000000000..d0a856b11b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
+
+/**
+ * javax.persistence.Version
+ */
+public final class BinaryVersionAnnotation
+ extends BinaryAnnotation
+ implements VersionAnnotation
+{
+
+ public BinaryVersionAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java
new file mode 100644
index 0000000000..baf9b674e1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
+
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceModelListener;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.ListenerList;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * JAR and external types
+ */
+abstract class RootBinaryNode
+ extends BinaryNode
+ implements JavaResourceNode.Root
+{
+ /** pluggable annotation provider */
+ private final JpaAnnotationProvider annotationProvider;
+
+ /** listeners notified whenever the resource model changes */
+ private final ListenerList<JptResourceModelListener> resourceModelListenerList = new ListenerList<JptResourceModelListener>(JptResourceModelListener.class);
+
+
+ // ********** construction **********
+
+ RootBinaryNode(JavaResourceNode parent, JpaAnnotationProvider annotationProvider) {
+ super(parent);
+ this.annotationProvider = annotationProvider;
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ protected boolean requiresParent() {
+ return false;
+ }
+
+ @Override
+ public Root getRoot() {
+ return this;
+ }
+
+ @Override
+ public JpaAnnotationProvider getAnnotationProvider() {
+ return this.annotationProvider;
+ }
+
+
+ // ********** JavaResourceNode.Root implementation **********
+
+ public void resourceModelChanged() {
+ for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
+ listener.resourceModelChanged(this);
+ }
+ }
+
+
+ // ********** JptResourceModel implementation **********
+
+ public JptResourceType getResourceType() {
+ return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
+ }
+
+ public void addResourceModelListener(JptResourceModelListener listener) {
+ this.resourceModelListenerList.add(listener);
+ }
+
+ public void removeResourceModelListener(JptResourceModelListener listener) {
+ this.resourceModelListenerList.remove(listener);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java
new file mode 100644
index 0000000000..3a050867fb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+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.MemberValuePair;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * Utility methods for manipulating annotation containers.
+ */
+public final class AnnotationContainerTools {
+
+ /**
+ * Add a nested annotation to the specified annotation container
+ * at the specified index.
+ * This method modifies both the resource model annotation container and the
+ * AST; with <em>no</em> change notification.
+ */
+ public static <T extends NestableAnnotation> NestableAnnotation addNestedAnnotation(int index, AnnotationContainer<T> annotationContainer) {
+ // add a new annotation to the end of the list...
+ int sourceIndex = annotationContainer.getNestedAnnotationsSize();
+ T nestedAnnotation = annotationContainer.addNestedAnnotation();
+ nestedAnnotation.newAnnotation();
+ // ...then move it to the specified index
+ moveNestedAnnotation(index, sourceIndex, annotationContainer);
+ return nestedAnnotation;
+ }
+
+ /**
+ * Move the nested annotation at the specified source index in the
+ * specified annotation container to the specified target index.
+ * This method modifies both the resource model annotation container and the
+ * AST; with <em>no</em> change notification.
+ */
+ public static <T extends NestableAnnotation> void moveNestedAnnotation(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer) {
+ if (targetIndex != sourceIndex) {
+ moveNestedAnnotation_(targetIndex, sourceIndex, annotationContainer);
+ }
+ }
+
+ private static <T extends NestableAnnotation> void moveNestedAnnotation_(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer) {
+ NestableAnnotation nestedAnnotation = annotationContainer.moveNestedAnnotation(targetIndex, sourceIndex);
+ syncAstAnnotationsAfterMove(targetIndex, sourceIndex, annotationContainer, nestedAnnotation);
+ }
+
+ /**
+ * An annotation was moved within the specified annotation container from
+ * the specified source index to the specified target index.
+ * Synchronize the AST annotations with the resource model annotation container,
+ * starting with the lower index to prevent overlap.
+ */
+ private static <T extends NestableAnnotation> void syncAstAnnotationsAfterMove(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer, NestableAnnotation nestedAnnotation) {
+ // move the Java annotation to the end of the list...
+ nestedAnnotation.moveAnnotation(annotationContainer.getNestedAnnotationsSize());
+ // ...then shift the other AST annotations over one slot...
+ List<T> nestableAnnotations = CollectionTools.list(annotationContainer.getNestedAnnotations());
+ if (sourceIndex < targetIndex) {
+ for (int i = sourceIndex; i < targetIndex; i++) {
+ nestableAnnotations.get(i).moveAnnotation(i);
+ }
+ } else {
+ for (int i = sourceIndex; i > targetIndex; i-- ) {
+ nestableAnnotations.get(i).moveAnnotation(i);
+ }
+ }
+ // ...then move the AST annotation to the now empty slot at the target index
+ nestedAnnotation.moveAnnotation(targetIndex);
+ }
+
+ /**
+ * Remove the nested annotation at the specified index in the
+ * specified annotation container.
+ * This method modifies both the resource model annotation container and the
+ * AST; with <em>no</em> change notification.
+ */
+ public static <T extends NestableAnnotation> void removeNestedAnnotation(int index, AnnotationContainer<T> annotationContainer) {
+ T nestedAnnotation = annotationContainer.removeNestedAnnotation(index);
+ nestedAnnotation.removeAnnotation();
+ syncAstAnnotationsAfterRemove(index, annotationContainer);
+ }
+
+ /**
+ * An annotation was removed from the specified annotation container at the
+ * specified index.
+ * Synchronize the AST annotations with the resource model annotation container,
+ * starting at the specified index to prevent overlap.
+ */
+ private static <T extends NestableAnnotation> void syncAstAnnotationsAfterRemove(int index, AnnotationContainer<T> annotationContainer) {
+ List<T> nestableAnnotations = CollectionTools.list(annotationContainer.getNestedAnnotations());
+ for (int i = index; i < nestableAnnotations.size(); i++) {
+ // the indices are the same because the model annotations are
+ // already in the proper locations - it's the AST annotations that
+ // need to be moved to the matching location
+ nestableAnnotations.get(i).moveAnnotation(i);
+ }
+ }
+
+ /**
+ * Initialize the specified resource model annotation container to be in
+ * sync with the specified AST. No change notification will occur.
+ */
+ public static <T extends NestableAnnotation> void initialize(AnnotationContainer<T> annotationContainer, CompilationUnit astRoot) {
+ // ignore the nested AST annotations themselves
+ // (maybe someday we can use them during initialization...)
+ int size = getNestedAstAnnotations(astRoot, annotationContainer).size();
+ for (int i = 0; i < size; i++) {
+ T nestedAnnotation = annotationContainer.addNestedAnnotation();
+ nestedAnnotation.initialize(astRoot);
+ }
+ }
+
+ /**
+ * Return a list of the nested AST annotations.
+ */
+ private static <T extends NestableAnnotation> List<Annotation> getNestedAstAnnotations(CompilationUnit astRoot, AnnotationContainer<T> annotationContainer) {
+ Annotation astContainerAnnotation = annotationContainer.getAstAnnotation(astRoot);
+ if (astContainerAnnotation == null) {
+ // seems unlikely the AST container annotation would be null,
+ // since the resource container annotation is only created and
+ // initialized (or synchronized) when the AST container annotation
+ // is discovered
+ return Collections.emptyList();
+ }
+
+ if (astContainerAnnotation.isMarkerAnnotation()) {
+ return Collections.emptyList(); // no nested annotations
+ }
+
+ if (astContainerAnnotation.isSingleMemberAnnotation()) {
+ return getNestedAstAnnotations((SingleMemberAnnotation) astContainerAnnotation, annotationContainer);
+ }
+
+ if (astContainerAnnotation.isNormalAnnotation()) {
+ return getNestedAstAnnotations((NormalAnnotation) astContainerAnnotation, annotationContainer);
+ }
+
+ throw new IllegalStateException("unknown annotation type: " + astContainerAnnotation); //$NON-NLS-1$
+ }
+
+ private static <T extends NestableAnnotation> List<Annotation> getNestedAstAnnotations(SingleMemberAnnotation astContainerAnnotation, AnnotationContainer<T> annotationContainer) {
+ return annotationContainer.getElementName().equals("value") ? //$NON-NLS-1$
+ getAstAnnotations(astContainerAnnotation.getValue(), annotationContainer) :
+ Collections.<Annotation>emptyList();
+ }
+
+ private static <T extends NestableAnnotation> List<Annotation> getNestedAstAnnotations(NormalAnnotation astContainerAnnotation, AnnotationContainer<T> annotationContainer) {
+ MemberValuePair pair = getMemberValuePair(astContainerAnnotation, annotationContainer.getElementName());
+ return (pair != null) ?
+ getAstAnnotations(pair.getValue(), annotationContainer) :
+ Collections.<Annotation>emptyList();
+ }
+
+ private static <T extends NestableAnnotation> List<Annotation> getAstAnnotations(Expression expression, AnnotationContainer<T> annotationContainer) {
+ return (expression != null) ?
+ getAstAnnotations_(expression, annotationContainer.getNestedAnnotationName()) :
+ Collections.<Annotation>emptyList();
+ }
+
+ /**
+ * pre-condition: expression is not null
+ */
+ private static <T extends NestableAnnotation> List<Annotation> getAstAnnotations_(Expression expression, String annotationName) {
+ ArrayList<Annotation> result = new ArrayList<Annotation>();
+ addAstAnnotationsTo(expression, annotationName, result);
+ return result;
+ }
+
+ /**
+ * pre-condition: expression is not null
+ * <p>
+ * Add whatever annotations are represented by the specified expression to
+ * the specified list. Skip any non-annotation expressions.
+ */
+ private static void addAstAnnotationsTo(Expression expression, String annotationName, ArrayList<Annotation> astAnnotations) {
+ if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) {
+ addAstAnnotationsTo((ArrayInitializer) expression, annotationName, astAnnotations);
+ } else {
+ addAstAnnotationTo(expression, annotationName, astAnnotations);
+ }
+ }
+
+ private static void addAstAnnotationsTo(ArrayInitializer arrayInitializer, String annotationName, ArrayList<Annotation> astAnnotations) {
+ @SuppressWarnings("unchecked")
+ List<Expression> expressions = arrayInitializer.expressions();
+ for (Expression expression : expressions) {
+ if (expression != null) {
+ addAstAnnotationTo(expression, annotationName, astAnnotations);
+ }
+ }
+ }
+
+ private static void addAstAnnotationTo(Expression expression, String annotationName, ArrayList<Annotation> astAnnotations) {
+ switch (expression.getNodeType()) {
+ case ASTNode.NORMAL_ANNOTATION:
+ case ASTNode.SINGLE_MEMBER_ANNOTATION:
+ case ASTNode.MARKER_ANNOTATION:
+ Annotation astAnnotation = (Annotation) expression;
+ if (getQualifiedName(astAnnotation).equals(annotationName)) {
+ astAnnotations.add(astAnnotation);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ private static String getQualifiedName(Annotation astAnnotation) {
+ ITypeBinding typeBinding = astAnnotation.resolveTypeBinding();
+ if (typeBinding != null) {
+ String resolvedName = typeBinding.getQualifiedName();
+ if (resolvedName != null) {
+ return resolvedName;
+ }
+ }
+ return astAnnotation.getTypeName().getFullyQualifiedName();
+ }
+
+ private static MemberValuePair getMemberValuePair(NormalAnnotation annotation, String elementName) {
+ @SuppressWarnings("unchecked")
+ List<MemberValuePair> pairs = annotation.values();
+ for (MemberValuePair pair : pairs) {
+ if (pair.getName().getFullyQualifiedName().equals(elementName)) {
+ return pair;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Synchronize the resource model annotations in the specified annotation
+ * container with those in the specified AST. Trigger the appropriate change
+ * notification.
+ */
+ public static <T extends NestableAnnotation> void synchronize(AnnotationContainer<T> annotationContainer, CompilationUnit astRoot) {
+ List<Annotation> astAnnotations = getNestedAstAnnotations(astRoot, annotationContainer);
+ Iterator<Annotation> astAnnotationStream = astAnnotations.iterator();
+
+ for (T nestedAnnotation : annotationContainer.getNestedAnnotations()) {
+ if (astAnnotationStream.hasNext()) {
+ // matching AST annotation is present - synchronize the nested annotation
+ astAnnotationStream.next(); // maybe someday we can pass this to the update
+ nestedAnnotation.synchronizeWith(astRoot);
+ } else {
+ // no more AST annotations - remove the remaining nested annotations and exit
+ annotationContainer.syncRemoveNestedAnnotations(astAnnotations.size());
+ return;
+ }
+ }
+
+ // add nested annotations for any remaining AST annotations
+ while (astAnnotationStream.hasNext()) {
+ annotationContainer.syncAddNestedAnnotation(astAnnotationStream.next());
+ }
+ }
+
+ private AnnotationContainerTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java
new file mode 100644
index 0000000000..4bdf589011
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java
@@ -0,0 +1,472 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.ASTNode;
+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.common.core.internal.utility.jdt.ASTNodeTextRange;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * Java source annotated element (annotations)
+ */
+abstract class SourceAnnotatedElement<A extends AnnotatedElement>
+ extends SourceNode
+ implements JavaResourceAnnotatedElement
+{
+ final A annotatedElement;
+
+ /**
+ * annotations; no duplicates (java compiler has an error for duplicates)
+ */
+ final Vector<Annotation> annotations = new Vector<Annotation>();
+
+ /**
+ * these are built as needed
+ */
+ private final HashMap<String, Annotation> nullAnnotationCache = new HashMap<String, Annotation>();
+
+
+ // ********** construction/initialization **********
+
+ SourceAnnotatedElement(JavaResourceNode parent, A annotatedElement) {
+ super(parent);
+ this.annotatedElement = annotatedElement;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.annotatedElement.getBodyDeclaration(astRoot).accept(this.buildInitialAnnotationVisitor(astRoot));
+ }
+
+ private ASTVisitor buildInitialAnnotationVisitor(CompilationUnit astRoot) {
+ return new InitialAnnotationVisitor(astRoot, this.annotatedElement.getBodyDeclaration(astRoot));
+ }
+
+ /**
+ * called from {@link InitialAnnotationVisitor#visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation)}
+ */
+ /* CU private */ void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot) {
+ String astAnnotationName = ASTTools.resolveAnnotation(node);
+ if (astAnnotationName != null) {
+ this.addInitialAnnotation(astAnnotationName, astRoot);
+ }
+ }
+
+ /**
+ * pre-condition: <code>astAnnotationName</code> is not <code>null</code>
+ */
+ void addInitialAnnotation(String astAnnotationName, CompilationUnit astRoot) {
+ if (this.annotationIsValid(astAnnotationName)) {
+ if (this.selectAnnotationNamed(this.annotations, astAnnotationName) == null) { // ignore duplicates
+ Annotation annotation = this.buildAnnotation(astAnnotationName);
+ annotation.initialize(astRoot);
+ this.annotations.add(annotation);
+ }
+ }
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncAnnotations(astRoot);
+ }
+
+
+ // ********** annotations **********
+
+ public Iterator<Annotation> annotations() {
+ return this.getAnnotations().iterator();
+ }
+
+ Iterable<Annotation> getAnnotations() {
+ return new LiveCloneIterable<Annotation>(this.annotations);
+ }
+
+ public int annotationsSize() {
+ return this.annotations.size();
+ }
+
+ public Annotation getAnnotation(String annotationName) {
+ return this.selectAnnotationNamed(this.getAnnotations(), annotationName);
+ }
+
+ public Annotation getNonNullAnnotation(String annotationName) {
+ Annotation annotation = this.getAnnotation(annotationName);
+ return (annotation != null) ? annotation : this.getNullAnnotation(annotationName);
+ }
+
+ private synchronized Annotation getNullAnnotation(String annotationName) {
+ Annotation annotation = this.nullAnnotationCache.get(annotationName);
+ if (annotation == null) {
+ annotation = this.buildNullAnnotation(annotationName);
+ this.nullAnnotationCache.put(annotationName, annotation);
+ }
+ return annotation;
+ }
+
+ public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
+ if (containerAnnotation != null) {
+ return containerAnnotation.getNestedAnnotations().iterator();
+ }
+ NestableAnnotation nestableAnnotation = this.getNestableAnnotation(nestableAnnotationName);
+ if (nestableAnnotation != null) {
+ return new SingleElementIterator<NestableAnnotation>(nestableAnnotation);
+ }
+ return EmptyIterator.instance();
+ }
+
+ // minimize scope of suppressed warnings
+ @SuppressWarnings("unchecked")
+ private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) {
+ return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName);
+ }
+
+ private NestableAnnotation getNestableAnnotation(String annotationName) {
+ return (NestableAnnotation) this.getAnnotation(annotationName);
+ }
+
+ public Annotation addAnnotation(String annotationName) {
+ Annotation annotation = this.buildAnnotation(annotationName);
+ this.annotations.add(annotation);
+ annotation.newAnnotation();
+ return annotation;
+ }
+
+ /**
+ * <ol>
+ * <li>Check for a container annotation;
+ * if it is present, add a nested annotation to it.
+ * <li>Check for a stand-alone nested annotation;
+ * if it is missing, add a stand-alone nested annotation.
+ * <li>If there is an existing stand-alone nested annotation,
+ * add a container annotation and move the stand-alone nested annotation to it
+ * and add a new nested annotation to it also
+ * <ol>
+ */
+ public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
+ if (containerAnnotation != null) {
+ // ignore any stand-alone nestable annotations and just add to the container annotation
+ return AnnotationContainerTools.addNestedAnnotation(index, containerAnnotation);
+ }
+ NestableAnnotation standAloneAnnotation = this.getNestableAnnotation(nestableAnnotationName);
+ if (standAloneAnnotation == null) {
+ // add a stand-alone nestable annotation since neither the nestable nor the container exist
+ return (NestableAnnotation) this.addAnnotation(nestableAnnotationName);
+ }
+ // move the stand-alone nestable annotation to a container and add another nestable
+ return this.addSecondNestedAnnotation(index, containerAnnotationName, standAloneAnnotation);
+ }
+
+ /**
+ * <ol>
+ * <li>Build a new container annotation
+ * <li>If the new annotation is to be added at index 0<ol>
+ * <li>Add a new nestable annotation to the new container annotation
+ * at index 0
+ * <li>Move the existing stand-alone nestable annotation to the new
+ * container annotation at index 1
+ * </ol>
+ * <li>If the new annotation is to be added at index 1<ol>
+ * <li>Move the existing stand-alone nestable annotation to the new
+ * container annotation at index 0
+ * <li>Add a new nestable annotation to the new container annotation
+ * at index 1
+ * </ol>
+ * </ol>
+ */
+ private NestableAnnotation addSecondNestedAnnotation(int index, String containerAnnotationName, NestableAnnotation standAloneAnnotation) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.buildContainerAnnotation(containerAnnotationName);
+ this.annotations.add(containerAnnotation);
+ containerAnnotation.newAnnotation();
+
+ NestableAnnotation nestedAnnotation = null;
+ switch (index) {
+ case 0 :
+ // adding new annotation at 0, so move the stand-alone to slot 1
+ nestedAnnotation = containerAnnotation.addNestedAnnotation();
+ nestedAnnotation.newAnnotation();
+ this.annotations.remove(standAloneAnnotation);
+ containerAnnotation.nestStandAloneAnnotation(standAloneAnnotation);
+ break;
+ case 1 :
+ // adding new annotation at 1, so move the stand-alone to slot 0
+ this.annotations.remove(standAloneAnnotation);
+ containerAnnotation.nestStandAloneAnnotation(standAloneAnnotation);
+ nestedAnnotation = containerAnnotation.addNestedAnnotation();
+ nestedAnnotation.newAnnotation();
+ break;
+ default :
+ throw new IllegalArgumentException("invalid index: " + index); //$NON-NLS-1$
+ }
+
+ return nestedAnnotation;
+ }
+
+ public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
+ this.moveAnnotation(targetIndex, sourceIndex, this.getContainerAnnotation(containerAnnotationName));
+ }
+
+ private void moveAnnotation(int targetIndex, int sourceIndex, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, containerAnnotation);
+ }
+
+ public void removeAnnotation(String annotationName) {
+ Annotation annotation = this.getAnnotation(annotationName);
+ if (annotation != null) {
+ this.removeAnnotation(annotation);
+ }
+ }
+
+ private void removeAnnotation(Annotation annotation) {
+ this.annotations.remove(annotation);
+ annotation.removeAnnotation();
+ }
+
+ public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
+ if (containerAnnotation == null) {
+ if (index != 0) {
+ throw new IllegalArgumentException("invalid index: " + index); //$NON-NLS-1$
+ }
+ this.removeAnnotation(this.getAnnotation(nestableAnnotationName));
+ } else {
+ this.removeAnnotation(index, containerAnnotation);
+ }
+ }
+
+ /**
+ * After we remove the nested annotation, check to see whether we need to
+ * either remove the container (if it is empty) or convert the last nested
+ * annotation to a stand-alone annotation.
+ */
+ private void removeAnnotation(int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ AnnotationContainerTools.removeNestedAnnotation(index, containerAnnotation);
+ switch (containerAnnotation.getNestedAnnotationsSize()) {
+ case 0:
+ this.removeAnnotation(containerAnnotation);
+ break;
+ case 1:
+ this.convertLastNestedAnnotation(containerAnnotation);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Convert the last nested annotation in the container to a stand-alone
+ * annotation and remove the container annotation.
+ */
+ private void convertLastNestedAnnotation(ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ containerAnnotation.convertLastNestedAnnotationToStandAlone();
+ this.annotations.remove(containerAnnotation);
+ containerAnnotation.removeAnnotation();
+ }
+
+ public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.annotations.add(standAloneAnnotation);
+ }
+
+ private boolean annotationIsValid(String annotationName) {
+ return CollectionTools.contains(this.validAnnotationNames(), annotationName);
+ }
+
+ abstract Iterator<String> validAnnotationNames();
+
+ abstract Annotation buildAnnotation(String annotationName);
+
+ abstract Annotation buildNullAnnotation(String annotationName);
+
+ // minimize scope of suppressed warnings
+ @SuppressWarnings("unchecked")
+ private ContainerAnnotation<NestableAnnotation> buildContainerAnnotation(String annotationName) {
+ return (ContainerAnnotation<NestableAnnotation>) this.buildAnnotation(annotationName);
+ }
+
+ private void syncAnnotations(CompilationUnit astRoot) {
+ HashSet<Annotation> annotationsToRemove = new HashSet<Annotation>(this.annotations);
+
+ this.annotatedElement.getBodyDeclaration(astRoot).accept(this.buildSynchronizeAnnotationVisitor(astRoot, annotationsToRemove));
+
+ this.removeItemsFromCollection(annotationsToRemove, this.annotations, ANNOTATIONS_COLLECTION);
+ }
+
+ private ASTVisitor buildSynchronizeAnnotationVisitor(CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
+ return new SynchronizeAnnotationVisitor(astRoot, this.annotatedElement.getBodyDeclaration(astRoot), annotationsToRemove);
+ }
+
+ /**
+ * called from {@link SynchronizeAnnotationVisitor#visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation)}
+ */
+ /* CU private */ void addOrSyncAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
+ String astAnnotationName = ASTTools.resolveAnnotation(astAnnotation);
+ if (astAnnotationName != null) {
+ this.addOrSyncAnnotation(astAnnotationName, astRoot, annotationsToRemove);
+ }
+ }
+
+ /**
+ * pre-condition: <code>astAnnotationName</code> is not <code>null</code>
+ */
+ void addOrSyncAnnotation(String astAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
+ if (this.annotationIsValid(astAnnotationName)) {
+ this.addOrSyncAnnotation_(astAnnotationName, astRoot, annotationsToRemove);
+ }
+ }
+
+ /**
+ * pre-condition: <code>astAnnotationName</code> is valid
+ */
+ private void addOrSyncAnnotation_(String astAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
+ Annotation annotation = this.selectAnnotationNamed(annotationsToRemove, astAnnotationName);
+ if (annotation != null) {
+ annotation.synchronizeWith(astRoot);
+ annotationsToRemove.remove(annotation);
+ } else {
+ annotation = this.buildAnnotation(astAnnotationName);
+ annotation.initialize(astRoot);
+ this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
+ }
+ }
+
+
+ // ********** misc **********
+
+ public boolean isAnnotated() {
+ return ! this.annotations.isEmpty();
+ }
+
+ public TextRange getTextRange(CompilationUnit astRoot) {
+ return this.fullTextRange(astRoot);
+ }
+
+ private TextRange fullTextRange(CompilationUnit astRoot) {
+ return this.buildTextRange(this.annotatedElement.getBodyDeclaration(astRoot));
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.annotatedElement.getNameTextRange(astRoot);
+ }
+
+ private Annotation selectAnnotationNamed(Iterable<Annotation> list, String annotationName) {
+ for (Annotation annotation : list) {
+ if (annotation.getAnnotationName().equals(annotationName)) {
+ return annotation;
+ }
+ }
+ return null;
+ }
+
+ private TextRange buildTextRange(ASTNode astNode) {
+ return (astNode == null) ? null : new ASTNodeTextRange(astNode);
+ }
+
+
+ // ********** AST visitors **********
+
+ /**
+ * annotation visitor
+ */
+ static abstract class AnnotationVisitor
+ extends ASTVisitor
+ {
+ final CompilationUnit astRoot;
+ final ASTNode node;
+
+
+ protected AnnotationVisitor(CompilationUnit astRoot, ASTNode node) {
+ super();
+ this.astRoot = astRoot;
+ this.node = node;
+ }
+
+ @Override
+ public boolean visit(SingleMemberAnnotation annotation) {
+ return this.visit_(annotation);
+ }
+
+ @Override
+ public boolean visit(NormalAnnotation annotation) {
+ return this.visit_(annotation);
+ }
+
+ @Override
+ public boolean visit(MarkerAnnotation annotation) {
+ return this.visit_(annotation);
+ }
+
+ protected boolean visit_(org.eclipse.jdt.core.dom.Annotation annotation) {
+ // ignore annotations for child members, only this member
+ if (annotation.getParent() == this.node) {
+ this.visitChildAnnotation(annotation);
+ }
+ return false;
+ }
+
+ protected abstract void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation annotation);
+ }
+
+
+ /**
+ * initial annotation visitor
+ */
+ class InitialAnnotationVisitor
+ extends AnnotationVisitor
+ {
+ protected InitialAnnotationVisitor(CompilationUnit astRoot, ASTNode node) {
+ super(astRoot, node);
+ }
+
+ @Override
+ protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation annotation) {
+ SourceAnnotatedElement.this.addInitialAnnotation(annotation, this.astRoot);
+ }
+ }
+
+
+ /**
+ * synchronize annotation visitor
+ */
+ class SynchronizeAnnotationVisitor
+ extends AnnotationVisitor
+ {
+ protected final Set<Annotation> annotationsToRemove;
+
+ protected SynchronizeAnnotationVisitor(CompilationUnit astRoot, ASTNode node, Set<Annotation> annotationsToRemove) {
+ super(astRoot, node);
+ this.annotationsToRemove = annotationsToRemove;
+ }
+
+ @Override
+ protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation annotation) {
+ SourceAnnotatedElement.this.addOrSyncAnnotation(annotation, this.astRoot, this.annotationsToRemove);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java
new file mode 100644
index 0000000000..4631a1e7c8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java
@@ -0,0 +1,265 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTNodeTextRange;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * some common state and behavior for Java source annotations;
+ * and lots of convenience methods
+ */
+public abstract class SourceAnnotation<A extends AnnotatedElement>
+ extends SourceNode
+ implements Annotation
+{
+ protected final A annotatedElement;
+
+ // TODO - make 'final' if we start using combination annotation adapters(?)
+ protected DeclarationAnnotationAdapter daa;
+
+ // TODO - make 'final' if we start using combination annotation adapters(?)
+ protected AnnotationAdapter annotationAdapter;
+
+
+ /**
+ * constructor for straight member annotation
+ */
+ protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa) {
+ this(parent, annotatedElement, daa, new ElementAnnotationAdapter(annotatedElement, daa));
+ }
+
+ /**
+ * constructor for nested annotation (typically)
+ */
+ protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent);
+ this.annotatedElement = annotatedElement;
+ this.daa = daa;
+ this.annotationAdapter = annotationAdapter;
+ }
+
+
+ // ********** JavaResourceNode implementation **********
+
+ public TextRange getTextRange(CompilationUnit astRoot) {
+ return this.getAnnotationTextRange(astRoot);
+ }
+
+
+ // ********** Annotation implementation **********
+
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return this.annotationAdapter.getAnnotation(astRoot);
+ }
+
+ public void newAnnotation() {
+ this.annotationAdapter.newMarkerAnnotation();
+ }
+
+ public void removeAnnotation() {
+ this.annotationAdapter.removeAnnotation();
+ }
+
+ public boolean isUnset() {
+ return true;
+ }
+
+
+ // ********** convenience methods **********
+
+ @Override
+ public JavaResourcePersistentMember getParent() {
+ return (JavaResourcePersistentMember) super.getParent();
+ }
+
+ protected IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) this.annotationAdapter;
+ }
+
+ protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, elementName);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Boolean> buildBooleanElementAdapter(String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forBooleans(this.daa, elementName);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Integer> buildIntegerElementAdapter(String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forNumbers(this.daa, elementName);
+ }
+
+ protected AnnotationElementAdapter<String> buildStringElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
+ }
+
+ protected AnnotationElementAdapter<Boolean> buildBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea);
+ }
+
+ protected AnnotationElementAdapter<Integer> buildIntegerElementAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<Integer>(this.annotatedElement, daea);
+ }
+
+ /**
+ * Return the text range corresponding to the annotation.
+ * If the annotation is missing, return null.
+ */
+ protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
+ return this.getTextRange(this.getAstAnnotation(astRoot));
+ }
+
+ /**
+ * Convenience method.
+ * Return the text range corresponding to the specified element.
+ * If the specified element is missing, return the annotation's text range instead.
+ */
+ protected TextRange getElementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) {
+ return this.getElementTextRange(this.getAnnotationElementTextRange(elementAdapter, astRoot), astRoot);
+ }
+
+ /**
+ * Convenience method. If the specified element text range is null
+ * return the member's text range instead.
+ */
+ protected TextRange getElementTextRange(TextRange elementTextRange, CompilationUnit astRoot) {
+ return (elementTextRange != null) ? elementTextRange : this.getAnnotationTextRange(astRoot);
+ }
+
+ /**
+ * Convenience method. Return whether the specified position exists and
+ * touches the specified element.
+ */
+ protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
+ return this.textRangeTouches(this.getAnnotationElementTextRange(elementAdapter, astRoot), pos);
+ }
+
+ /**
+ * Convenience method. Return whether the specified text range is not
+ * null (meaning the corresponding AST node exists) and the specified position touches it.
+ */
+ protected boolean textRangeTouches(TextRange textRange, int pos) {
+ return (textRange != null) && textRange.touches(pos);
+ }
+
+ /**
+ * Return the text range corresponding to the specified element.
+ * If the element is missing, return null.
+ */
+ protected TextRange getAnnotationElementTextRange(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) {
+ return this.getTextRange(this.getAnnotationElementExpression(adapter, astRoot));
+ }
+
+ /**
+ * Return the specified AST DOM element.
+ */
+ protected Expression getAnnotationElementExpression(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) {
+ return adapter.getExpression(this.annotatedElement.getModifiedDeclaration(astRoot));
+ }
+
+ /**
+ * Return the text range corresponding to the specified AST node.
+ * If the AST node is null, return null.
+ */
+ protected TextRange getTextRange(ASTNode astNode) {
+ return (astNode == null) ? null : new ASTNodeTextRange(astNode);
+ }
+
+ /**
+ * Convenience implementation of
+ * {@link org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation#convertToNested(ContainerAnnotation, DeclarationAnnotationAdapter, int)}
+ * used by subclasses.
+ */
+ public void convertToNested(ContainerAnnotation<? extends NestableAnnotation> containerAnnotation, DeclarationAnnotationAdapter containerAnnotationAdapter, int index) {
+ Map<String, Object> map = this.buildState();
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ IndexedDeclarationAnnotationAdapter idaa = this.buildNestedDeclarationAnnotationAdapter(containerAnnotationAdapter, index);
+ this.daa = idaa;
+ this.annotationAdapter = new ElementIndexedAnnotationAdapter(this.annotatedElement, idaa);
+ this.rebuildAdapters();
+ containerAnnotation.addNestedAnnotation(index, (NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
+
+ /**
+ * Convenience implementation of
+ * {@link org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation#convertToStandAlone()}
+ * used by subclasses.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = this.buildState();
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ this.getParent().addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
+
+ private Map<String, Object> buildState() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ return map;
+ }
+
+ protected void rebuildAdapters() {
+ // this is only needed by nestable annotations
+ }
+
+ public void storeOn(Map<String, Object> map) {
+ // this is only needed by nestable annotations
+ }
+
+ public void restoreFrom(Map<String, Object> map) {
+ // this is only needed by nestable annotations
+ }
+
+ protected List<Map<String, Object>> buildStateList(int initialCapacity) {
+ return (initialCapacity == 0) ?
+ Collections.<Map<String, Object>>emptyList() :
+ new ArrayList<Map<String, Object>>(initialCapacity);
+ }
+
+ protected IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter containerAnnotationAdapter, int index) {
+ return buildNestedDeclarationAnnotationAdapter(index, containerAnnotationAdapter, this.getAnnotationName());
+ }
+
+ protected static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter containerAnnotationAdapter, String annotationName) {
+ return new NestedIndexedDeclarationAnnotationAdapter(containerAnnotationAdapter, index, annotationName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
new file mode 100644
index 0000000000..94a233d5d0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.AssociationOverride</code>
+ */
+public abstract class SourceAssociationOverrideAnnotation
+ extends SourceOverrideAnnotation
+ implements NestableAssociationOverrideAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
+ private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
+
+
+ protected SourceAssociationOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot);
+ }
+
+
+ // ********** SourceOverrideAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.ASSOCIATION_OVERRIDE__NAME;
+ }
+
+
+ // ********** AssociationOverrideAnnotation implementation **********
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ }
+
+ Iterable<NestableJoinColumnAnnotation> getNestableJoinColumns() {
+ return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public NestableJoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation addJoinColumn() {
+ return this.addJoinColumn(this.joinColumns.size());
+ }
+
+ public NestableJoinColumnAnnotation addJoinColumn(int index) {
+ return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation addJoinColumn_() {
+ return this.addJoinColumn_(this.joinColumns.size());
+ }
+
+ private NestableJoinColumnAnnotation addJoinColumn_(int index) {
+ NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
+ this.joinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ void syncAddJoinColumn(Annotation astAnnotation) {
+ int index = this.joinColumns.size();
+ NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index);
+ joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation buildJoinColumn(int index) {
+ return SourceJoinColumnAnnotation.createAssociationOverrideJoinColumn(this.daa, this, this.annotatedElement, index);
+ }
+
+ void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
+ this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public void removeJoinColumn(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation removeJoinColumn_(int index) {
+ return this.joinColumns.remove(index);
+ }
+
+ void syncRemoveJoinColumns(int index) {
+ this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+
+ // ********** join column container **********
+
+ /**
+ * adapt the AnnotationContainer interface to the override's join columns
+ */
+ class JoinColumnsAnnotationContainer
+ implements AnnotationContainer<NestableJoinColumnAnnotation>
+ {
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return SourceAssociationOverrideAnnotation.this.getAstAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS;
+ }
+
+ public String getNestedAnnotationName() {
+ return JoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
+ return SourceAssociationOverrideAnnotation.this.getNestableJoinColumns();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceAssociationOverrideAnnotation.this.joinColumnsSize();
+ }
+
+ public NestableJoinColumnAnnotation addNestedAnnotation() {
+ return SourceAssociationOverrideAnnotation.this.addJoinColumn_();
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ SourceAssociationOverrideAnnotation.this.syncAddJoinColumn(astAnnotation);
+ }
+
+ public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceAssociationOverrideAnnotation.this.moveJoinColumn_(targetIndex, sourceIndex);
+ }
+
+ public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return SourceAssociationOverrideAnnotation.this.removeJoinColumn_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceAssociationOverrideAnnotation.this.syncRemoveJoinColumns(index);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.joinColumns.isEmpty();
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+
+ List<Map<String, Object>> joinColumnsState = this.buildStateList(this.joinColumns.size());
+ for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) {
+ Map<String, Object> joinColumnState = new HashMap<String, Object>();
+ joinColumn.storeOn(joinColumnState);
+ joinColumnsState.add(joinColumnState);
+ }
+ map.put(JOIN_COLUMNS_LIST, joinColumnsState);
+ this.joinColumns.clear();
+ }
+
+ @Override
+ public void restoreFrom(Map<String,Object> map) {
+ super.restoreFrom(map);
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> joinColumnsState = (List<Map<String, Object>>) map.get(JOIN_COLUMNS_LIST);
+ for (Map<String, Object> joinColumnState : joinColumnsState) {
+ this.addJoinColumn().restoreFrom(joinColumnState);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
new file mode 100644
index 0000000000..4591355155
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
+
+/**
+ * <code>javax.persistence.AssociationOverrides</code>
+ */
+public abstract class SourceAssociationOverridesAnnotation
+ extends SourceAnnotation<Member>
+ implements AssociationOverridesAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableAssociationOverrideAnnotation> associationOverrides = new Vector<NestableAssociationOverrideAnnotation>();
+
+
+ protected SourceAssociationOverridesAnnotation(JavaResourceNode parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.associationOverrides.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.associationOverrides);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JPA.ASSOCIATION_OVERRIDES__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return AssociationOverrideAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableAssociationOverrideAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableAssociationOverrideAnnotation>(this.associationOverrides);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.associationOverrides.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.associationOverrides.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.associationOverrides.add(index, (NestableAssociationOverrideAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.associationOverrides.remove(0).convertToStandAlone();
+ }
+
+ public NestableAssociationOverrideAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.associationOverrides.size());
+ }
+
+ private NestableAssociationOverrideAnnotation addNestedAnnotation(int index) {
+ NestableAssociationOverrideAnnotation associationOverride = this.buildAssociationOverride(index);
+ this.associationOverrides.add(index, associationOverride);
+ return associationOverride;
+ }
+
+ protected abstract NestableAssociationOverrideAnnotation buildAssociationOverride(int index);
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.associationOverrides.size();
+ NestableAssociationOverrideAnnotation associationOverride = this.addNestedAnnotation(index);
+ associationOverride.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(ASSOCIATION_OVERRIDES_LIST, index, associationOverride);
+ }
+
+ public NestableAssociationOverrideAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.associationOverrides, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestableAssociationOverrideAnnotation removeNestedAnnotation(int index) {
+ return this.associationOverrides.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.associationOverrides, ASSOCIATION_OVERRIDES_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
new file mode 100644
index 0000000000..d1151a8487
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
+
+/**
+ * <code>javax.persistence.AttributeOverride</code>
+ */
+public final class SourceAttributeOverrideAnnotation
+ extends SourceOverrideAnnotation
+ implements NestableAttributeOverrideAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private ElementAnnotationAdapter columnAdapter;
+ private ColumnAnnotation column;
+ private final ColumnAnnotation nullColumn;
+
+
+ public SourceAttributeOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.columnAdapter = this.buildColumnAdapter();
+ this.nullColumn = this.buildNullColumn();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ if (this.columnAdapter.getAnnotation(astRoot) != null) {
+ this.column = SourceColumnAnnotation.createAttributeOverrideColumn(this, this.annotatedElement, this.daa);
+ this.column.initialize(astRoot);
+ }
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncColumn(astRoot);
+ }
+
+
+ // ********** SourceOverrideAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.ATTRIBUTE_OVERRIDE__NAME;
+ }
+
+
+ //************ AttributeOverride implementation ****************
+
+ // ***** column
+ public ColumnAnnotation getColumn() {
+ return this.column;
+ }
+
+ public ColumnAnnotation getNonNullColumn() {
+ return (this.column != null) ? this.column : this.nullColumn;
+ }
+
+ public ColumnAnnotation addColumn() {
+ if (this.column != null) {
+ throw new IllegalStateException("'column' element already exists: " + this.column); //$NON-NLS-1$
+ }
+ this.column = SourceColumnAnnotation.createAttributeOverrideColumn(this, this.annotatedElement, this.daa);
+ this.column.newAnnotation();
+ return this.column;
+ }
+
+ public void removeColumn() {
+ if (this.column == null) {
+ throw new IllegalStateException("'column' element does not exist"); //$NON-NLS-1$
+ }
+ ColumnAnnotation old = this.column;
+ this.column = null;
+ old.removeAnnotation();
+ }
+
+ private void syncColumn(CompilationUnit astRoot) {
+ if (this.columnAdapter.getAnnotation(astRoot) == null) {
+ this.syncColumn_(null);
+ } else {
+ if (this.column == null) {
+ ColumnAnnotation col = SourceColumnAnnotation.createAttributeOverrideColumn(this, this.annotatedElement, this.daa);
+ col.initialize(astRoot);
+ this.syncColumn_(col);
+ } else {
+ this.column.synchronizeWith(astRoot);
+ }
+ }
+ }
+
+ private void syncColumn_(ColumnAnnotation astColumn) {
+ ColumnAnnotation old = this.column;
+ this.column = astColumn;
+ this.firePropertyChanged(COLUMN_PROPERTY, old, astColumn);
+ }
+
+ private ElementAnnotationAdapter buildColumnAdapter() {
+ return new ElementAnnotationAdapter(this.annotatedElement, SourceColumnAnnotation.buildAttributeOverrideAnnotationAdapter(this.daa));
+ }
+
+ private ColumnAnnotation buildNullColumn() {
+ return new NullAttributeOverrideColumnAnnotation(this);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.column == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.columnAdapter = this.buildColumnAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ if (this.column != null) {
+ Map<String, Object> columnState = new HashMap<String, Object>();
+ this.column.storeOn(columnState);
+ map.put(COLUMN_PROPERTY, columnState);
+ this.column = null;
+ }
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> columnState = (Map<String, Object>) map.get(COLUMN_PROPERTY);
+ if (columnState != null) {
+ this.addColumn().restoreFrom(columnState);
+ }
+ }
+
+
+ // ********** static methods **********
+
+ public static SourceAttributeOverrideAnnotation buildAttributeOverride(JavaResourceNode parent, Member member) {
+ return new SourceAttributeOverrideAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static SourceAttributeOverrideAnnotation buildNestedAttributeOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
+ return new SourceAttributeOverrideAnnotation(parent, member, idaa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
new file mode 100644
index 0000000000..d1d75c6f31
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
+
+/**
+ * <code>javax.persistence.AttributeOverrides</code>
+ */
+public final class SourceAttributeOverridesAnnotation
+ extends SourceAnnotation<Member>
+ implements AttributeOverridesAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableAttributeOverrideAnnotation> attributeOverrides = new Vector<NestableAttributeOverrideAnnotation>();
+
+
+ public SourceAttributeOverridesAnnotation(JavaResourceNode parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.attributeOverrides.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.attributeOverrides);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JPA.ATTRIBUTE_OVERRIDES__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return AttributeOverrideAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableAttributeOverrideAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableAttributeOverrideAnnotation>(this.attributeOverrides);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.attributeOverrides.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.attributeOverrides.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.attributeOverrides.add(index, (NestableAttributeOverrideAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.attributeOverrides.remove(0).convertToStandAlone();
+ }
+
+ public NestableAttributeOverrideAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.attributeOverrides.size());
+ }
+
+ private NestableAttributeOverrideAnnotation addNestedAnnotation(int index) {
+ NestableAttributeOverrideAnnotation attributeOverride = this.buildAttributeOverride(index);
+ this.attributeOverrides.add(index, attributeOverride);
+ return attributeOverride;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.attributeOverrides.size();
+ NestableAttributeOverrideAnnotation attributeOverride = this.addNestedAnnotation(index);
+ attributeOverride.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
+ }
+
+ private NestableAttributeOverrideAnnotation buildAttributeOverride(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceAttributeOverrideAnnotation.buildNestedAttributeOverride(this.parent, this.annotatedElement, index, this.daa);
+ }
+
+ public NestableAttributeOverrideAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.attributeOverrides, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestableAttributeOverrideAnnotation removeNestedAnnotation(int index) {
+ return this.attributeOverrides.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.attributeOverrides, ATTRIBUTE_OVERRIDES_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
new file mode 100644
index 0000000000..37730073e4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
@@ -0,0 +1,334 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.Column</code>
+ * <li><code>javax.persistence.JoinColumn</code>
+ * <li><code>javax.persistence.MapKeyColumn</code>
+ * <li><code>javax.persistence.MapKeyJoinColumn</code>
+ * </ul>
+ */
+public abstract class SourceBaseColumnAnnotation
+ extends SourceNamedColumnAnnotation
+ implements BaseColumnAnnotation
+{
+ protected DeclarationAnnotationElementAdapter<String> tableDeclarationAdapter;
+ protected AnnotationElementAdapter<String> tableAdapter;
+ protected String table;
+
+ protected DeclarationAnnotationElementAdapter<Boolean> uniqueDeclarationAdapter;
+ protected AnnotationElementAdapter<Boolean> uniqueAdapter;
+ protected Boolean unique;
+
+ protected DeclarationAnnotationElementAdapter<Boolean> nullableDeclarationAdapter;
+ protected AnnotationElementAdapter<Boolean> nullableAdapter;
+ protected Boolean nullable;
+
+ protected DeclarationAnnotationElementAdapter<Boolean> insertableDeclarationAdapter;
+ protected AnnotationElementAdapter<Boolean> insertableAdapter;
+ protected Boolean insertable;
+
+ protected DeclarationAnnotationElementAdapter<Boolean> updatableDeclarationAdapter;
+ protected AnnotationElementAdapter<Boolean> updatableAdapter;
+ protected Boolean updatable;
+
+
+ protected SourceBaseColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ }
+
+ protected SourceBaseColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.tableDeclarationAdapter = this.buildTableDeclarationAdapter();
+ this.tableAdapter = this.buildTableAdapter();
+ this.uniqueDeclarationAdapter = this.buildUniqueDeclarationAdapter();
+ this.uniqueAdapter = this.buildUniqueAdapter();
+ this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter();
+ this.nullableAdapter = this.buildNullableAdapter();
+ this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter();
+ this.insertableAdapter = this.buildInsertableAdapter();
+ this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter();
+ this.updatableAdapter = this.buildUpdatableAdapter();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.table = this.buildTable(astRoot);
+ this.unique = this.buildUnique(astRoot);
+ this.nullable = this.buildNullable(astRoot);
+ this.insertable = this.buildInsertable(astRoot);
+ this.updatable = this.buildUpdatable(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncTable(this.buildTable(astRoot));
+ this.syncUnique(this.buildUnique(astRoot));
+ this.syncNullable(this.buildNullable(astRoot));
+ this.syncInsertable(this.buildInsertable(astRoot));
+ this.syncUpdatable(this.buildUpdatable(astRoot));
+ }
+
+
+ //************* BaseColumnAnnotation implementation *************
+
+ // ***** table
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String table) {
+ if (this.attributeValueHasChanged(this.table, table)) {
+ this.table = table;
+ this.tableAdapter.setValue(table);
+ }
+ }
+
+ private void syncTable(String astTable) {
+ String old = this.table;
+ this.table = astTable;
+ this.firePropertyChanged(TABLE_PROPERTY, old, astTable);
+ }
+
+ private String buildTable(CompilationUnit astRoot) {
+ return this.tableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.tableDeclarationAdapter, astRoot);
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.tableDeclarationAdapter, pos, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildTableDeclarationAdapter() {
+ return this.buildStringElementAdapter(this.getTableElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildTableAdapter() {
+ return this.buildStringElementAdapter(this.tableDeclarationAdapter);
+ }
+
+ protected abstract String getTableElementName();
+
+ // ***** unique
+ public Boolean getUnique() {
+ return this.unique;
+ }
+
+ public void setUnique(Boolean unique) {
+ if (this.attributeValueHasChanged(this.unique, unique)) {
+ this.unique = unique;
+ this.uniqueAdapter.setValue(unique);
+ }
+ }
+
+ private void syncUnique(Boolean astUnique) {
+ Boolean old = this.unique;
+ this.unique = astUnique;
+ this.firePropertyChanged(UNIQUE_PROPERTY, old, astUnique);
+ }
+
+ private Boolean buildUnique(CompilationUnit astRoot) {
+ return this.uniqueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getUniqueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.uniqueDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildUniqueDeclarationAdapter() {
+ return this.buildBooleanElementAdapter(this.getUniqueElementName());
+ }
+
+ private AnnotationElementAdapter<Boolean> buildUniqueAdapter() {
+ return this.buildBooleanElementAdapter(this.uniqueDeclarationAdapter);
+ }
+
+ protected abstract String getUniqueElementName();
+
+ // ***** nullable
+ public Boolean getNullable() {
+ return this.nullable;
+ }
+
+ public void setNullable(Boolean nullable) {
+ if (this.attributeValueHasChanged(this.nullable, nullable)) {
+ this.nullable = nullable;
+ this.nullableAdapter.setValue(nullable);
+ }
+ }
+
+ private void syncNullable(Boolean astNullable) {
+ Boolean old = this.nullable;
+ this.nullable = astNullable;
+ this.firePropertyChanged(NULLABLE_PROPERTY, old, astNullable);
+ }
+
+ private Boolean buildNullable(CompilationUnit astRoot) {
+ return this.nullableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNullableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nullableDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildNullableDeclarationAdapter() {
+ return this.buildBooleanElementAdapter(this.getNullableElementName());
+ }
+
+ private AnnotationElementAdapter<Boolean> buildNullableAdapter() {
+ return this.buildBooleanElementAdapter(this.nullableDeclarationAdapter);
+ }
+
+ protected abstract String getNullableElementName();
+
+ // ***** insertable
+ public Boolean getInsertable() {
+ return this.insertable;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ if (this.attributeValueHasChanged(this.insertable, insertable)) {
+ this.insertable = insertable;
+ this.insertableAdapter.setValue(insertable);
+ }
+ }
+
+ private void syncInsertable(Boolean astInsertable) {
+ Boolean old = this.insertable;
+ this.insertable = astInsertable;
+ this.firePropertyChanged(INSERTABLE_PROPERTY, old, astInsertable);
+ }
+
+ private Boolean buildInsertable(CompilationUnit astRoot) {
+ return this.insertableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getInsertableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.insertableDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildInsertableDeclarationAdapter() {
+ return this.buildBooleanElementAdapter(this.getInsertableElementName());
+ }
+
+ private AnnotationElementAdapter<Boolean> buildInsertableAdapter() {
+ return this.buildBooleanElementAdapter(this.insertableDeclarationAdapter);
+ }
+
+ protected abstract String getInsertableElementName();
+
+ // ***** updatable
+ public Boolean getUpdatable() {
+ return this.updatable;
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ if (this.attributeValueHasChanged(this.updatable, updatable)) {
+ this.updatable = updatable;
+ this.updatableAdapter.setValue(updatable);
+ }
+ }
+
+ private void syncUpdatable(Boolean astUpdatable) {
+ Boolean old = this.updatable;
+ this.updatable = astUpdatable;
+ this.firePropertyChanged(UPDATABLE_PROPERTY, old, astUpdatable);
+ }
+
+ private Boolean buildUpdatable(CompilationUnit astRoot) {
+ return this.updatableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.updatableDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Boolean> buildUpdatableDeclarationAdapter() {
+ return this.buildBooleanElementAdapter(this.getUpdatableElementName());
+ }
+
+ private AnnotationElementAdapter<Boolean> buildUpdatableAdapter() {
+ return this.buildBooleanElementAdapter(this.updatableDeclarationAdapter);
+ }
+
+ protected abstract String getUpdatableElementName();
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.table == null) &&
+ (this.unique == null) &&
+ (this.nullable == null) &&
+ (this.insertable == null) &&
+ (this.updatable == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.tableDeclarationAdapter = this.buildTableDeclarationAdapter();
+ this.tableAdapter = this.buildTableAdapter();
+ this.uniqueDeclarationAdapter = this.buildUniqueDeclarationAdapter();
+ this.uniqueAdapter = this.buildUniqueAdapter();
+ this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter();
+ this.nullableAdapter = this.buildNullableAdapter();
+ this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter();
+ this.insertableAdapter = this.buildInsertableAdapter();
+ this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter();
+ this.updatableAdapter = this.buildUpdatableAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(TABLE_PROPERTY, this.table);
+ this.table = null;
+ map.put(UNIQUE_PROPERTY, this.unique);
+ this.unique = null;
+ map.put(NULLABLE_PROPERTY, this.nullable);
+ this.nullable = null;
+ map.put(INSERTABLE_PROPERTY, this.insertable);
+ this.insertable = null;
+ map.put(UPDATABLE_PROPERTY, this.updatable);
+ this.updatable = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setTable((String) map.get(TABLE_PROPERTY));
+ this.setUnique((Boolean) map.get(UNIQUE_PROPERTY));
+ this.setNullable((Boolean) map.get(NULLABLE_PROPERTY));
+ this.setInsertable((Boolean) map.get(INSERTABLE_PROPERTY));
+ this.setUpdatable((Boolean) map.get(UPDATABLE_PROPERTY));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
new file mode 100644
index 0000000000..20d6cce5d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.EnumType;
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.Enumerated
+ * javax.persistence.MapKeyEnumerated
+ */
+public abstract class SourceBaseEnumeratedAnnotation
+ extends SourceAnnotation<Attribute>
+ implements EnumeratedAnnotation
+{
+ private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
+ private final AnnotationElementAdapter<String> valueAdapter;
+ private EnumType value;
+
+
+ protected SourceBaseEnumeratedAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
+ super(parent, attribute, daa);
+ this.valueDeclarationAdapter = new EnumDeclarationAnnotationElementAdapter(daa, getValueElementName());
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, this.valueDeclarationAdapter);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** EnumeratedAnnotation implementation **********
+
+ // ***** value
+ public EnumType getValue() {
+ return this.value;
+ }
+
+ public void setValue(EnumType value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(EnumType.toJavaAnnotationValue(value));
+ }
+ }
+
+ private void syncValue(EnumType astValue) {
+ EnumType old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private EnumType buildValue(CompilationUnit astRoot) {
+ return EnumType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.valueDeclarationAdapter, astRoot);
+ }
+
+ protected abstract String getValueElementName();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
new file mode 100644
index 0000000000..c32e64df6a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.BaseJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.JoinColumn</code>
+ * <li><code>javax.persistence.MapKeyJoinColumn</code>
+ * </ul>
+ */
+public abstract class SourceBaseJoinColumnAnnotation
+ extends SourceBaseColumnAnnotation
+ implements BaseJoinColumnAnnotation
+{
+ private DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
+ private AnnotationElementAdapter<String> referencedColumnNameAdapter;
+ private String referencedColumnName;
+
+
+ protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
+ this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
+ }
+
+ protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ }
+
+ protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.referencedColumnName = this.buildReferencedColumnName(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncReferencedColumnName(this.buildReferencedColumnName(astRoot));
+ }
+
+
+ //************ BaseJoinColumnAnnotation implementation ***************
+
+ // referenced column name
+ public String getReferencedColumnName() {
+ return this.referencedColumnName;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ if (this.attributeValueHasChanged(this.referencedColumnName, referencedColumnName)) {
+ this.referencedColumnName = referencedColumnName;
+ this.referencedColumnNameAdapter.setValue(referencedColumnName);
+ }
+ }
+
+ private void syncReferencedColumnName(String astReferencedColumnName) {
+ String old = this.referencedColumnName;
+ this.referencedColumnName = astReferencedColumnName;
+ this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, astReferencedColumnName);
+ }
+
+ private String buildReferencedColumnName(CompilationUnit astRoot) {
+ return this.referencedColumnNameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.referencedColumnNameDeclarationAdapter, astRoot);
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.referencedColumnNameDeclarationAdapter, pos, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildReferencedColumnNameDeclarationAdapter() {
+ return this.buildStringElementAdapter(this.getReferencedColumnNameElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildReferencedColumnNameAdapter() {
+ return this.buildStringElementAdapter(this.referencedColumnNameDeclarationAdapter);
+ }
+
+ protected abstract String getReferencedColumnNameElementName();
+
+
+ // ********** NestableAnnotation implementation **********
+
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.referencedColumnName == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
+ this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(REFERENCED_COLUMN_NAME_PROPERTY, this.referencedColumnName);
+ this.referencedColumnName = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setReferencedColumnName((String) map.get(REFERENCED_COLUMN_NAME_PROPERTY));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java
new file mode 100644
index 0000000000..770574872f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java
@@ -0,0 +1,426 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableUniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.Table</code>
+ * <li><code>javax.persistence.JoinTable</code>
+ * <li><code>javax.persistence.SecondaryTable</code>
+ * <li><code>javax.persistence.CollectionTable</code>
+ * </ul>
+ */
+public abstract class SourceBaseTableAnnotation
+ extends SourceAnnotation<Member>
+ implements BaseTableAnnotation
+{
+ DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ AnnotationElementAdapter<String> nameAdapter;
+ String name;
+
+ DeclarationAnnotationElementAdapter<String> schemaDeclarationAdapter;
+ AnnotationElementAdapter<String> schemaAdapter;
+ String schema;
+
+ DeclarationAnnotationElementAdapter<String> catalogDeclarationAdapter;
+ AnnotationElementAdapter<String> catalogAdapter;
+ String catalog;
+
+ final Vector<NestableUniqueConstraintAnnotation> uniqueConstraints = new Vector<NestableUniqueConstraintAnnotation>();
+ final UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
+
+
+ protected SourceBaseTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ }
+
+ protected SourceBaseTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.schemaDeclarationAdapter = this.buildSchemaDeclarationAdapter();
+ this.schemaAdapter = this.buildSchemaAdapter();
+ this.catalogDeclarationAdapter = this.buildCatalogDeclarationAdapter();
+ this.catalogAdapter = this.buildCatalogAdapter();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.schema = this.buildSchema(astRoot);
+ this.catalog = this.buildCatalog(astRoot);
+ AnnotationContainerTools.initialize(this.uniqueConstraintsContainer, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncSchema(this.buildSchema(astRoot));
+ this.syncCatalog(this.buildCatalog(astRoot));
+ AnnotationContainerTools.synchronize(this.uniqueConstraintsContainer, astRoot);
+ }
+
+ /**
+ * Return the uniqueConstraints element name
+ */
+ protected abstract String getUniqueConstraintsElementName();
+
+
+ // ********** BaseTableAnnotation implementation **********
+
+ public boolean isSpecified() {
+ return true;
+ }
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
+ }
+
+ /**
+ * Build a declaration element adapter for the table's 'name' element.
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter();
+
+ private AnnotationElementAdapter<String> buildNameAdapter() {
+ return this.buildAnnotationElementAdapter(this.nameDeclarationAdapter);
+ }
+
+ // ***** schema
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String schema) {
+ if (this.attributeValueHasChanged(this.schema, schema)) {
+ this.schema = schema;
+ this.schemaAdapter.setValue(schema);
+ }
+ }
+
+ private void syncSchema(String astSchema) {
+ String old = this.schema;
+ this.schema = astSchema;
+ this.firePropertyChanged(SCHEMA_PROPERTY, old, astSchema);
+ }
+
+ private String buildSchema(CompilationUnit astRoot) {
+ return this.schemaAdapter.getValue(astRoot);
+ }
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.schemaDeclarationAdapter, astRoot);
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.schemaDeclarationAdapter, pos, astRoot);
+ }
+
+ /**
+ * Build a declaration element adapter for the table's 'schema' element.
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> buildSchemaDeclarationAdapter();
+
+ private AnnotationElementAdapter<String> buildSchemaAdapter() {
+ return this.buildAnnotationElementAdapter(this.schemaDeclarationAdapter);
+ }
+
+ // ***** catalog
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String catalog) {
+ if (this.attributeValueHasChanged(this.catalog, catalog)) {
+ this.catalog = catalog;
+ this.catalogAdapter.setValue(catalog);
+ }
+ }
+
+ private void syncCatalog(String astCatalog) {
+ String old = this.catalog;
+ this.catalog = astCatalog;
+ this.firePropertyChanged(CATALOG_PROPERTY, old, astCatalog);
+ }
+
+ private String buildCatalog(CompilationUnit astRoot) {
+ return this.catalogAdapter.getValue(astRoot);
+ }
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.catalogDeclarationAdapter, astRoot);
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.catalogDeclarationAdapter, pos, astRoot);
+ }
+
+ /**
+ * Build a declaration element adapter for the table's 'catalog' element
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> buildCatalogDeclarationAdapter();
+
+ private AnnotationElementAdapter<String> buildCatalogAdapter() {
+ return this.buildAnnotationElementAdapter(this.catalogDeclarationAdapter);
+ }
+
+ // ***** unique constraints
+ public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
+ return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
+ }
+
+ Iterable<NestableUniqueConstraintAnnotation> getNestableUniqueConstraints() {
+ return new LiveCloneIterable<NestableUniqueConstraintAnnotation>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public NestableUniqueConstraintAnnotation uniqueConstraintAt(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
+ return this.uniqueConstraints.indexOf(uniqueConstraint);
+ }
+
+ private NestableUniqueConstraintAnnotation addUniqueConstraint() {
+ return this.addUniqueConstraint(this.uniqueConstraints.size());
+ }
+
+ public NestableUniqueConstraintAnnotation addUniqueConstraint(int index) {
+ return (NestableUniqueConstraintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.uniqueConstraintsContainer);
+ }
+
+ NestableUniqueConstraintAnnotation addUniqueConstraint_() {
+ return this.addUniqueConstraint_(this.uniqueConstraints.size());
+ }
+
+ private NestableUniqueConstraintAnnotation addUniqueConstraint_(int index) {
+ NestableUniqueConstraintAnnotation uniqueConstraint = this.buildUniqueConstraint(index);
+ this.uniqueConstraints.add(index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ void syncAddUniqueConstraint(Annotation astAnnotation) {
+ int index = this.uniqueConstraints.size();
+ NestableUniqueConstraintAnnotation uniqueConstraint = this.addUniqueConstraint_(index);
+ uniqueConstraint.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
+ }
+
+ NestableUniqueConstraintAnnotation buildUniqueConstraint(int index) {
+ return new SourceUniqueConstraintAnnotation(this, this.annotatedElement, buildUniqueConstraintAnnotationAdapter(index));
+ }
+
+ IndexedDeclarationAnnotationAdapter buildUniqueConstraintAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(this.daa, getUniqueConstraintsElementName(), index, JPA.UNIQUE_CONSTRAINT);
+ }
+
+ void uniqueConstraintAdded(int index, NestableUniqueConstraintAnnotation constraint) {
+ this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, constraint);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.uniqueConstraintsContainer);
+ }
+
+ NestableUniqueConstraintAnnotation moveUniqueConstraint_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public void removeUniqueConstraint(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.uniqueConstraintsContainer);
+ }
+
+ NestableUniqueConstraintAnnotation removeUniqueConstraint_(int index) {
+ return this.uniqueConstraints.remove(index);
+ }
+
+ void syncRemoveUniqueConstraints(int index) {
+ this.removeItemsFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+
+ // ********** unique constraint container **********
+
+ /**
+ * adapt the AnnotationContainer interface to the table's unique constraints
+ */
+ class UniqueConstraintsAnnotationContainer
+ implements AnnotationContainer<NestableUniqueConstraintAnnotation>
+ {
+ public Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return SourceBaseTableAnnotation.this.getAstAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return SourceBaseTableAnnotation.this.getUniqueConstraintsElementName();
+ }
+
+ public String getNestedAnnotationName() {
+ return UniqueConstraintAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableUniqueConstraintAnnotation> getNestedAnnotations() {
+ return SourceBaseTableAnnotation.this.getNestableUniqueConstraints();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceBaseTableAnnotation.this.uniqueConstraintsSize();
+ }
+
+ public NestableUniqueConstraintAnnotation addNestedAnnotation() {
+ return SourceBaseTableAnnotation.this.addUniqueConstraint_();
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ SourceBaseTableAnnotation.this.syncAddUniqueConstraint(astAnnotation);
+ }
+
+ public NestableUniqueConstraintAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceBaseTableAnnotation.this.moveUniqueConstraint_(targetIndex, sourceIndex);
+ }
+
+ public NestableUniqueConstraintAnnotation removeNestedAnnotation(int index) {
+ return SourceBaseTableAnnotation.this.removeUniqueConstraint_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceBaseTableAnnotation.this.syncRemoveUniqueConstraints(index);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null) &&
+ (this.schema == null) &&
+ (this.catalog == null) &&
+ this.uniqueConstraints.isEmpty();
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.schemaDeclarationAdapter = this.buildSchemaDeclarationAdapter();
+ this.schemaAdapter = this.buildSchemaAdapter();
+ this.catalogDeclarationAdapter = this.buildCatalogDeclarationAdapter();
+ this.catalogAdapter = this.buildCatalogAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+
+ map.put(NAME_PROPERTY, this.name);
+ this.name = null;
+ map.put(SCHEMA_PROPERTY, this.schema);
+ this.schema = null;
+ map.put(CATALOG_PROPERTY, this.catalog);
+ this.catalog = null;
+
+ List<Map<String, Object>> constraintsState = this.buildStateList(this.uniqueConstraints.size());
+ for (NestableUniqueConstraintAnnotation constraint : this.getNestableUniqueConstraints()) {
+ Map<String, Object> constraintState = new HashMap<String, Object>();
+ constraint.storeOn(constraintState);
+ constraintsState.add(constraintState);
+ }
+ map.put(UNIQUE_CONSTRAINTS_LIST, constraintsState);
+ this.uniqueConstraints.clear();
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+
+ this.setName((String) map.get(NAME_PROPERTY));
+ this.setSchema((String) map.get(SCHEMA_PROPERTY));
+ this.setCatalog((String) map.get(CATALOG_PROPERTY));
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> constraintsState = (List<Map<String, Object>>) map.get(UNIQUE_CONSTRAINTS_LIST);
+ for (Map<String, Object> constraintState : constraintsState) {
+ this.addUniqueConstraint().restoreFrom(constraintState);
+ }
+ }
+
+ private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
new file mode 100644
index 0000000000..abc301e316
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
+
+/**
+ * Abstract implementation for JPA annotations
+ * javax.persistence.Temporal
+ * javax.persistence.MapKeyTemporal
+ */
+public abstract class SourceBaseTemporalAnnotation
+ extends SourceAnnotation<Attribute>
+ implements TemporalAnnotation
+{
+ protected final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
+ private final AnnotationElementAdapter<String> valueAdapter;
+ private TemporalType value;
+
+
+ protected SourceBaseTemporalAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
+ super(parent, attribute, daa);
+ this.valueDeclarationAdapter = new EnumDeclarationAnnotationElementAdapter(daa, getValueElementName());
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, this.valueDeclarationAdapter);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** TemporalAnnotation implementation **********
+
+ // ***** value
+ public TemporalType getValue() {
+ return this.value;
+ }
+
+ public void setValue(TemporalType value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(TemporalType.toJavaAnnotationValue(value));
+ }
+ }
+
+ private void syncValue(TemporalType astValue) {
+ TemporalType old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private TemporalType buildValue(CompilationUnit astRoot) {
+ return TemporalType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.valueDeclarationAdapter, astRoot);
+ }
+
+ protected abstract String getValueElementName();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java
new file mode 100644
index 0000000000..ee9c9d9138
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.FetchType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Basic
+ */
+public final class SourceBasicAnnotation
+ extends SourceAnnotation<Attribute>
+ implements BasicAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
+ private final AnnotationElementAdapter<Boolean> optionalAdapter;
+ private Boolean optional;
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+ private final AnnotationElementAdapter<String> fetchAdapter;
+ private FetchType fetch;
+
+
+ public SourceBasicAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.optionalAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(attribute, OPTIONAL_ADAPTER);
+ this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.optional = this.buildOptional(astRoot);
+ this.fetch = this.buildFetch(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncOptional(this.buildOptional(astRoot));
+ this.syncFetch(this.buildFetch(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.optional == null) &&
+ (this.fetch == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.fetch);
+ }
+
+
+ //*************** Basic implementation ****************
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ if (this.attributeValueHasChanged(this.optional, optional)) {
+ this.optional = optional;
+ this.optionalAdapter.setValue(optional);
+ }
+ }
+
+ private void syncOptional(Boolean astOptional) {
+ Boolean old = this.optional;
+ this.optional = astOptional;
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, astOptional);
+ }
+
+ private Boolean buildOptional(CompilationUnit astRoot) {
+ return this.optionalAdapter.getValue(astRoot);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
+ }
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ if (this.attributeValueHasChanged(this.fetch, fetch)) {
+ this.fetch = fetch;
+ this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
+ }
+ }
+
+ private void syncFetch(FetchType astFetch) {
+ FetchType old = this.fetch;
+ this.fetch = astFetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, astFetch);
+ }
+
+ private FetchType buildFetch(CompilationUnit astRoot) {
+ return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(FETCH_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__OPTIONAL, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__FETCH);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java
new file mode 100644
index 0000000000..b0b90584bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <code>javax.persistence.Column</code>
+ */
+public final class SourceColumnAnnotation
+ extends SourceCompleteColumnAnnotation
+ implements ColumnAnnotation
+{
+ // 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);
+
+
+ public SourceColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ********** SourceNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** SourceBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA.COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA.COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA.COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA.COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA.COLUMN__UPDATABLE;
+ }
+
+ // ********** SourceCompleteColumnAnnotation implementation **********
+
+ @Override
+ protected String getLengthElementName() {
+ return JPA.COLUMN__LENGTH;
+ }
+
+ @Override
+ protected String getPrecisionElementName() {
+ return JPA.COLUMN__PRECISION;
+ }
+
+ @Override
+ protected String getScaleElementName() {
+ return JPA.COLUMN__SCALE;
+ }
+
+
+ // ********** static methods **********
+
+ static ColumnAnnotation createAttributeOverrideColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
+ return new SourceColumnAnnotation(parent, member, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter));
+ }
+
+ static DeclarationAnnotationAdapter buildAttributeOverrideAnnotationAdapter(DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
+ return new NestedDeclarationAnnotationAdapter(attributeOverrideAnnotationAdapter, JPA.ATTRIBUTE_OVERRIDE__COLUMN, JPA.COLUMN);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java
new file mode 100644
index 0000000000..d497b1f4a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.JptResourceModelListener;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
+import org.eclipse.jpt.common.utility.CommandExecutor;
+import org.eclipse.jpt.common.utility.internal.ListenerList;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+
+/**
+ * Java compilation unit (source file)
+ */
+public abstract class SourceCompilationUnit
+ extends SourceNode
+ implements JavaResourceCompilationUnit
+{
+ /** JDT compilation unit */
+ final ICompilationUnit compilationUnit;
+
+ /** pluggable annotation provider */
+ private final JpaAnnotationProvider annotationProvider;
+
+ /** improved annotation formatting */
+ private final AnnotationEditFormatter annotationEditFormatter;
+
+ /** pluggable executor that allows the document to be modified on another thread */
+ private final CommandExecutor modifySharedDocumentCommandExecutor;
+
+ /** listeners notified whenever the resource model changes */
+ private final ListenerList<JptResourceModelListener> resourceModelListenerList;
+
+
+ // ********** construction **********
+
+ protected SourceCompilationUnit(
+ ICompilationUnit compilationUnit,
+ JpaAnnotationProvider annotationProvider,
+ AnnotationEditFormatter annotationEditFormatter,
+ CommandExecutor modifySharedDocumentCommandExecutor) {
+ super(null); // the JPA compilation unit is the root of its sub-tree
+ this.compilationUnit = compilationUnit;
+ this.annotationProvider = annotationProvider;
+ this.annotationEditFormatter = annotationEditFormatter;
+ this.modifySharedDocumentCommandExecutor = modifySharedDocumentCommandExecutor;
+ this.resourceModelListenerList = new ListenerList<JptResourceModelListener>(JptResourceModelListener.class);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // never called?
+ }
+
+ void openCompilationUnit() {
+ try {
+ this.compilationUnit.open(null);
+ } catch (JavaModelException ex) {
+ // do nothing - we just won't have a primary type in this case
+ }
+ }
+
+ void closeCompilationUnit() {
+ try {
+ this.compilationUnit.close();
+ } catch (JavaModelException ex) {
+ // hmmm
+ }
+ }
+
+
+ // ********** AbstractJavaResourceNode overrides **********
+
+ @Override
+ protected boolean requiresParent() {
+ return false;
+ }
+
+ @Override
+ public JavaResourceCompilationUnit getRoot() {
+ return this;
+ }
+
+ @Override
+ public IFile getFile() {
+ return (IFile) this.compilationUnit.getResource();
+ }
+
+ @Override
+ public JpaAnnotationProvider getAnnotationProvider() {
+ return this.annotationProvider;
+ }
+
+
+ // ********** JavaResourceNode implementation **********
+
+ public TextRange getTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+
+ // ********** JavaResourceNode.Root implementation **********
+
+ public void resourceModelChanged() {
+ for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
+ listener.resourceModelChanged(this);
+ }
+ }
+
+
+ // ********** JavaResourceCompilationUnit implementation **********
+
+ public ICompilationUnit getCompilationUnit() {
+ return this.compilationUnit;
+ }
+
+ public CommandExecutor getModifySharedDocumentCommandExecutor() {
+ return this.modifySharedDocumentCommandExecutor;
+ }
+
+ public AnnotationEditFormatter getAnnotationEditFormatter() {
+ return this.annotationEditFormatter;
+ }
+
+ @Override
+ public CompilationUnit buildASTRoot() {
+ return ASTTools.buildASTRoot(this.compilationUnit);
+ }
+
+
+ // ********** JptResourceModel implementation **********
+
+ public void addResourceModelListener(JptResourceModelListener listener) {
+ this.resourceModelListenerList.add(listener);
+ }
+
+ public void removeResourceModelListener(JptResourceModelListener listener) {
+ this.resourceModelListenerList.remove(listener);
+ }
+
+
+ // ********** Java changes **********
+
+ public void synchronizeWithJavaSource() {
+ this.synchronizeWith(this.buildASTRoot());
+ }
+
+
+ // ********** internal **********
+
+ String getCompilationUnitName() {
+ return this.removeJavaExtension(this.compilationUnit.getElementName());
+ }
+
+ private String removeJavaExtension(String fileName) {
+ int index = fileName.lastIndexOf(".java"); //$NON-NLS-1$
+ return (index == -1) ? fileName : fileName.substring(0, index);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getCompilationUnitName());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
new file mode 100644
index 0000000000..0401a234ad
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.Column</code>
+ * <li><code>javax.persistence.MapKeyColumn</code>
+ * </ul>
+ */
+public abstract class SourceCompleteColumnAnnotation
+ extends SourceBaseColumnAnnotation
+ implements CompleteColumnAnnotation
+{
+ protected DeclarationAnnotationElementAdapter<Integer> lengthDeclarationAdapter;
+ protected AnnotationElementAdapter<Integer> lengthAdapter;
+ protected Integer length;
+
+ protected DeclarationAnnotationElementAdapter<Integer> precisionDeclarationAdapter;
+ protected AnnotationElementAdapter<Integer> precisionAdapter;
+ protected Integer precision;
+
+ protected DeclarationAnnotationElementAdapter<Integer> scaleDeclarationAdapter;
+ protected AnnotationElementAdapter<Integer> scaleAdapter;
+ protected Integer scale;
+
+
+ protected SourceCompleteColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
+ this.lengthAdapter = this.buildLengthAdapter();
+ this.precisionDeclarationAdapter = this.buildPrecisionDeclarationAdapter();
+ this.precisionAdapter = this.buildPrecisionAdapter();
+ this.scaleDeclarationAdapter = this.buildScaleDeclarationAdapter();
+ this.scaleAdapter = this.buildScaleAdapter();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.length = this.buildLength(astRoot);
+ this.precision = this.buildPrecision(astRoot);
+ this.scale = this.buildScale(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncLength(this.buildLength(astRoot));
+ this.syncPrecision(this.buildPrecision(astRoot));
+ this.syncScale(this.buildScale(astRoot));
+ }
+
+
+ // ********** ColumnAnnotation implementation **********
+
+ // ***** length
+ public Integer getLength() {
+ return this.length;
+ }
+
+ public void setLength(Integer length) {
+ if (this.attributeValueHasChanged(this.length, length)) {
+ this.length = length;
+ this.lengthAdapter.setValue(length);
+ }
+ }
+
+ private void syncLength(Integer astLength) {
+ Integer old = this.length;
+ this.length = astLength;
+ this.firePropertyChanged(LENGTH_PROPERTY, old, astLength);
+ }
+
+ private Integer buildLength(CompilationUnit astRoot) {
+ return this.lengthAdapter.getValue(astRoot);
+ }
+
+ public TextRange getLengthTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.lengthDeclarationAdapter, astRoot);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Integer> buildLengthDeclarationAdapter() {
+ return this.buildIntegerElementAdapter(this.getLengthElementName());
+ }
+
+ protected AnnotationElementAdapter<Integer> buildLengthAdapter() {
+ return this.buildIntegerElementAdapter(this.lengthDeclarationAdapter);
+ }
+
+ protected abstract String getLengthElementName();
+
+ // ***** precision
+ public Integer getPrecision() {
+ return this.precision;
+ }
+
+ public void setPrecision(Integer precision) {
+ if (this.attributeValueHasChanged(this.precision, precision)) {
+ this.precision = precision;
+ this.precisionAdapter.setValue(precision);
+ }
+ }
+
+ private void syncPrecision(Integer astPrecision) {
+ Integer old = this.precision;
+ this.precision = astPrecision;
+ this.firePropertyChanged(PRECISION_PROPERTY, old, astPrecision);
+ }
+
+ private Integer buildPrecision(CompilationUnit astRoot) {
+ return this.precisionAdapter.getValue(astRoot);
+ }
+
+ public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.precisionDeclarationAdapter, astRoot);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Integer> buildPrecisionDeclarationAdapter() {
+ return this.buildIntegerElementAdapter(this.getPrecisionElementName());
+ }
+
+ protected AnnotationElementAdapter<Integer> buildPrecisionAdapter() {
+ return this.buildIntegerElementAdapter(this.precisionDeclarationAdapter);
+ }
+
+ protected abstract String getPrecisionElementName();
+
+ // ***** scale
+ public Integer getScale() {
+ return this.scale;
+ }
+
+ public void setScale(Integer scale) {
+ if (this.attributeValueHasChanged(this.scale, scale)) {
+ this.scale = scale;
+ this.scaleAdapter.setValue(scale);
+ }
+ }
+
+ private void syncScale(Integer astScale) {
+ Integer old = this.scale;
+ this.scale = astScale;
+ this.firePropertyChanged(SCALE_PROPERTY, old, astScale);
+ }
+
+ private Integer buildScale(CompilationUnit astRoot) {
+ return this.scaleAdapter.getValue(astRoot);
+ }
+
+ public TextRange getScaleTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.scaleDeclarationAdapter, astRoot);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Integer> buildScaleDeclarationAdapter() {
+ return this.buildIntegerElementAdapter(this.getScaleElementName());
+ }
+
+ protected AnnotationElementAdapter<Integer> buildScaleAdapter() {
+ return this.buildIntegerElementAdapter(this.scaleDeclarationAdapter);
+ }
+
+ protected abstract String getScaleElementName();
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.length == null) &&
+ (this.precision == null) &&
+ (this.scale == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
+ this.lengthAdapter = this.buildLengthAdapter();
+ this.precisionDeclarationAdapter = this.buildPrecisionDeclarationAdapter();
+ this.precisionAdapter = this.buildPrecisionAdapter();
+ this.scaleDeclarationAdapter = this.buildScaleDeclarationAdapter();
+ this.scaleAdapter = this.buildScaleAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(LENGTH_PROPERTY, this.length);
+ this.length = null;
+ map.put(PRECISION_PROPERTY, this.precision);
+ this.precision = null;
+ map.put(SCALE_PROPERTY, this.scale);
+ this.scale = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setLength((Integer) map.get(LENGTH_PROPERTY));
+ this.setPrecision((Integer) map.get(PRECISION_PROPERTY));
+ this.setScale((Integer) map.get(SCALE_PROPERTY));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
new file mode 100644
index 0000000000..2957c055a4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * <code>javax.persistence.DiscriminatorColumn</code>
+ */
+public final class SourceDiscriminatorColumnAnnotation
+ extends SourceNamedColumnAnnotation
+ implements DiscriminatorColumnAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> DISCRIMINATOR_TYPE_DECLARATION_ADAPTER = buildDiscriminatorTypeDeclarationAdapter();
+ private AnnotationElementAdapter<String> discriminatorTypeAdapter;
+ private DiscriminatorType discriminatorType;
+
+ private DeclarationAnnotationElementAdapter<Integer> lengthDeclarationAdapter;
+ private AnnotationElementAdapter<Integer> lengthAdapter;
+ private Integer length;
+
+
+ public SourceDiscriminatorColumnAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.discriminatorTypeAdapter = this.buildDiscriminatorTypeAdapter();
+ this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
+ this.lengthAdapter = this.buildLengthAdapter();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.discriminatorType = this.buildDiscriminatorType(astRoot);
+ this.length = this.buildLength(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncLength(this.buildLength(astRoot));
+ this.syncDiscriminatorType(this.buildDiscriminatorType(astRoot));
+ }
+
+
+ // ********** JavaSourceNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.DISCRIMINATOR_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** DiscriminatorColumn implementation **********
+
+ // ***** discriminator type
+ public DiscriminatorType getDiscriminatorType() {
+ return this.discriminatorType;
+ }
+
+ public void setDiscriminatorType(DiscriminatorType discriminatorType) {
+ if (this.attributeValueHasChanged(this.discriminatorType, discriminatorType)) {
+ this.discriminatorType = discriminatorType;
+ this.discriminatorTypeAdapter.setValue(DiscriminatorType.toJavaAnnotationValue(discriminatorType));
+ }
+ }
+
+ private void syncDiscriminatorType(DiscriminatorType astDiscriminatorType) {
+ DiscriminatorType old = this.discriminatorType;
+ this.discriminatorType = astDiscriminatorType;
+ this.firePropertyChanged(DISCRIMINATOR_TYPE_PROPERTY, old, astDiscriminatorType);
+ }
+
+ private DiscriminatorType buildDiscriminatorType(CompilationUnit astRoot) {
+ return DiscriminatorType.fromJavaAnnotationValue(this.discriminatorTypeAdapter.getValue(astRoot));
+ }
+
+ private AnnotationElementAdapter<String> buildDiscriminatorTypeAdapter() {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, DISCRIMINATOR_TYPE_DECLARATION_ADAPTER);
+ }
+
+ // ***** length
+ public Integer getLength() {
+ return this.length;
+ }
+
+ public void setLength(Integer length) {
+ if (this.attributeValueHasChanged(this.length, length)) {
+ this.length = length;
+ this.lengthAdapter.setValue(length);
+ }
+ }
+
+ private void syncLength(Integer astLength) {
+ Integer old = this.length;
+ this.length = astLength;
+ this.firePropertyChanged(LENGTH_PROPERTY, old, astLength);
+ }
+
+ private Integer buildLength(CompilationUnit astRoot) {
+ return this.lengthAdapter.getValue(astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<Integer> buildLengthDeclarationAdapter() {
+ return this.buildIntegerElementAdapter(JPA.DISCRIMINATOR_COLUMN__LENGTH);
+ }
+
+ private AnnotationElementAdapter<Integer> buildLengthAdapter() {
+ return this.buildIntegerElementAdapter(this.lengthDeclarationAdapter);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.discriminatorType == null) &&
+ (this.length == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.discriminatorTypeAdapter = this.buildDiscriminatorTypeAdapter();
+ this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
+ this.lengthAdapter = this.buildLengthAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(DISCRIMINATOR_TYPE_PROPERTY, this.discriminatorType);
+ this.discriminatorType = null;
+ map.put(LENGTH_PROPERTY, this.length);
+ this.length = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setDiscriminatorType((DiscriminatorType) map.get(DISCRIMINATOR_TYPE_PROPERTY));
+ this.setLength((Integer) map.get(LENGTH_PROPERTY));
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildDiscriminatorTypeDeclarationAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
new file mode 100644
index 0000000000..319fb9370e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.DiscriminatorValue
+ */
+public final class SourceDiscriminatorValueAnnotation
+ extends SourceAnnotation<Type>
+ implements DiscriminatorValueAnnotation
+{
+ 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;
+
+
+ public SourceDiscriminatorValueAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** DiscriminatorValueAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(String astValue) {
+ String old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_VALUE__VALUE);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
new file mode 100644
index 0000000000..f613e515cb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Embeddable
+ */
+public final class SourceEmbeddableAnnotation
+ extends SourceAnnotation<Type>
+ implements EmbeddableAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceEmbeddableAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
new file mode 100644
index 0000000000..30b31f86ed
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Embedded
+ */
+public final class SourceEmbeddedAnnotation
+ extends SourceAnnotation<Attribute>
+ implements EmbeddedAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceEmbeddedAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
new file mode 100644
index 0000000000..fb9c29db44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.EmbeddedId
+ */
+public final class SourceEmbeddedIdAnnotation
+ extends SourceAnnotation<Attribute>
+ implements EmbeddedIdAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceEmbeddedIdAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java
new file mode 100644
index 0000000000..50fb7d3e9f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Entity
+ */
+public final class SourceEntityAnnotation
+ extends SourceAnnotation<Type>
+ implements EntityAnnotation
+{
+ public 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;
+
+
+ public SourceEntityAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.nameAdapter = new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, NAME_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** EntityAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(NAME_ADAPTER, astRoot);
+ }
+
+
+ //*********** static methods ****************
+
+ private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ENTITY__NAME);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
new file mode 100644
index 0000000000..7d53beac94
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Enumerated
+ */
+public final class SourceEnumeratedAnnotation
+ extends SourceBaseEnumeratedAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public SourceEnumeratedAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA.ENUMERATED__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
new file mode 100644
index 0000000000..81ad170950
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.GenerationType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.GeneratedValue
+ */
+public final class SourceGeneratedValueAnnotation
+ extends SourceAnnotation<Member>
+ implements GeneratedValueAnnotation
+{
+ 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 GenerationType strategy;
+
+ private static final DeclarationAnnotationElementAdapter<String> GENERATOR_ADAPTER = buildGeneratorAdapter();
+ private final AnnotationElementAdapter<String> generatorAdapter;
+ private String generator;
+
+
+ public SourceGeneratedValueAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, STRATEGY_ADAPTER);
+ this.generatorAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, GENERATOR_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.strategy = this.buildStrategy(astRoot);
+ this.generator = this.buildGenerator(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncStrategy(this.buildStrategy(astRoot));
+ this.syncGenerator(this.buildGenerator(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.strategy == null) &&
+ (this.generator == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.strategy);
+ }
+
+
+ // ********** GeneratedValueAnnotation implementation **********
+
+ // ***** strategy
+ public GenerationType getStrategy() {
+ return this.strategy;
+ }
+
+ public void setStrategy(GenerationType strategy) {
+ if (this.attributeValueHasChanged(this.strategy, strategy)) {
+ this.strategy = strategy;
+ this.strategyAdapter.setValue(GenerationType.toJavaAnnotationValue(strategy));
+ }
+ }
+
+ private void syncStrategy(GenerationType astStrategy) {
+ GenerationType old = this.strategy;
+ this.strategy = astStrategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, astStrategy);
+ }
+
+ private GenerationType buildStrategy(CompilationUnit astRoot) {
+ return GenerationType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot));
+ }
+
+ public TextRange getStrategyTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(STRATEGY_ADAPTER, astRoot);
+ }
+
+ // ***** generator
+ public String getGenerator() {
+ return this.generator;
+ }
+
+ public void setGenerator(String generator) {
+ if (this.attributeValueHasChanged(this.generator, generator)) {
+ this.generator = generator;
+ this.generatorAdapter.setValue(generator);
+ }
+ }
+
+ private void syncGenerator(String astGenerator) {
+ String old = this.generator;
+ this.generator = astGenerator;
+ this.firePropertyChanged(GENERATOR_PROPERTY, old, astGenerator);
+ }
+
+ private String buildGenerator(CompilationUnit astRoot) {
+ return this.generatorAdapter.getValue(astRoot);
+ }
+
+ public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(GENERATOR_ADAPTER, astRoot);
+ }
+
+ public boolean generatorTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(GENERATOR_ADAPTER, pos, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__STRATEGY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildGeneratorAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__GENERATOR);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
new file mode 100644
index 0000000000..9bf1ae0dbd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * javax.persistence.SequenceGenerator
+ * javax.persistence.TableGenerator
+ */
+abstract class SourceGeneratorAnnotation
+ extends SourceAnnotation<Member>
+ implements GeneratorAnnotation
+{
+ final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ final AnnotationElementAdapter<String> nameAdapter;
+ String name;
+
+ final DeclarationAnnotationElementAdapter<Integer> initialValueDeclarationAdapter;
+ final AnnotationElementAdapter<Integer> initialValueAdapter;
+ Integer initialValue;
+
+ final DeclarationAnnotationElementAdapter<Integer> allocationSizeDeclarationAdapter;
+ final AnnotationElementAdapter<Integer> allocationSizeAdapter;
+ Integer allocationSize;
+
+
+ SourceGeneratorAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ this.nameDeclarationAdapter = this.getNameAdapter();
+ this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
+ this.initialValueDeclarationAdapter = this.getInitialValueAdapter();
+ this.initialValueAdapter = this.buildIntegerAdapter(this.initialValueDeclarationAdapter);
+ this.allocationSizeDeclarationAdapter = this.getAllocationSizeAdapter();
+ this.allocationSizeAdapter = this.buildIntegerAdapter(this.allocationSizeDeclarationAdapter);
+ }
+
+ protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
+ }
+
+ protected AnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<Integer>(this.annotatedElement, daea);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.initialValue = this.buildInitialValue(astRoot);
+ this.allocationSize = this.buildAllocationSize(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncInitialValue(this.buildInitialValue(astRoot));
+ this.syncAllocationSize(this.buildAllocationSize(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null) &&
+ (this.initialValue == null) &&
+ (this.allocationSize == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** GeneratorAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ abstract DeclarationAnnotationElementAdapter<String> getNameAdapter();
+
+ // ***** initial value
+ public Integer getInitialValue() {
+ return this.initialValue;
+ }
+
+ public void setInitialValue(Integer initialValue) {
+ if (this.attributeValueHasChanged(this.initialValue, initialValue)) {
+ this.initialValue = initialValue;
+ this.initialValueAdapter.setValue(initialValue);
+ }
+ }
+
+ private void syncInitialValue(Integer astIinitialValue) {
+ Integer old = this.initialValue;
+ this.initialValue = astIinitialValue;
+ this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, astIinitialValue);
+ }
+
+ private Integer buildInitialValue(CompilationUnit astRoot) {
+ return this.initialValueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getInitialValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.initialValueDeclarationAdapter, astRoot);
+ }
+
+ abstract DeclarationAnnotationElementAdapter<Integer> getInitialValueAdapter();
+
+ // ***** allocation size
+ public Integer getAllocationSize() {
+ return this.allocationSize;
+ }
+
+ public void setAllocationSize(Integer allocationSize) {
+ if (this.attributeValueHasChanged(this.allocationSize, allocationSize)) {
+ this.allocationSize = allocationSize;
+ this.allocationSizeAdapter.setValue(allocationSize);
+ }
+ }
+
+ private void syncAllocationSize(Integer astAllocationSize) {
+ Integer old = this.allocationSize;
+ this.allocationSize = astAllocationSize;
+ this.firePropertyChanged(ALLOCATION_SIZE_PROPERTY, old, astAllocationSize);
+ }
+
+ private Integer buildAllocationSize(CompilationUnit astRoot) {
+ return this.allocationSizeAdapter.getValue(astRoot);
+ }
+
+ public TextRange getAllocationSizeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.allocationSizeDeclarationAdapter, astRoot);
+ }
+
+ abstract DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter();
+
+
+ // ********** static methods **********
+
+ static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
+ }
+
+ static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java
new file mode 100644
index 0000000000..3a9cb91a67
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Id
+ */
+public final class SourceIdAnnotation
+ extends SourceAnnotation<Attribute>
+ implements IdAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceIdAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java
new file mode 100644
index 0000000000..7eb7d61573
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.IdClass
+ */
+public final class SourceIdClassAnnotation
+ extends SourceAnnotation<Type>
+ implements IdClassAnnotation
+{
+ 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;
+
+ /**
+ * We cache this here because we use the AST bindings to calculate it.<ul>
+ * <li>We do not return a calculated value because it would force a JDT
+ * parse with <em>every</em> context model <em>update</em>. (This property
+ * is one that is read during the context model <em>update</em>, as opposed
+ * to the context model <em>sync</em>.)
+ * <li>We do not calculate it during {@link #synchronizeWith(CompilationUnit)}
+ * because<ul>
+ * <li>when the class name ({@link #value}) is changed via API from the UI,
+ * we are ignoring Java change events; so we would need to calculate it
+ * during {@link #setValue(String)} which might slow down our UI a bit (with
+ * the additional parse), and setting the flag is effectively equivalent
+ * <li>when the class name ({@link #value}) is changed via API from a test,
+ * we are handling Java change events synchronously;
+ * so we would detect a change in the fully-qualified class name during
+ * {@link #synchronizeWith(CompilationUnit)}, triggering an
+ * unwanted context model <em>sync</em> (Any resource model changes via
+ * API should <em>not</em> trigger a context model <em>sync</em>.)
+ * </ul>
+ * </ul>
+ * Also, there is no change notification tied to this property since it
+ * would be fired at the same times as the change events for {@link #value}.
+ */
+ // TODO any of a number of things can invalidate this: classpath change,
+ // added or removed matching class
+ private String fullyQualifiedClassName;
+ // we need a flag since the f-q name can be null
+ private boolean fqClassNameStale = true;
+
+
+ public SourceIdClassAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** IdClassAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.fqClassNameStale = true;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(String astValue) {
+ if (this.attributeValueHasChanged(this.value, astValue)) {
+ this.syncValue_(astValue);
+ }
+ }
+
+ private void syncValue_(String astValue) {
+ String old = this.value;
+ this.value = astValue;
+ this.fqClassNameStale = true;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ // ***** fully-qualified class name
+ public String getFullyQualifiedClassName() {
+ if (this.fqClassNameStale) {
+ this.fullyQualifiedClassName = this.buildFullyQualifiedClassName();
+ this.fqClassNameStale = false;
+ }
+ return this.fullyQualifiedClassName;
+ }
+
+ private String buildFullyQualifiedClassName() {
+ return (this.value == null) ? null : this.buildFullyQualifiedClassName_();
+ }
+
+ private String buildFullyQualifiedClassName_() {
+ return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot()));
+ }
+
+
+ // ********** static methods **********
+
+ protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA.ID_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java
new file mode 100644
index 0000000000..580f00164a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.Inheritance
+ */
+public final class SourceInheritanceAnnotation
+ extends SourceAnnotation<Type>
+ implements InheritanceAnnotation
+{
+ 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;
+
+
+ public SourceInheritanceAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, STRATEGY_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.strategy = this.buildStrategy(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncStrategy(this.buildStrategy(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.strategy == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.strategy);
+ }
+
+
+ // ********** InheritanceAnnotation implementation **********
+
+ // ***** strategy
+ public InheritanceType getStrategy() {
+ return this.strategy;
+ }
+
+ public void setStrategy(InheritanceType strategy) {
+ if (this.attributeValueHasChanged(this.strategy, strategy)) {
+ this.strategy = strategy;
+ this.strategyAdapter.setValue(InheritanceType.toJavaAnnotationValue(strategy));
+ }
+ }
+
+ private void syncStrategy(InheritanceType astStrategy) {
+ InheritanceType old = this.strategy;
+ this.strategy = astStrategy;
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, astStrategy);
+ }
+
+ private InheritanceType buildStrategy(CompilationUnit astRoot) {
+ return InheritanceType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot));
+ }
+
+ public TextRange getStrategyTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(STRATEGY_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.INHERITANCE__STRATEGY);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
new file mode 100644
index 0000000000..afdb776e6b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.JoinColumn</code>
+ */
+public final class SourceJoinColumnAnnotation
+ extends SourceBaseJoinColumnAnnotation
+ implements NestableJoinColumnAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ }
+
+ public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ }
+
+ public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ********** SourceNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** SourceBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA.JOIN_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA.JOIN_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA.JOIN_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA.JOIN_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA.JOIN_COLUMN__UPDATABLE;
+ }
+
+
+ // ********** SourceBaseJoinColumnAnnotation implementation **********
+
+ @Override
+ protected String getReferencedColumnNameElementName() {
+ return JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME;
+ }
+
+
+ // ********** static methods **********
+
+ public static SourceJoinColumnAnnotation createJoinColumn(JavaResourceNode parent, Member member) {
+ return new SourceJoinColumnAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ static SourceJoinColumnAnnotation createNestedJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
+ return new SourceJoinColumnAnnotation(parent, member, idaa, annotationAdapter);
+ }
+
+ static NestableJoinColumnAnnotation createAssociationOverrideJoinColumn(DeclarationAnnotationAdapter associationOverrideAdapter, JavaResourceNode parent, Member member, int index) {
+ return new SourceJoinColumnAnnotation(parent, member, buildAssociationOverrideAnnotationAdapter(associationOverrideAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildAssociationOverrideAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(associationOverrideAdapter, JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS, index, ANNOTATION_NAME);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
new file mode 100644
index 0000000000..8361a6faf4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.JoinColumns</code>
+ */
+public final class SourceJoinColumnsAnnotation
+ extends SourceAnnotation<Member>
+ implements JoinColumnsAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
+
+
+ public SourceJoinColumnsAnnotation(JavaResourceNode parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.joinColumns.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.joinColumns);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JPA.JOIN_COLUMNS__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return JoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.joinColumns.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.joinColumns.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.joinColumns.add(index, (NestableJoinColumnAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.joinColumns.remove(0).convertToStandAlone();
+ }
+
+ public NestableJoinColumnAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.joinColumns.size());
+ }
+
+ private NestableJoinColumnAnnotation addNestedAnnotation(int index) {
+ NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
+ this.joinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
+ int index = this.joinColumns.size();
+ NestableJoinColumnAnnotation joinColumn = this.addNestedAnnotation(index);
+ joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation buildJoinColumn(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceJoinColumnAnnotation.createNestedJoinColumn(this.parent, this.annotatedElement, index, this.daa);
+ }
+
+ public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return this.joinColumns.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java
new file mode 100644
index 0000000000..a00a620b26
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java
@@ -0,0 +1,409 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.JoinTable</code>
+ */
+public final class SourceJoinTableAnnotation
+ extends SourceBaseTableAnnotation
+ implements JoinTableAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JoinTableAnnotation.ANNOTATION_NAME);
+
+
+ private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
+ private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
+
+ private final Vector<NestableJoinColumnAnnotation> inverseJoinColumns = new Vector<NestableJoinColumnAnnotation>();
+ private final InverseJoinColumnsContainerAnnotation inverseJoinColumnsContainer = new InverseJoinColumnsContainerAnnotation();
+
+
+ public SourceJoinTableAnnotation(JavaResourceNode parent, Member member) {
+ this(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public SourceJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
+ AnnotationContainerTools.initialize(this.inverseJoinColumnsContainer, astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot);
+ AnnotationContainerTools.synchronize(this.inverseJoinColumnsContainer, astRoot);
+ }
+
+
+ // ********** SourceBaseTableAnnotation implementation **********
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.JOIN_TABLE__NAME);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildSchemaDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.JOIN_TABLE__SCHEMA);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildCatalogDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.JOIN_TABLE__CATALOG);
+ }
+
+ @Override
+ protected String getUniqueConstraintsElementName() {
+ return JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+ // ********** JoinTableAnnotation implementation **********
+
+ // ***** join columns
+ public ListIterator<JoinColumnAnnotation> joinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ }
+
+ Iterable<NestableJoinColumnAnnotation> getNestableJoinColumns() {
+ return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public NestableJoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation addJoinColumn() {
+ return this.addJoinColumn(this.joinColumns.size());
+ }
+
+ public NestableJoinColumnAnnotation addJoinColumn(int index) {
+ return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation addJoinColumn_() {
+ return this.addJoinColumn_(this.joinColumns.size());
+ }
+
+ private NestableJoinColumnAnnotation addJoinColumn_(int index) {
+ NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
+ this.joinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ void syncAddJoinColumn(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
+ int index = this.joinColumns.size();
+ NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index);
+ joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation buildJoinColumn(int index) {
+ return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildJoinColumnAnnotationAdapter(index));
+ }
+
+ private IndexedDeclarationAnnotationAdapter buildJoinColumnAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public void removeJoinColumn(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation removeJoinColumn_(int index) {
+ return this.joinColumns.remove(index);
+ }
+
+ void syncRemoveJoinColumns(int index) {
+ this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+ // ***** inverse join columns
+ public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
+ return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns);
+ }
+
+ Iterable<NestableJoinColumnAnnotation> getNestableInverseJoinColumns() {
+ return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.inverseJoinColumns);
+ }
+
+ public int inverseJoinColumnsSize() {
+ return this.inverseJoinColumns.size();
+ }
+
+ public NestableJoinColumnAnnotation inverseJoinColumnAt(int index) {
+ return this.inverseJoinColumns.get(index);
+ }
+
+ public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
+ return this.inverseJoinColumns.indexOf(joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation addInverseJoinColumn() {
+ return this.addInverseJoinColumn(this.inverseJoinColumns.size());
+ }
+
+ public NestableJoinColumnAnnotation addInverseJoinColumn(int index) {
+ return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.inverseJoinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation addInverseJoinColumn_() {
+ return this.addInverseJoinColumn_(this.inverseJoinColumns.size());
+ }
+
+ private NestableJoinColumnAnnotation addInverseJoinColumn_(int index) {
+ NestableJoinColumnAnnotation joinColumn = this.buildInverseJoinColumn(index);
+ this.inverseJoinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ void syncAddInverseJoinColumn(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
+ int index = this.inverseJoinColumns.size();
+ NestableJoinColumnAnnotation joinColumn = this.addInverseJoinColumn_(index);
+ joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ private NestableJoinColumnAnnotation buildInverseJoinColumn(int index) {
+ return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildInverseJoinColumnAnnotationAdapter(index));
+ }
+
+ private IndexedDeclarationAnnotationAdapter buildInverseJoinColumnAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+ }
+
+ void inverseJoinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
+ this.fireItemAdded(INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.inverseJoinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation moveInverseJoinColumn_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.inverseJoinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ void inverseJoinColumnMoved(int targetIndex, int sourceIndex) {
+ this.fireItemMoved(INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ public void removeInverseJoinColumn(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.inverseJoinColumnsContainer);
+ }
+
+ NestableJoinColumnAnnotation removeInverseJoinColumn_(int index) {
+ return this.inverseJoinColumns.remove(index);
+ }
+
+ void syncRemoveInverseJoinColumns(int index) {
+ this.removeItemsFromList(index, this.inverseJoinColumns, INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.joinColumns.isEmpty() &&
+ this.inverseJoinColumns.isEmpty();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+
+ List<Map<String, Object>> joinColumnsState = this.buildStateList(this.joinColumns.size());
+ for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) {
+ Map<String, Object> joinColumnState = new HashMap<String, Object>();
+ joinColumn.storeOn(joinColumnState);
+ joinColumnsState.add(joinColumnState);
+ }
+ map.put(JOIN_COLUMNS_LIST, joinColumnsState);
+ this.joinColumns.clear();
+
+ List<Map<String, Object>> inverseJoinColumnsState = this.buildStateList(this.inverseJoinColumns.size());
+ for (NestableJoinColumnAnnotation joinColumn : this.getNestableInverseJoinColumns()) {
+ Map<String, Object> joinColumnState = new HashMap<String, Object>();
+ joinColumn.storeOn(joinColumnState);
+ inverseJoinColumnsState.add(joinColumnState);
+ }
+ map.put(INVERSE_JOIN_COLUMNS_LIST, inverseJoinColumnsState);
+ this.inverseJoinColumns.clear();
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> joinColumnsState = (List<Map<String, Object>>) map.get(JOIN_COLUMNS_LIST);
+ for (Map<String, Object> joinColumnState : joinColumnsState) {
+ this.addJoinColumn().restoreFrom(joinColumnState);
+ }
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> inverseJoinColumnsState = (List<Map<String, Object>>) map.get(INVERSE_JOIN_COLUMNS_LIST);
+ for (Map<String, Object> joinColumnState : inverseJoinColumnsState) {
+ this.addInverseJoinColumn().restoreFrom(joinColumnState);
+ }
+ }
+
+
+ // ********** annotation containers **********
+
+ abstract class AbstractJoinColumnAnnotationContainer
+ implements AnnotationContainer<NestableJoinColumnAnnotation>
+ {
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return SourceJoinTableAnnotation.this.getAstAnnotation(astRoot);
+ }
+
+ public String getNestedAnnotationName() {
+ return JoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+
+
+ /**
+ * adapt the AnnotationContainer interface to the join table's join columns
+ */
+ class JoinColumnsAnnotationContainer
+ extends AbstractJoinColumnAnnotationContainer
+ {
+ public String getElementName() {
+ return JPA.JOIN_TABLE__JOIN_COLUMNS;
+ }
+
+ public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
+ return SourceJoinTableAnnotation.this.getNestableJoinColumns();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceJoinTableAnnotation.this.joinColumnsSize();
+ }
+
+ public NestableJoinColumnAnnotation addNestedAnnotation() {
+ return SourceJoinTableAnnotation.this.addJoinColumn_();
+ }
+
+ public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
+ SourceJoinTableAnnotation.this.syncAddJoinColumn(astAnnotation);
+ }
+
+ public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceJoinTableAnnotation.this.moveJoinColumn_(targetIndex, sourceIndex);
+ }
+
+ public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return SourceJoinTableAnnotation.this.removeJoinColumn_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceJoinTableAnnotation.this.syncRemoveJoinColumns(index);
+ }
+ }
+
+
+ /**
+ * adapt the AnnotationContainer interface to the join table's inverse join columns
+ */
+ class InverseJoinColumnsContainerAnnotation
+ extends AbstractJoinColumnAnnotationContainer
+ {
+ public String getElementName() {
+ return JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS;
+ }
+
+ public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
+ return SourceJoinTableAnnotation.this.getNestableInverseJoinColumns();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceJoinTableAnnotation.this.inverseJoinColumnsSize();
+ }
+
+ public NestableJoinColumnAnnotation addNestedAnnotation() {
+ return SourceJoinTableAnnotation.this.addInverseJoinColumn_();
+ }
+
+ public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
+ SourceJoinTableAnnotation.this.syncAddInverseJoinColumn(astAnnotation);
+ }
+
+ public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceJoinTableAnnotation.this.moveInverseJoinColumn_(targetIndex, sourceIndex);
+ }
+
+ public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return SourceJoinTableAnnotation.this.removeInverseJoinColumn_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceJoinTableAnnotation.this.syncRemoveInverseJoinColumns(index);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java
new file mode 100644
index 0000000000..acdef41d86
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
+
+/**
+ * javax.persistence.Lob
+ */
+public final class SourceLobAnnotation
+ extends SourceAnnotation<Attribute>
+ implements LobAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceLobAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java
new file mode 100644
index 0000000000..601d50e757
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToMany2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.ManyToMany
+ */
+public final class SourceManyToManyAnnotation
+ extends SourceRelationshipMappingAnnotation
+ implements ManyToMany2_0Annotation
+{
+ 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> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
+ private final AnnotationElementAdapter<String> mappedByAdapter;
+ private String mappedBy;
+
+
+ public SourceManyToManyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.mappedBy = this.buildMappedBy(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncMappedBy(this.buildMappedBy(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.mappedBy == null);
+ }
+
+
+ // ********** SourceRelationshipMappingAnnotation implementation **********
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+
+ //**************** OwnableRelationshipMappingAnnotation implementation **************
+
+ // ***** mapped by
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String mappedBy) {
+ if (this.attributeValueHasChanged(this.mappedBy, mappedBy)) {
+ this.mappedBy = mappedBy;
+ this.mappedByAdapter.setValue(mappedBy);
+ }
+ }
+
+ private void syncMappedBy(String astMappedBy) {
+ String old = this.mappedBy;
+ this.mappedBy = astMappedBy;
+ this.firePropertyChanged(MAPPED_BY_PROPERTY, old, astMappedBy);
+ }
+
+ private String buildMappedBy(CompilationUnit astRoot) {
+ return this.mappedByAdapter.getValue(astRoot);
+ }
+
+ public TextRange getMappedByTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(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> buildMappedByAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__MAPPED_BY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__FETCH);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__CASCADE);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java
new file mode 100644
index 0000000000..4eb75c9e38
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToOne2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.ManyToOne
+ */
+public final class SourceManyToOneAnnotation
+ extends SourceRelationshipMappingAnnotation
+ implements ManyToOne2_0Annotation
+{
+ 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> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
+ private final AnnotationElementAdapter<Boolean> optionalAdapter;
+ private Boolean optional;
+
+
+ public SourceManyToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.optional = this.buildOptional(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncOptional(this.buildOptional(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.optional == null);
+ }
+
+
+ // ********** SourceRelationshipMappingAnnotation implementation **********
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+
+ // ********** ManyToOneMappingAnnotation implementation **********
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ if (this.attributeValueHasChanged(this.optional, optional)) {
+ this.optional = optional;
+ this.optionalAdapter.setValue(optional);
+ }
+ }
+
+ private void syncOptional(Boolean astOptional) {
+ Boolean old = this.optional;
+ this.optional = astOptional;
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, astOptional);
+ }
+
+ private Boolean buildOptional(CompilationUnit astRoot) {
+ return this.optionalAdapter.getValue(astRoot);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
+ return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__TARGET_ENTITY);
+ }
+
+ 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<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__CASCADE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java
new file mode 100644
index 0000000000..590302bd68
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
+
+/**
+ * javax.persistence.MapKey
+ */
+public final class SourceMapKeyAnnotation
+ extends SourceAnnotation<Attribute>
+ implements MapKeyAnnotation
+{
+ 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;
+
+
+ public SourceMapKeyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.nameAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, NAME_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** MapKeyAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(NAME_ADAPTER, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(NAME_ADAPTER, pos, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.MAP_KEY__NAME);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
new file mode 100644
index 0000000000..0eafc0f2ce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
+
+/**
+ * javax.persistence.MappedSuperclass
+ */
+public final class SourceMappedSuperclassAnnotation
+ extends SourceAnnotation<Type>
+ implements MappedSuperclassAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceMappedSuperclassAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
new file mode 100644
index 0000000000..8f9e2d2f22
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
+
+/**
+ * <code>
+ * <ul>
+ * <li>javax.persistence.Column
+ * <li>javax.persistence.JoinColumn
+ * <li>javax.persistence.DiscriminatorColumn
+ * <li>javax.persistence.PrimaryKeyJoinColumn
+ * <li>javax.persistence.MapKeyColumn
+ * <li>javax.persistence.MapKeyJoinColumn
+ * <li>javax.persistence.OrderColumn
+ * </ul>
+ * </code>
+ */
+public abstract class SourceNamedColumnAnnotation
+ extends SourceAnnotation<Member>
+ implements NamedColumnAnnotation
+{
+ private DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ private AnnotationElementAdapter<String> nameAdapter;
+ private String name;
+
+ private DeclarationAnnotationElementAdapter<String> columnDefinitionDeclarationAdapter;
+ private AnnotationElementAdapter<String> columnDefinitionAdapter;
+ private String columnDefinition;
+
+
+ protected SourceNamedColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ }
+
+ protected SourceNamedColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.columnDefinitionDeclarationAdapter = this.buildColumnDefinitionDeclarationAdapter();
+ this.columnDefinitionAdapter = this.buildColumnDefinitionAdapter();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.columnDefinition = this.buildColumnDefinition(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncColumnDefinition(this.buildColumnDefinition(astRoot));
+ }
+
+
+ // ********** NamedColumn implementation **********
+
+ public boolean isSpecified() {
+ return true;
+ }
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return this.buildStringElementAdapter(this.getNameElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildNameAdapter() {
+ return this.buildStringElementAdapter(this.nameDeclarationAdapter);
+ }
+
+ protected abstract String getNameElementName();
+
+ // ***** column definition
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ public void setColumnDefinition(String columnDefinition) {
+ if (this.attributeValueHasChanged(this.columnDefinition, columnDefinition)) {
+ this.columnDefinition = columnDefinition;
+ this.columnDefinitionAdapter.setValue(columnDefinition);
+ }
+ }
+
+ private void syncColumnDefinition(String astColumnDefinition) {
+ String old = this.columnDefinition;
+ this.columnDefinition = astColumnDefinition;
+ this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, astColumnDefinition);
+ }
+
+ private String buildColumnDefinition(CompilationUnit astRoot) {
+ return this.columnDefinitionAdapter.getValue(astRoot);
+ }
+
+ public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.columnDefinitionDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildColumnDefinitionDeclarationAdapter() {
+ return this.buildStringElementAdapter(this.getColumnDefinitionElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildColumnDefinitionAdapter() {
+ return this.buildStringElementAdapter(this.columnDefinitionDeclarationAdapter);
+ }
+
+ protected abstract String getColumnDefinitionElementName();
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null) &&
+ (this.columnDefinition == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.columnDefinitionDeclarationAdapter = this.buildColumnDefinitionDeclarationAdapter();
+ this.columnDefinitionAdapter = this.buildColumnDefinitionAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(NAME_PROPERTY, this.name);
+ this.name = null;
+ map.put(COLUMN_DEFINITION_PROPERTY, this.columnDefinition);
+ this.columnDefinition = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setName((String) map.get(NAME_PROPERTY));
+ this.setColumnDefinition((String) map.get(COLUMN_DEFINITION_PROPERTY));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
new file mode 100644
index 0000000000..f1eaa10446
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
+
+/**
+ * <code>javax.persistence.NamedNativeQueries</code>
+ */
+public final class SourceNamedNativeQueriesAnnotation
+ extends SourceAnnotation<Type>
+ implements NamedNativeQueriesAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableNamedNativeQueryAnnotation> namedNativeQueries = new Vector<NestableNamedNativeQueryAnnotation>();
+
+
+ public SourceNamedNativeQueriesAnnotation(JavaResourceNode parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.namedNativeQueries.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.namedNativeQueries);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JPA.NAMED_NATIVE_QUERIES__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return NamedNativeQueryAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableNamedNativeQueryAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableNamedNativeQueryAnnotation>(this.namedNativeQueries);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.namedNativeQueries.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.namedNativeQueries.add(index, (NestableNamedNativeQueryAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.namedNativeQueries.remove(0).convertToStandAlone();
+ }
+
+ public NestableNamedNativeQueryAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.namedNativeQueries.size());
+ }
+
+ private NestableNamedNativeQueryAnnotation addNestedAnnotation(int index) {
+ NestableNamedNativeQueryAnnotation namedNativeQuery = this.buildNamedNativeQuery(index);
+ this.namedNativeQueries.add(index, namedNativeQuery);
+ return namedNativeQuery;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.namedNativeQueries.size();
+ NestableNamedNativeQueryAnnotation namedNativeQuery = this.addNestedAnnotation(index);
+ namedNativeQuery.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(NAMED_NATIVE_QUERIES_LIST, index, namedNativeQuery);
+ }
+
+ private NestableNamedNativeQueryAnnotation buildNamedNativeQuery(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceNamedNativeQueryAnnotation.createNestedNamedNativeQuery(this.parent, this.annotatedElement, index, this.daa);
+ }
+
+ public NestableNamedNativeQueryAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestableNamedNativeQueryAnnotation removeNestedAnnotation(int index) {
+ return this.namedNativeQueries.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
new file mode 100644
index 0000000000..8ad2d4055c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+
+/**
+ * <code>javax.persistence.NamedNativeQuery</code>
+ */
+public final class SourceNamedNativeQueryAnnotation
+ extends SourceQueryAnnotation
+ implements NestableNamedNativeQueryAnnotation
+{
+ public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private DeclarationAnnotationElementAdapter<String> resultClassDeclarationAdapter;
+ private AnnotationElementAdapter<String> resultClassAdapter;
+ private String resultClass;
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
+ */
+ private String fullyQualifiedResultClassName;
+ // we need a flag since the f-q name can be null
+ private boolean fqResultClassNameStale = true;
+
+ private DeclarationAnnotationElementAdapter<String> resultSetMappingDeclarationAdapter;
+ private AnnotationElementAdapter<String> resultSetMappingAdapter;
+ private String resultSetMapping;
+
+
+ public SourceNamedNativeQueryAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ this.resultClassDeclarationAdapter = this.buildResultClassDeclarationAdapter();
+ this.resultClassAdapter = this.buildResultClassAdapter();
+ this.resultSetMappingDeclarationAdapter = this.buildResultSetMappingAdapter(daa);
+ this.resultSetMappingAdapter = this.buildResultSetMappingAdapter();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.resultClass = this.buildResultClass(astRoot);
+ this.resultSetMapping = this.buildResultSetMapping(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncResultClass(this.buildResultClass(astRoot));
+ this.syncResultSetMapping(this.buildResultSetMapping(astRoot));
+ }
+
+
+ // ********** AbstractBaseNamedQueryAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return JPA.NAMED_NATIVE_QUERY__NAME;
+ }
+
+ @Override
+ String getQueryElementName() {
+ return JPA.NAMED_NATIVE_QUERY__QUERY;
+ }
+
+ @Override
+ String getHintsElementName() {
+ return JPA.NAMED_NATIVE_QUERY__HINTS;
+ }
+
+ @Override
+ NestableQueryHintAnnotation buildHint(int index) {
+ return SourceQueryHintAnnotation.createNamedNativeQueryQueryHint(this, this.annotatedElement, this.daa, index);
+ }
+
+
+ // ********** NamedNativeQueryAnnotation implementation **********
+
+ // ***** result class
+ public String getResultClass() {
+ return this.resultClass;
+ }
+
+ public void setResultClass(String resultClass) {
+ if (this.attributeValueHasChanged(this.resultClass, resultClass)) {
+ this.resultClass = resultClass;
+ this.fqResultClassNameStale = true;
+ this.resultClassAdapter.setValue(resultClass);
+ }
+ }
+
+ private void syncResultClass(String astResultClass) {
+ if (this.attributeValueHasChanged(this.resultClass, astResultClass)) {
+ this.syncResultClass_(astResultClass);
+ }
+ }
+
+ private void syncResultClass_(String astResultClass) {
+ String old = this.resultClass;
+ this.resultClass = astResultClass;
+ this.fqResultClassNameStale = true;
+ this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, astResultClass);
+ }
+
+ private String buildResultClass(CompilationUnit astRoot) {
+ return this.resultClassAdapter.getValue(astRoot);
+ }
+
+ public TextRange getResultClassTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.resultClassDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildResultClassDeclarationAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(this.daa, JPA.NAMED_NATIVE_QUERY__RESULT_CLASS, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ private AnnotationElementAdapter<String> buildResultClassAdapter() {
+ return this.buildStringElementAdapter(this.resultClassDeclarationAdapter);
+ }
+
+ // ***** fully-qualified result class name
+ public String getFullyQualifiedResultClassName() {
+ if (this.fqResultClassNameStale) {
+ this.fullyQualifiedResultClassName = this.buildFullyQualifiedResultClassName();
+ this.fqResultClassNameStale = false;
+ }
+ return this.fullyQualifiedResultClassName;
+ }
+
+ private String buildFullyQualifiedResultClassName() {
+ return (this.resultClass == null) ? null : this.buildFullyQualifiedResultClassName_();
+ }
+
+ private String buildFullyQualifiedResultClassName_() {
+ return ASTTools.resolveFullyQualifiedName(this.resultClassAdapter.getExpression(this.buildASTRoot()));
+ }
+
+ // ***** result set mapping
+ public String getResultSetMapping() {
+ return this.resultSetMapping;
+ }
+
+ public void setResultSetMapping(String resultSetMapping) {
+ if (this.attributeValueHasChanged(this.resultSetMapping, resultSetMapping)) {
+ this.resultSetMapping = resultSetMapping;
+ this.resultSetMappingAdapter.setValue(resultSetMapping);
+ }
+ }
+
+ private void syncResultSetMapping(String astResultSetMapping) {
+ String old = this.resultSetMapping;
+ this.resultSetMapping = astResultSetMapping;
+ this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, astResultSetMapping);
+ }
+
+ private String buildResultSetMapping(CompilationUnit astRoot) {
+ return this.resultSetMappingAdapter.getValue(astRoot);
+ }
+
+ public TextRange getResultSetMappingTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.resultSetMappingDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildResultSetMappingAdapter(DeclarationAnnotationAdapter daAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter, JPA.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING);
+ }
+
+ private AnnotationElementAdapter<String> buildResultSetMappingAdapter() {
+ return this.buildStringElementAdapter(this.resultSetMappingDeclarationAdapter);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.resultClass == null) &&
+ (this.resultSetMapping == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.resultClassDeclarationAdapter = this.buildResultClassDeclarationAdapter();
+ this.resultClassAdapter = this.buildResultClassAdapter();
+ this.resultSetMappingDeclarationAdapter = this.buildResultSetMappingAdapter(daa);
+ this.resultSetMappingAdapter = this.buildResultSetMappingAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(RESULT_CLASS_PROPERTY, this.resultClass);
+ this.resultClass = null;
+ map.put(RESULT_SET_MAPPING_PROPERTY, this.resultSetMapping);
+ this.resultSetMapping = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setResultClass((String) map.get(RESULT_CLASS_PROPERTY));
+ this.setResultSetMapping((String) map.get(RESULT_SET_MAPPING_PROPERTY));
+ }
+
+
+ // ********** static methods **********
+
+ public static SourceNamedNativeQueryAnnotation createNamedNativeQuery(JavaResourceNode parent, Type type) {
+ return new SourceNamedNativeQueryAnnotation(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static SourceNamedNativeQueryAnnotation createNestedNamedNativeQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa);
+ return new SourceNamedNativeQueryAnnotation(parent, type, idaa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java
new file mode 100644
index 0000000000..b6b8b328d9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+
+/**
+ * <code>javax.persistence.NamedQueries</code>
+ */
+public final class SourceNamedQueries1_0Annotation
+ extends SourceNamedQueriesAnnotation
+{
+ public SourceNamedQueries1_0Annotation(JavaResourceNode parent, Type type) {
+ super(parent, type);
+ }
+
+ @Override
+ protected NestableNamedQueryAnnotation buildNamedQuery(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceNamedQueryAnnotation.createNestedNamedQuery(this.parent, this.annotatedElement, index, this.daa);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
new file mode 100644
index 0000000000..17665feda2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+
+/**
+ * <code>javax.persistence.NamedQueries</code>
+ */
+public abstract class SourceNamedQueriesAnnotation
+ extends SourceAnnotation<Type>
+ implements NamedQueriesAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableNamedQueryAnnotation> namedQueries = new Vector<NestableNamedQueryAnnotation>();
+
+
+ public SourceNamedQueriesAnnotation(JavaResourceNode parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.namedQueries.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.namedQueries);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JPA.NAMED_QUERIES__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return NamedQueryAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableNamedQueryAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableNamedQueryAnnotation>(this.namedQueries);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.namedQueries.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.namedQueries.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.namedQueries.add(index, (NestableNamedQueryAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.namedQueries.remove(0).convertToStandAlone();
+ }
+
+ public NestableNamedQueryAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.namedQueries.size());
+ }
+
+ private NestableNamedQueryAnnotation addNestedAnnotation(int index) {
+ NestableNamedQueryAnnotation namedQuery = this.buildNamedQuery(index);
+ this.namedQueries.add(index, namedQuery);
+ return namedQuery;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.namedQueries.size();
+ NestableNamedQueryAnnotation namedQuery = this.addNestedAnnotation(index);
+ namedQuery.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(NAMED_QUERIES_LIST, index, namedQuery);
+ }
+
+ protected abstract NestableNamedQueryAnnotation buildNamedQuery(int index);
+
+ public NestableNamedQueryAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.namedQueries, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestableNamedQueryAnnotation removeNestedAnnotation(int index) {
+ return this.namedQueries.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.namedQueries, NAMED_QUERIES_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
new file mode 100644
index 0000000000..3389852b42
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+
+/**
+ * <code>javax.persistence.NamedQuery</code>
+ */
+public abstract class SourceNamedQueryAnnotation
+ extends SourceQueryAnnotation
+ implements NestableNamedQueryAnnotation
+{
+ public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceNamedQueryAnnotation(JavaResourceNode parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ public SourceNamedQueryAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** AbstractBaseNamedQueryAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return JPA.NAMED_QUERY__NAME;
+ }
+
+ @Override
+ String getQueryElementName() {
+ return JPA.NAMED_QUERY__QUERY;
+ }
+
+ @Override
+ String getHintsElementName() {
+ return JPA.NAMED_QUERY__HINTS;
+ }
+
+ @Override
+ NestableQueryHintAnnotation buildHint(int index) {
+ return SourceQueryHintAnnotation.createNamedQueryQueryHint(this, this.annotatedElement, this.daa, index);
+ }
+
+
+ // ********** static methods **********
+
+ static SourceNamedQueryAnnotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa);
+
+ return new SourceNamedQuery1_0Annotation(parent, type, idaa, annotationAdapter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java
new file mode 100644
index 0000000000..59f548213e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AbstractJavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+
+/**
+ * Source convenience methods
+ */
+public abstract class SourceNode
+ extends AbstractJavaResourceNode
+{
+
+ public SourceNode(JavaResourceNode parent) {
+ super(parent);
+ }
+
+ public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
+ return (JavaResourceCompilationUnit) this.getRoot();
+ }
+
+ protected CompilationUnit buildASTRoot() {
+ return this.getJavaResourceCompilationUnit().buildASTRoot();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java
new file mode 100644
index 0000000000..c32094c53b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToMany2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.OneToMany
+ */
+public final class SourceOneToManyAnnotation
+ extends SourceRelationshipMappingAnnotation
+ implements OneToMany2_0Annotation
+{
+ protected static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
+ private final AnnotationElementAdapter<String> mappedByAdapter;
+ private String mappedBy;
+
+ //added in JPA2.0
+ private static final DeclarationAnnotationElementAdapter<Boolean> ORPHAN_REMOVAL_ADAPTER = buildOrphanRemovalAdapter();
+ private final AnnotationElementAdapter<Boolean> orphanRemovalAdapter;
+ private Boolean orphanRemoval;
+
+ public SourceOneToManyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
+ this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.mappedBy = this.buildMappedBy(astRoot);
+ this.orphanRemoval = this.buildOrphanRemoval(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncMappedBy(this.buildMappedBy(astRoot));
+ this.syncOrphanRemoval(this.buildOrphanRemoval(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.mappedBy == null) &&
+ (this.orphanRemoval == null);
+ }
+
+
+ // ********** SourceRelationshipMappingAnnotation implementation **********
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+
+ // ********** OwnableRelationshipMappingAnnotation implementation **********
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String mappedBy) {
+ if (this.attributeValueHasChanged(this.mappedBy, mappedBy)) {
+ this.mappedBy = mappedBy;
+ this.mappedByAdapter.setValue(mappedBy);
+ }
+ }
+
+ private void syncMappedBy(String astMappedBy) {
+ String old = this.mappedBy;
+ this.mappedBy = astMappedBy;
+ this.firePropertyChanged(MAPPED_BY_PROPERTY, old, astMappedBy);
+ }
+
+ private String buildMappedBy(CompilationUnit astRoot) {
+ return this.mappedByAdapter.getValue(astRoot);
+ }
+
+ public TextRange getMappedByTextRange(CompilationUnit astRoot) {
+ return getElementTextRange(MAPPED_BY_ADAPTER, astRoot);
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
+ }
+
+ // ********** OneToMany2_0Annotation implementation **********
+
+ public Boolean getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ public void setOrphanRemoval(Boolean orphanRemoval) {
+ if (this.attributeValueHasChanged(this.orphanRemoval, orphanRemoval)) {
+ this.orphanRemoval = orphanRemoval;
+ this.orphanRemovalAdapter.setValue(orphanRemoval);
+ }
+ }
+
+ private void syncOrphanRemoval(Boolean astOrphanRemoval) {
+ Boolean old = this.orphanRemoval;
+ this.orphanRemoval = astOrphanRemoval;
+ this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, astOrphanRemoval);
+ }
+
+ public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(ORPHAN_REMOVAL_ADAPTER, astRoot);
+ }
+
+ private Boolean buildOrphanRemoval(CompilationUnit astRoot) {
+ return this.orphanRemovalAdapter.getValue(astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
+ return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__TARGET_ENTITY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__MAPPED_BY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__FETCH);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__CASCADE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter() {
+ return buildOrphanRemovalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ONE_TO_MANY__ORPHAN_REMOVAL);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java
new file mode 100644
index 0000000000..1867a43f80
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToOne2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.OneToOne
+ */
+public final class SourceOneToOneAnnotation
+ extends SourceRelationshipMappingAnnotation
+ implements OneToOne2_0Annotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
+ private final AnnotationElementAdapter<String> mappedByAdapter;
+ private String mappedBy;
+
+ private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
+ private final AnnotationElementAdapter<Boolean> optionalAdapter;
+ private Boolean optional;
+
+ //added in JPA 2.0
+ private static final DeclarationAnnotationElementAdapter<Boolean> ORPHAN_REMOVAL_ADAPTER = buildOrphanRemovalAdapter();
+ private final AnnotationElementAdapter<Boolean> orphanRemovalAdapter;
+ private Boolean orphanRemoval;
+
+ public SourceOneToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
+ this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
+ this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.mappedBy = this.buildMappedBy(astRoot);
+ this.optional = this.buildOptional(astRoot);
+ this.orphanRemoval = this.buildOrphanRemoval(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncMappedBy(this.buildMappedBy(astRoot));
+ this.syncOptional(this.buildOptional(astRoot));
+ this.syncOrphanRemoval(this.buildOrphanRemoval(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.mappedBy == null) &&
+ (this.optional == null) &&
+ (this.orphanRemoval == null);
+ }
+
+
+ // ********** SourceRelationshipMappingAnnotation implementation **********
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+
+ // ********** OneToOneAnnotation implementation **********
+
+ // ***** mapped by
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String mappedBy) {
+ if (this.attributeValueHasChanged(this.mappedBy, mappedBy)) {
+ this.mappedBy = mappedBy;
+ this.mappedByAdapter.setValue(mappedBy);
+ }
+ }
+
+ private void syncMappedBy(String astMappedBy) {
+ String old = this.mappedBy;
+ this.mappedBy = astMappedBy;
+ this.firePropertyChanged(MAPPED_BY_PROPERTY, old, astMappedBy);
+ }
+
+ private String buildMappedBy(CompilationUnit astRoot) {
+ return this.mappedByAdapter.getValue(astRoot);
+ }
+
+ public TextRange getMappedByTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(MAPPED_BY_ADAPTER, astRoot);
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
+ }
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ if (this.attributeValueHasChanged(this.optional, optional)) {
+ this.optional = optional;
+ this.optionalAdapter.setValue(optional);
+ }
+ }
+
+ private void syncOptional(Boolean astOptional) {
+ Boolean old = this.optional;
+ this.optional = astOptional;
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, astOptional);
+ }
+
+ private Boolean buildOptional(CompilationUnit astRoot) {
+ return this.optionalAdapter.getValue(astRoot);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
+ }
+
+ // ********** OneToOne2_0Annotation implementation **********
+
+ public Boolean getOrphanRemoval() {
+ return this.orphanRemoval;
+ }
+
+ public void setOrphanRemoval(Boolean orphanRemoval) {
+ if (this.attributeValueHasChanged(this.orphanRemoval, orphanRemoval)) {
+ this.orphanRemoval = orphanRemoval;
+ this.orphanRemovalAdapter.setValue(orphanRemoval);
+ }
+ }
+
+ private void syncOrphanRemoval(Boolean astOrphanRemoval) {
+ Boolean old = this.orphanRemoval;
+ this.orphanRemoval = astOrphanRemoval;
+ this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, astOrphanRemoval);
+ }
+
+ public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(ORPHAN_REMOVAL_ADAPTER, astRoot);
+ }
+
+ private Boolean buildOrphanRemoval(CompilationUnit astRoot) {
+ return this.orphanRemovalAdapter.getValue(astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
+ return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__TARGET_ENTITY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__MAPPED_BY);
+ }
+
+ 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, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__CASCADE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter() {
+ return buildOrphanRemovalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ONE_TO_ONE__ORPHAN_REMOVAL);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java
new file mode 100644
index 0000000000..78a7ccc939
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
+
+/**
+ * javax.persistence.OrderBy
+ */
+public final class SourceOrderByAnnotation
+ extends SourceAnnotation<Attribute>
+ implements OrderByAnnotation
+{
+ 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;
+
+
+ public SourceOrderByAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.value == null);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** OrderByAnnotation implementation **********
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(String astValue) {
+ String old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ORDER_BY__VALUE);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java
new file mode 100644
index 0000000000..af86e3b55c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.AttributeOverride</code>
+ * <li><code>javax.persistence.AssociationOverride</code>
+ * </ul>
+ */
+abstract class SourceOverrideAnnotation
+ extends SourceAnnotation<Member>
+ implements OverrideAnnotation
+{
+ DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ AnnotationElementAdapter<String> nameAdapter;
+ String name;
+
+
+ SourceOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ }
+
+
+ // ********** OverrideAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return this.buildStringElementAdapter(this.getNameElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildNameAdapter() {
+ return this.buildStringElementAdapter(this.nameDeclarationAdapter);
+ }
+
+ protected abstract String getNameElementName();
+
+
+ // ********** NestableAnnotation implementation **********
+
+ /**
+ * Convenience implementation of
+ * {@link org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation#moveAnnotation(int)}
+ * used by subclasses.
+ */
+ public void moveAnnotation(int index) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(index);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(NAME_PROPERTY, this.name);
+ this.name = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setName((String) map.get(NAME_PROPERTY));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java
new file mode 100644
index 0000000000..604045d275
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Iterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IPackageBinding;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JDTPackage;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
+
+/**
+ * @author Dmitry Geraskov
+ * Source package-info.java
+ *
+ */
+public final class SourcePackage
+ extends SourceAnnotatedElement<AnnotatedPackage>
+ implements JavaResourcePackage {
+
+ private String name;
+
+ /**
+ * construct package info
+ */
+ public static JavaResourcePackage newInstance(
+ JavaResourceCompilationUnit parent,
+ PackageDeclaration declaringPackage,
+ CompilationUnit astRoot) {
+ AnnotatedPackage pack = new JDTPackage(
+ declaringPackage,
+ parent.getCompilationUnit(),
+ parent.getModifySharedDocumentCommandExecutor(),
+ parent.getAnnotationEditFormatter());
+ JavaResourcePackage jrpp = new SourcePackage(parent, pack);
+ jrpp.initialize(astRoot);
+ return jrpp;
+ }
+
+ private SourcePackage(
+ JavaResourceCompilationUnit parent,
+ AnnotatedPackage pack){
+ super(parent, pack);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.name = this.buildName(astRoot);
+ }
+
+
+ // ********** JavaResourcePackageInfo implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ private void syncName(String astName) {
+ if (valuesAreDifferent(astName, this.name)){
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ IPackageBinding binding = this.annotatedElement.getBinding(astRoot);
+ return (binding == null) ? null : binding.getName();
+ }
+
+
+ // ********** Java changes **********
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncName(this.buildName(astRoot));
+ }
+
+ // ********** SourceAnnotatedElement implementation **********
+
+ @Override
+ Iterator<String> validAnnotationNames() {
+ return this.getAnnotationProvider().packageAnnotationNames();
+ }
+
+
+ @Override
+ Annotation buildAnnotation(String annotationName) {
+ return this.getAnnotationProvider().buildPackageAnnotation(this, this.annotatedElement, annotationName);
+ }
+
+ @Override
+ Annotation buildNullAnnotation(String annotationName) {
+ return this.getAnnotationProvider().buildNullPackageAnnotation(this, annotationName);
+ }
+
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
new file mode 100644
index 0000000000..f6979b9ea2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
+import org.eclipse.jpt.common.utility.CommandExecutor;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageInfoCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * @author Dmitry Geraskov
+ * Source package-info.java
+ *
+ */
+public final class SourcePackageInfoCompilationUnit
+ extends SourceCompilationUnit
+ implements JavaResourcePackageInfoCompilationUnit {
+
+ private JavaResourcePackage package_;
+
+ public SourcePackageInfoCompilationUnit(
+ ICompilationUnit compilationUnit,
+ JpaAnnotationProvider annotationProvider,
+ AnnotationEditFormatter annotationEditFormatter,
+ CommandExecutor modifySharedDocumentCommandExecutor) {
+ super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the JPA compilation unit is the root of its sub-tree
+ this.package_ = this.buildPackage();
+ }
+
+
+ private JavaResourcePackage buildPackage() {
+ this.openCompilationUnit();
+ CompilationUnit astRoot = this.buildASTRoot();
+ this.closeCompilationUnit();
+ return this.buildPackage(astRoot);
+ }
+
+
+ // ********** JavaResourceNode.Root implementation **********
+
+ public Iterator<JavaResourcePersistentType> persistentTypes() {
+ return EmptyIterator.instance();
+ }
+
+
+ // ********** JptResourceModel implementation **********
+
+ public JptResourceType getResourceType() {
+ return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE;
+ }
+
+
+ // ********** Java changes **********
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncPackage(astRoot);
+ }
+
+
+ // ********** JavaResourceCompilationUnit implementation **********
+
+ public void resolveTypes() {
+ //no-op
+ }
+
+ // ********** package-info **********
+
+ public JavaResourcePackage getPackage() {
+ return this.package_;
+ }
+
+ private JavaResourcePackage buildPackage(CompilationUnit astRoot) {
+ return this.buildPackage(astRoot, this.getPackageDeclaration(astRoot));
+ }
+
+ private void syncPackage(CompilationUnit astRoot) {
+ PackageDeclaration pd = this.getPackageDeclaration(astRoot);
+ if (pd == null) {
+ this.syncPackage_(null);
+ } else {
+ if (this.package_ == null) {
+ this.syncPackage_(this.buildPackage(astRoot, pd));
+ } else {
+ this.package_.synchronizeWith(astRoot);
+ }
+ }
+ }
+
+ private PackageDeclaration getPackageDeclaration(CompilationUnit astRoot) {
+ return astRoot.getPackage();
+ }
+
+ private void syncPackage_(JavaResourcePackage astPackage) {
+ JavaResourcePackage old = this.package_;
+ this.package_ = astPackage;
+ this.firePropertyChanged(PACKAGE, old, astPackage);
+ }
+
+ private JavaResourcePackage buildPackage(CompilationUnit astRoot, PackageDeclaration packageDeclaration) {
+ return SourcePackage.newInstance(this, packageDeclaration, astRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java
new file mode 100644
index 0000000000..f12f70444b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java
@@ -0,0 +1,408 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JDTFieldAttribute;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JDTMethodAttribute;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.MethodAttribute;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.utility.MethodSignature;
+import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java source persistent attribute (field or property)
+ */
+final class SourcePersistentAttribute
+ extends SourcePersistentMember<Attribute>
+ implements JavaResourcePersistentAttribute
+{
+ private int modifiers;
+
+ private String typeName;
+
+ private boolean typeIsInterface;
+
+ private boolean typeIsEnum;
+
+ private final Vector<String> typeSuperclassNames = new Vector<String>();
+
+ private final Vector<String> typeInterfaceNames = new Vector<String>();
+
+ private final Vector<String> typeTypeArgumentNames = new Vector<String>();
+
+
+ /**
+ * construct field attribute
+ */
+ static JavaResourcePersistentAttribute newInstance(
+ JavaResourcePersistentType parent,
+ Type declaringType,
+ String name,
+ int occurrence,
+ JavaResourceCompilationUnit javaResourceCompilationUnit,
+ CompilationUnit astRoot) {
+ Attribute attribute = new JDTFieldAttribute(
+ declaringType,
+ name,
+ occurrence,
+ javaResourceCompilationUnit.getCompilationUnit(),
+ javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
+ javaResourceCompilationUnit.getAnnotationEditFormatter());
+ JavaResourcePersistentAttribute jrpa = new SourcePersistentAttribute(parent, attribute);
+ jrpa.initialize(astRoot);
+ return jrpa;
+ }
+
+ /**
+ * construct property attribute
+ */
+ static JavaResourcePersistentAttribute newInstance(
+ JavaResourcePersistentType parent,
+ Type declaringType,
+ MethodSignature signature,
+ int occurrence,
+ JavaResourceCompilationUnit javaResourceCompilationUnit,
+ CompilationUnit astRoot) {
+ Attribute attribute = JDTMethodAttribute.newInstance(
+ declaringType,
+ signature,
+ occurrence,
+ javaResourceCompilationUnit.getCompilationUnit(),
+ javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
+ javaResourceCompilationUnit.getAnnotationEditFormatter());
+ JavaResourcePersistentAttribute jrpa = new SourcePersistentAttribute(parent, attribute);
+ jrpa.initialize(astRoot);
+ return jrpa;
+ }
+
+ private SourcePersistentAttribute(JavaResourcePersistentType parent, Attribute attribute){
+ super(parent, attribute);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ ITypeBinding typeBinding = this.getTypeBinding(astRoot); //build once, minor performance tweak for major benefit
+ this.modifiers = this.buildModifiers(astRoot);
+ this.typeName = this.buildTypeName(typeBinding);
+ this.typeIsInterface = this.buildTypeIsInterface(typeBinding);
+ this.typeIsEnum = this.buildTypeIsEnum(typeBinding);
+ this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(typeBinding));
+ this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(typeBinding));
+ this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames(typeBinding));
+ }
+
+
+ // ******** overrides ********
+
+ @Override
+ public void resolveTypes(CompilationUnit astRoot) {
+ super.resolveTypes(astRoot);
+ ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit
+ this.syncTypeName(this.buildTypeName(typeBinding));
+ this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding));
+ this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding));
+ this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding));
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit
+ this.syncModifiers(this.buildModifiers(astRoot));
+ this.syncTypeName(this.buildTypeName(typeBinding));
+ this.syncTypeIsInterface(this.buildTypeIsInterface(typeBinding));
+ this.syncTypeIsEnum(this.buildTypeIsEnum(typeBinding));
+ this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding));
+ this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding));
+ this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+
+
+ // ******** SourcePersistentMember implementation ********
+
+ @Override
+ Iterator<String> validAnnotationNames() {
+ return this.getAnnotationProvider().attributeAnnotationNames();
+ }
+
+ @Override
+ Annotation buildAnnotation(String annotationName) {
+ return this.getAnnotationProvider().buildAttributeAnnotation(this, this.annotatedElement, annotationName);
+ }
+
+ private Annotation buildNullAnnotation_(String annotationName) {
+ return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
+ }
+
+
+ // ******** JavaResourcePersistentAttribute implementation ********
+
+ @Override
+ public JavaResourcePersistentType getParent() {
+ return (JavaResourcePersistentType) super.getParent();
+ }
+
+ public JavaResourcePersistentType getResourcePersistentType() {
+ return this.getParent();
+ }
+
+ public String getName() {
+ return this.annotatedElement.getAttributeName();
+ }
+
+ public boolean isFor(MethodSignature signature, int occurrence) {
+ return ((MethodAttribute) this.annotatedElement).matches(signature, occurrence);
+ }
+
+ @Override
+ public Annotation buildNullAnnotation(String annotationName) {
+ return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
+ }
+
+ public boolean isField() {
+ return this.annotatedElement.isField();
+ }
+
+ public boolean isProperty() {
+ return ! this.isField();
+ }
+
+ public AccessType getSpecifiedAccess() {
+ Access2_0Annotation accessAnnotation = this.getAccessAnnotation();
+ return (accessAnnotation == null) ? null : accessAnnotation.getValue();
+ }
+
+ private Access2_0Annotation getAccessAnnotation() {
+ return (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
+ }
+
+ public boolean typeIsSubTypeOf(String tn) {
+ if (this.typeName == null) {
+ return false;
+ }
+ return this.typeName.equals(tn)
+ || this.typeInterfaceNames.contains(tn)
+ || this.typeSuperclassNames.contains(tn);
+ }
+
+ public boolean typeIsVariablePrimitive() {
+ return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName);
+ }
+
+ private ITypeBinding getTypeBinding(CompilationUnit astRoot) {
+ return this.annotatedElement.getTypeBinding(astRoot);
+ }
+
+
+ // ***** modifiers
+ public int getModifiers() {
+ return this.modifiers;
+ }
+
+ private void syncModifiers(int astModifiers) {
+ int old = this.modifiers;
+ this.modifiers = astModifiers;
+ this.firePropertyChanged(MODIFIERS_PROPERTY, old, astModifiers);
+ }
+
+ /**
+ * zero seems like a reasonable default...
+ */
+ private int buildModifiers(CompilationUnit astRoot) {
+ IBinding binding = this.annotatedElement.getBinding(astRoot);
+ return (binding == null) ? 0 : binding.getModifiers();
+ }
+
+ // ***** type name
+ public String getTypeName() {
+ return this.typeName;
+ }
+
+ private void syncTypeName(String astTypeName) {
+ String old = this.typeName;
+ this.typeName = astTypeName;
+ this.firePropertyChanged(TYPE_NAME_PROPERTY, old, astTypeName);
+ }
+
+ /**
+ * this can be an array (e.g. "java.lang.String[]");
+ * but no generic type arguments
+ */
+ private String buildTypeName(ITypeBinding typeBinding) {
+ if (typeBinding == null) {
+ return null;
+ }
+ // a type variable is what is declared by a generic type;
+ // e.g. "E" is a type variable declared by the generic type "Collection" in
+ // public interface Collection<E>
+ if (typeBinding.isTypeVariable()) {
+ // e.g. "E extends Number" has an erasure of "Number"
+ typeBinding = typeBinding.getErasure();
+ }
+ String tbName = typeBinding.getTypeDeclaration().getQualifiedName();
+ return (tbName.length() == 0) ? null : tbName;
+ }
+
+ // ***** type is interface
+ public boolean typeIsInterface() {
+ return this.typeIsInterface;
+ }
+
+ private void syncTypeIsInterface(boolean astTypeIsInterface) {
+ boolean old = this.typeIsInterface;
+ this.typeIsInterface = astTypeIsInterface;
+ this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, astTypeIsInterface);
+ }
+
+ private boolean buildTypeIsInterface(ITypeBinding typeBinding) {
+ return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isInterface();
+ }
+
+ // ***** type is enum
+ public boolean typeIsEnum() {
+ return this.typeIsEnum;
+ }
+
+ private void syncTypeIsEnum(boolean astTypeIsEnum) {
+ boolean old = this.typeIsEnum;
+ this.typeIsEnum = astTypeIsEnum;
+ this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, astTypeIsEnum);
+ }
+
+ private boolean buildTypeIsEnum(ITypeBinding typeBinding) {
+ return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isEnum();
+ }
+
+ // ***** type superclass hierarchy
+ public ListIterator<String> typeSuperclassNames() {
+ return new CloneListIterator<String>(this.typeSuperclassNames);
+ }
+
+ private void syncTypeSuperclassNames(List<String> astTypeSuperclassNames) {
+ this.synchronizeList(astTypeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST);
+ }
+
+ private List<String> buildTypeSuperclassNames(ITypeBinding typeBinding) {
+ if (typeBinding == null) {
+ return Collections.emptyList();
+ }
+ ArrayList<String> names = new ArrayList<String>();
+ typeBinding = typeBinding.getSuperclass();
+ while (typeBinding != null) {
+ names.add(typeBinding.getQualifiedName());
+ typeBinding = typeBinding.getSuperclass();
+ }
+ return names;
+ }
+
+ // ***** type interface hierarchy
+ public Iterator<String> typeInterfaceNames() {
+ return new CloneIterator<String>(this.typeInterfaceNames);
+ }
+
+// private boolean typeInterfaceNamesContains(String interfaceName) {
+// return this.typeInterfaceNames.contains(interfaceName);
+// }
+//
+ private void syncTypeInterfaceNames(Collection<String> astTypeInterfaceNames) {
+ this.synchronizeCollection(astTypeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION);
+ }
+
+ private Collection<String> buildTypeInterfaceNames(ITypeBinding typeBinding) {
+ if (typeBinding == null) {
+ return Collections.emptySet();
+ }
+ HashSet<String> names = new HashSet<String>();
+ while (typeBinding != null) {
+ this.addInterfaceNamesTo(typeBinding, names);
+ typeBinding = typeBinding.getSuperclass();
+ }
+ return names;
+ }
+
+ private void addInterfaceNamesTo(ITypeBinding typeBinding, HashSet<String> names) {
+ for (ITypeBinding interfaceBinding : typeBinding.getInterfaces()) {
+ names.add(interfaceBinding.getTypeDeclaration().getQualifiedName());
+ this.addInterfaceNamesTo(interfaceBinding, names); // recurse
+ }
+ }
+
+ // ***** type type argument names
+ public ListIterator<String> typeTypeArgumentNames() {
+ return new CloneListIterator<String>(this.typeTypeArgumentNames);
+ }
+
+ public int typeTypeArgumentNamesSize() {
+ return this.typeTypeArgumentNames.size();
+ }
+
+ public String getTypeTypeArgumentName(int index) {
+ return this.typeTypeArgumentNames.get(index);
+ }
+
+ private void syncTypeTypeArgumentNames(List<String> astTypeTypeArgumentNames) {
+ this.synchronizeList(astTypeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST);
+ }
+
+ /**
+ * these types can be arrays (e.g. "java.lang.String[]");
+ * but they won't have any further nested generic type arguments
+ * (e.g. "java.util.Collection<java.lang.String>")
+ */
+ private List<String> buildTypeTypeArgumentNames(ITypeBinding typeBinding) {
+ if (typeBinding == null) {
+ return Collections.emptyList();
+ }
+
+ ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
+ if (typeArguments.length == 0) {
+ return Collections.emptyList();
+ }
+
+ ArrayList<String> names = new ArrayList<String>(typeArguments.length);
+ for (ITypeBinding typeArgument : typeArguments) {
+ if (typeArgument == null) {
+ names.add(null);
+ } else {
+ // e.g. "? extends Number" has an erasure of "Number"
+ ITypeBinding erasure = typeArgument.getErasure();
+ names.add(erasure.getTypeDeclaration().getQualifiedName());
+ }
+ }
+ return names;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java
new file mode 100644
index 0000000000..d4af024013
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * Java source persistent member (annotations, "persistable")
+ */
+abstract class SourcePersistentMember<M extends Member>
+ extends SourceAnnotatedElement<M>
+ implements JavaResourcePersistentMember
+{
+ /**
+ * We can cache this setting because its value is not affected by any API
+ * calls - it can only be affected by changes to the Java source.
+ * @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter)
+ */
+ boolean persistable;
+
+ boolean final_; // 'final' is a reserved word
+
+
+ // ********** construction/initialization **********
+
+ SourcePersistentMember(JavaResourceNode parent, M member) {
+ super(parent, member);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.persistable = this.buildPersistable(astRoot);
+ IBinding binding = this.annotatedElement.getBinding(astRoot);
+ this.final_ = this.buildFinal(binding);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncPersistable(this.buildPersistable(astRoot));
+ IBinding binding = this.annotatedElement.getBinding(astRoot);
+ this.syncFinal(this.buildFinal(binding));
+ }
+
+
+ // ********** annotations **********
+
+ public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
+ HashSet<String> annotationNames = CollectionTools.set(supportingAnnotationNames);
+ if (primaryAnnotationName != null) {
+ annotationNames.add(primaryAnnotationName);
+ }
+ for (Annotation annotation : this.getAnnotations()) {
+ if ( ! annotationNames.contains(annotation.getAnnotationName())) {
+ this.annotations.remove(annotation);
+ annotation.removeAnnotation();
+ }
+ }
+ Annotation newPrimaryAnnotation = null;
+ if ((primaryAnnotationName != null) && (this.getAnnotation(primaryAnnotationName) == null)) {
+ newPrimaryAnnotation = this.buildAnnotation(primaryAnnotationName);
+ this.annotations.add(newPrimaryAnnotation);
+ newPrimaryAnnotation.newAnnotation();
+ }
+ return newPrimaryAnnotation;
+ }
+
+
+ // ********** persistable **********
+
+ public boolean isPersistable() {
+ return this.persistable;
+ }
+
+ private void syncPersistable(boolean astPersistable) {
+ boolean old = this.persistable;
+ this.persistable = astPersistable;
+ this.firePropertyChanged(PERSISTABLE_PROPERTY, old, astPersistable);
+ }
+
+ private boolean buildPersistable(CompilationUnit astRoot) {
+ return this.annotatedElement.isPersistable(astRoot);
+ }
+
+ // ***** final
+ public boolean isFinal() {
+ return this.final_;
+ }
+
+ private void syncFinal(boolean astFinal) {
+ boolean old = this.final_;
+ this.final_ = astFinal;
+ this.firePropertyChanged(FINAL_PROPERTY, old, astFinal);
+ }
+
+ private boolean buildFinal(IBinding binding) {
+ return (binding == null) ? false : Modifier.isFinal(binding.getModifiers());
+ }
+
+
+ // ********** miscellaneous **********
+
+ public boolean isFor(String memberName, int occurrence) {
+ return this.annotatedElement.matches(memberName, occurrence);
+ }
+
+ public void resolveTypes(CompilationUnit astRoot) {
+ this.syncPersistable(this.buildPersistable(astRoot));
+ }
+
+ /**
+ * convenience method
+ */
+ <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) {
+ @SuppressWarnings("unchecked")
+ Filter<T> filter = (Filter<T>) PERSISTABLE_MEMBER_FILTER;
+ return new FilteringIterator<T>(members, filter);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java
new file mode 100644
index 0000000000..bd14491de5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java
@@ -0,0 +1,930 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.IAnnotationBinding;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JDTType;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.utility.MethodSignature;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.SimpleIntReference;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.GeneratedAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.StaticMetamodelAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java source persistent type
+ */
+final class SourcePersistentType
+ extends SourcePersistentMember<Type>
+ implements JavaResourcePersistentType2_0
+{
+ private String name;
+
+ private String qualifiedName;
+
+ private String packageName;
+
+ private String superclassQualifiedName;
+
+ private String declaringTypeName;
+
+ private boolean abstract_; // 'abstract' is a reserved word
+
+ private boolean static_; // 'static' is a reserved word
+
+ private boolean memberType;
+
+ private boolean hasPrivateNoArgConstructor;
+
+ private boolean hasNoArgConstructor;
+
+ private final Vector<JavaResourcePersistentType> types = new Vector<JavaResourcePersistentType>();
+
+ private final Vector<JavaResourcePersistentAttribute> fields = new Vector<JavaResourcePersistentAttribute>();
+
+ private final Vector<JavaResourcePersistentAttribute> methods = new Vector<JavaResourcePersistentAttribute>();
+
+ private StaticMetamodelAnnotation staticMetamodelAnnotation;
+ //TODO move to interface after maintenance
+ public static final String STATIC_METAMODEL_ANNOTATION_PROPERTY = "staticMetamodelAnnotation"; //$NON-NLS-1$
+
+ private GeneratedAnnotation generatedAnnotation;
+ //TODO move to interface after maintenance
+ public static final String GENERATED_ANNOTATION_PROPERTY = "generatedAnnotation"; //$NON-NLS-1$
+
+
+ private static final StaticMetamodelAnnotationDefinition STATIC_METAMODEL_ANNOTATION_DEFINITION = StaticMetamodelAnnotationDefinition.instance();
+ private static final GeneratedAnnotationDefinition GENERATED_ANNOTATION_DEFINITION = GeneratedAnnotationDefinition.instance();
+
+
+ // ********** construction/initialization **********
+
+ /**
+ * build top-level persistent type
+ */
+ static JavaResourcePersistentType newInstance(
+ JavaResourceCompilationUnit javaResourceCompilationUnit,
+ TypeDeclaration typeDeclaration,
+ CompilationUnit astRoot) {
+ Type type = new JDTType(
+ typeDeclaration,
+ javaResourceCompilationUnit.getCompilationUnit(),
+ javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
+ javaResourceCompilationUnit.getAnnotationEditFormatter());
+ JavaResourcePersistentType jrpt = new SourcePersistentType(javaResourceCompilationUnit, type);
+ jrpt.initialize(astRoot);
+ return jrpt;
+ }
+
+ /**
+ * build nested persistent type
+ */
+ private static JavaResourcePersistentType newInstance(
+ JavaResourceCompilationUnit javaResourceCompilationUnit,
+ Type declaringType,
+ TypeDeclaration typeDeclaration,
+ int occurrence,
+ CompilationUnit astRoot) {
+ Type type = new JDTType(
+ declaringType,
+ typeDeclaration,
+ occurrence,
+ javaResourceCompilationUnit.getCompilationUnit(),
+ javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
+ javaResourceCompilationUnit.getAnnotationEditFormatter());
+ JavaResourcePersistentType jrpt = new SourcePersistentType(javaResourceCompilationUnit, type);
+ jrpt.initialize(astRoot);
+ return jrpt;
+ }
+
+ private SourcePersistentType(JavaResourceCompilationUnit javaResourceCompilationUnit, Type type) {
+ super(javaResourceCompilationUnit, type);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ ITypeBinding binding = this.annotatedElement.getBinding(astRoot);
+ this.name = this.buildName(binding);
+ this.qualifiedName = this.buildQualifiedName(binding);
+ this.packageName = this.buildPackageName(binding);
+ this.superclassQualifiedName = this.buildSuperclassQualifiedName(binding);
+ this.declaringTypeName = this.buildDeclaringTypeName(binding);
+ this.abstract_ = this.buildAbstract(binding);
+ this.static_ = this.buildStatic(binding);
+ this.memberType = this.buildMemberType(binding);
+ this.hasNoArgConstructor = this.buildHasNoArgConstructor(binding);
+ this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor(binding);
+ this.initializeTypes(astRoot);
+ this.initializeFields(astRoot);
+ this.initializeMethods(astRoot);
+ }
+
+ /**
+ * Handle the <code>StaticMetamodel</code> and <code>Generated</code>
+ * annotations differently, since they are not really JPA "mapping"
+ * annotations....
+ */
+ @Override
+ void addInitialAnnotation(String astAnnotationName, CompilationUnit astRoot) {
+ if (astAnnotationName.equals(STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName())) {
+ this.addInitialStaticMetamodelAnnotation(astRoot);
+ } else if (astAnnotationName.equals(GENERATED_ANNOTATION_DEFINITION.getAnnotationName())) {
+ this.addInitialGeneratedAnnotation(astRoot);
+ } else {
+ super.addInitialAnnotation(astAnnotationName, astRoot);
+ }
+ }
+
+
+ // ********** update **********
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ ITypeBinding binding = this.annotatedElement.getBinding(astRoot);
+ this.syncName(this.buildName(binding));
+ this.syncQualifiedName(this.buildQualifiedName(binding));
+ this.syncPackageName(this.buildPackageName(binding));
+ this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(binding));
+ this.syncDeclaringTypeName(this.buildDeclaringTypeName(binding));
+ this.syncAbstract(this.buildAbstract(binding));
+ this.syncStatic(this.buildStatic(binding));
+ this.syncMemberType(this.buildMemberType(binding));
+ this.syncHasNoArgConstructor(this.buildHasNoArgConstructor(binding));
+ this.syncHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor(binding));
+ this.syncTypes(astRoot);
+ this.syncFields(astRoot);
+ this.syncMethods(astRoot);
+ this.syncMetamodelAnnotations(astRoot);
+ }
+
+ /**
+ * Handle the <code>StaticMetamodel</code> and <code>Generated</code>
+ * annotations differently, since they are not really JPA "mapping"
+ * annotations. We aren't overriding {@link #addOrSyncAnnotation(String, CompilationUnit, java.util.Set)}
+ * because we also have to handle removing these annotations separately.
+ */
+ private void syncMetamodelAnnotations(CompilationUnit astRoot) {
+ ITypeBinding binding = this.annotatedElement.getBinding(astRoot);
+ if (binding != null) {
+ this.syncStaticMetamodelAnnotation(astRoot, binding);
+ this.syncGeneratedAnnotation(astRoot, binding);
+ }
+ }
+
+
+ // ********** SourcePersistentMember implementation **********
+
+ @Override
+ Iterator<String> validAnnotationNames() {
+ return this.getAnnotationProvider().typeAnnotationNames();
+ }
+
+ @Override
+ Annotation buildAnnotation(String annotationName) {
+ return this.getAnnotationProvider().buildTypeAnnotation(this, this.annotatedElement, annotationName);
+ }
+
+ @Override
+ Annotation buildNullAnnotation(String annotationName) {
+ return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName);
+ }
+
+ @Override
+ public void resolveTypes(CompilationUnit astRoot) {
+ super.resolveTypes(astRoot);
+
+ this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(this.annotatedElement.getBinding(astRoot)));
+
+ for (JavaResourcePersistentAttribute field : this.getFields()) {
+ field.resolveTypes(astRoot);
+ }
+
+ // a new type can trigger a method parameter type to be a resolved,
+ // fully-qualified name, so we need to rebuild our list of methods:
+ // "setFoo(Foo)" is not the same as "setFoo(com.bar.Foo)"
+ // and, vice-versa, a removed type can "unresolve" a parameter type
+ this.syncMethods(astRoot);
+
+ for (JavaResourcePersistentAttribute method : this.getMethods()) {
+ method.resolveTypes(astRoot);
+ }
+ for (JavaResourcePersistentType type : this.getTypes()) {
+ type.resolveTypes(astRoot);
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ******** JavaResourcePersistentType implementation ********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(ITypeBinding binding) {
+ return (binding == null) ? null : binding.getName();
+ }
+
+ // ***** qualified name
+ public String getQualifiedName() {
+ return this.qualifiedName;
+ }
+
+ private void syncQualifiedName(String astQualifiedName) {
+ String old = this.qualifiedName;
+ this.qualifiedName = astQualifiedName;
+ this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, astQualifiedName);
+ }
+
+ private String buildQualifiedName(ITypeBinding binding) {
+ return (binding == null) ? null : binding.getQualifiedName();
+ }
+
+ // ***** package name
+ public String getPackageName() {
+ return this.packageName;
+ }
+
+ private void syncPackageName(String astPackageName) {
+ String old = this.packageName;
+ this.packageName = astPackageName;
+ this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, astPackageName);
+ }
+
+ private String buildPackageName(ITypeBinding binding) {
+ return (binding == null) ? null : binding.getPackage().getName();
+ }
+
+ // ***** superclass qualified name
+ public String getSuperclassQualifiedName() {
+ return this.superclassQualifiedName;
+ }
+
+ private void syncSuperclassQualifiedName(String astSuperclassQualifiedName) {
+ String old = this.superclassQualifiedName;
+ this.superclassQualifiedName = astSuperclassQualifiedName;
+ this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, astSuperclassQualifiedName);
+ }
+
+ private String buildSuperclassQualifiedName(ITypeBinding binding) {
+ if (binding == null) {
+ return null;
+ }
+ ITypeBinding superclass = binding.getSuperclass();
+ return (superclass == null) ? null : superclass.getTypeDeclaration().getQualifiedName();
+ }
+
+ // ***** package
+ public boolean isIn(IPackageFragment packageFragment) {
+ return StringTools.stringsAreEqual(packageFragment.getElementName(), this.packageName);
+ }
+
+ // ***** declaring type name
+ public String getDeclaringTypeName() {
+ return this.declaringTypeName;
+ }
+
+ private void syncDeclaringTypeName(String astDeclaringTypeName) {
+ String old = this.declaringTypeName;
+ this.declaringTypeName = astDeclaringTypeName;
+ this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, astDeclaringTypeName);
+ }
+
+ private String buildDeclaringTypeName(ITypeBinding binding) {
+ if (binding == null) {
+ return null;
+ }
+ ITypeBinding declaringClass = binding.getDeclaringClass();
+ return (declaringClass == null) ? null : declaringClass.getTypeDeclaration().getQualifiedName();
+ }
+
+ // ***** abstract
+ public boolean isAbstract() {
+ return this.abstract_;
+ }
+
+ private void syncAbstract(boolean astAbstract) {
+ boolean old = this.abstract_;
+ this.abstract_ = astAbstract;
+ this.firePropertyChanged(ABSTRACT_PROPERTY, old, astAbstract);
+ }
+
+ private boolean buildAbstract(ITypeBinding binding) {
+ return (binding == null) ? false : Modifier.isAbstract(binding.getModifiers());
+ }
+
+ // ***** static
+ public boolean isStatic() {
+ return this.static_;
+ }
+
+ private void syncStatic(boolean astStatic_) {
+ boolean old = this.static_;
+ this.static_ = astStatic_;
+ this.firePropertyChanged(STATIC_PROPERTY, old, astStatic_);
+ }
+
+ private boolean buildStatic(ITypeBinding binding) {
+ return (binding == null) ? false : Modifier.isStatic(binding.getModifiers());
+ }
+
+ // ***** member type
+ public boolean isMemberType() {
+ return this.memberType;
+ }
+
+ private void syncMemberType(boolean astMemberType) {
+ boolean old = this.memberType;
+ this.memberType = astMemberType;
+ this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, astMemberType);
+ }
+
+ private boolean buildMemberType(ITypeBinding binding) {
+ return (binding == null) ? false : binding.isMember();
+ }
+
+ // ***** no-arg constructor
+ public boolean hasNoArgConstructor() {
+ return this.hasNoArgConstructor;
+ }
+
+ private void syncHasNoArgConstructor(boolean astHasNoArgConstructor) {
+ boolean old = this.hasNoArgConstructor;
+ this.hasNoArgConstructor = astHasNoArgConstructor;
+ this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, astHasNoArgConstructor);
+ }
+
+ private boolean buildHasNoArgConstructor(ITypeBinding binding) {
+ return (binding == null) ? false : typeHasNoArgConstructor(binding);
+ }
+
+ protected static boolean typeHasNoArgConstructor(ITypeBinding binding) {
+ return findNoArgConstructor(binding) != null;
+ }
+
+ protected static IMethodBinding findNoArgConstructor(ITypeBinding binding) {
+ for (IMethodBinding method : binding.getDeclaredMethods()) {
+ if (method.isConstructor()) {
+ if (method.getParameterTypes().length == 0) {
+ return method;
+ }
+ }
+ }
+ return null;
+ }
+
+ // ***** private no-arg constructor
+ public boolean hasPrivateNoArgConstructor() {
+ return this.hasPrivateNoArgConstructor;
+ }
+
+ private void syncHasPrivateNoArgConstructor(boolean astHasPrivateNoArgConstructor) {
+ boolean old = this.hasPrivateNoArgConstructor;
+ this.hasPrivateNoArgConstructor = astHasPrivateNoArgConstructor;
+ this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, astHasPrivateNoArgConstructor);
+ }
+
+ private boolean buildHasPrivateNoArgConstructor(ITypeBinding binding) {
+ return (binding == null) ? false : typeHasPrivateNoArgConstructor(binding);
+ }
+
+ protected static boolean typeHasPrivateNoArgConstructor(ITypeBinding binding) {
+ IMethodBinding method = findNoArgConstructor(binding);
+ return (method != null) && Modifier.isPrivate(method.getModifiers());
+ }
+
+
+ // ********** misc **********
+
+ public boolean isMapped() {
+ for (Annotation each : this.getAnnotations()) {
+ if (this.annotationIsMappingAnnotation(each)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean annotationIsMappingAnnotation(Annotation annotation) {
+ return CollectionTools.contains(this.mappingAnnotationNames(), annotation.getAnnotationName());
+ }
+
+ private Iterator<String> mappingAnnotationNames() {
+ return this.getAnnotationProvider().typeMappingAnnotationNames();
+ }
+
+ /**
+ * check only persistable attributes
+ */
+ public boolean hasAnyAnnotatedAttributes() {
+ for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) {
+ if (stream.next().isAnnotated()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ // ********** types **********
+
+ public Iterator<JavaResourcePersistentType> types() {
+ return this.getTypes().iterator();
+ }
+
+ private Iterable<JavaResourcePersistentType> getTypes() {
+ return new LiveCloneIterable<JavaResourcePersistentType>(this.types); // read-only
+ }
+
+ public Iterator<JavaResourcePersistentType> allTypes() {
+ return new TreeIterator<JavaResourcePersistentType>(this) {
+ @Override
+ protected Iterator<? extends JavaResourcePersistentType> children(JavaResourcePersistentType type) {
+ return type.types();
+ }
+ };
+ }
+
+ public Iterator<JavaResourcePersistentType> persistableTypes() {
+ return this.persistableMembers(this.types());
+ }
+
+ private JavaResourcePersistentType getType(String typeName, int occurrence) {
+ for (JavaResourcePersistentType type : this.getTypes()) {
+ if (type.isFor(typeName, occurrence)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ private void addType(JavaResourcePersistentType type) {
+ this.addItemToCollection(type, this.types, TYPES_COLLECTION);
+ }
+
+ private void removeTypes(Collection<JavaResourcePersistentType> remove) {
+ this.removeItemsFromCollection(remove, this.types, TYPES_COLLECTION);
+ }
+
+ private void initializeTypes(CompilationUnit astRoot) {
+ TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot);
+ CounterMap counters = new CounterMap(typeDeclarations.length);
+ for (TypeDeclaration td : typeDeclarations) {
+ String tdName = td.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(tdName);
+ this.types.add(this.buildType(td, occurrence, astRoot));
+ }
+ }
+
+ private void syncTypes(CompilationUnit astRoot) {
+ TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot);
+ CounterMap counters = new CounterMap(typeDeclarations.length);
+ HashSet<JavaResourcePersistentType> typesToRemove = new HashSet<JavaResourcePersistentType>(this.types);
+ for (TypeDeclaration typeDeclaration : typeDeclarations) {
+ String tdName = typeDeclaration.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(tdName);
+
+ JavaResourcePersistentType type = this.getType(tdName, occurrence);
+ if (type == null) {
+ this.addType(this.buildType(typeDeclaration, occurrence, astRoot));
+ } else {
+ typesToRemove.remove(type);
+ type.synchronizeWith(astRoot);
+ }
+ }
+ this.removeTypes(typesToRemove);
+ }
+
+ private JavaResourcePersistentType buildType(TypeDeclaration nestedTypeDeclaration, int occurrence, CompilationUnit astRoot) {
+ return newInstance(this.getJavaResourceCompilationUnit(), this.annotatedElement, nestedTypeDeclaration, occurrence, astRoot);
+ }
+
+
+ // ********** fields **********
+
+ public Iterator<JavaResourcePersistentAttribute> fields() {
+ return this.getFields().iterator();
+ }
+
+ private Iterable<JavaResourcePersistentAttribute> getFields() {
+ return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.fields);
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableFields() {
+ return this.persistableMembers(this.fields());
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() {
+ return new FilteringIterator<JavaResourcePersistentAttribute>(
+ this.persistableFields(),
+ FIELD_ACCESS_TYPE_FILTER
+ );
+ }
+
+ private void addField(JavaResourcePersistentAttribute field) {
+ this.addItemToCollection(field, this.fields, FIELDS_COLLECTION);
+ }
+
+ private JavaResourcePersistentAttribute getField(String fieldName, int occurrence) {
+ for (JavaResourcePersistentAttribute field : this.getFields()) {
+ if (field.isFor(fieldName, occurrence)) {
+ return field;
+ }
+ }
+ return null;
+ }
+
+ private void removeFields(Collection<JavaResourcePersistentAttribute> remove) {
+ this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION);
+ }
+
+ private void initializeFields(CompilationUnit astRoot) {
+ FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot);
+ CounterMap counters = new CounterMap(fieldDeclarations.length);
+ for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
+ for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
+ String fieldName = fragment.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(fieldName);
+ this.fields.add(this.buildField(fieldName, occurrence, astRoot));
+ }
+ }
+ }
+
+ private void syncFields(CompilationUnit astRoot) {
+ FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot);
+ CounterMap counters = new CounterMap(fieldDeclarations.length);
+ HashSet<JavaResourcePersistentAttribute> fieldsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.fields);
+ for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
+ for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
+ String fieldName = fragment.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(fieldName);
+
+ JavaResourcePersistentAttribute field = this.getField(fieldName, occurrence);
+ if (field == null) {
+ this.addField(this.buildField(fieldName, occurrence, astRoot));
+ } else {
+ fieldsToRemove.remove(field);
+ field.synchronizeWith(astRoot);
+ }
+ }
+ }
+ this.removeFields(fieldsToRemove);
+ }
+
+ private JavaResourcePersistentAttribute buildField(String fieldName, int occurrence, CompilationUnit astRoot) {
+ return SourcePersistentAttribute.newInstance(this, this.annotatedElement, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
+ }
+
+ // minimize scope of suppressed warnings
+ @SuppressWarnings("unchecked")
+ private static List<VariableDeclarationFragment> fragments(FieldDeclaration fd) {
+ return fd.fragments();
+ }
+
+
+ // ********** methods **********
+
+ public Iterator<JavaResourcePersistentAttribute> methods() {
+ return this.getMethods().iterator();
+ }
+
+ private Iterable<JavaResourcePersistentAttribute> getMethods() {
+ return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.methods);
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableProperties() {
+ return this.persistableMembers(this.methods());
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() {
+ return new FilteringIterator<JavaResourcePersistentAttribute>(
+ this.persistableProperties(),
+ PROPERTY_ACCESS_TYPE_FILTER
+ );
+ }
+
+ private JavaResourcePersistentAttribute getMethod(MethodSignature signature, int occurrence) {
+ for (JavaResourcePersistentAttribute method : this.getMethods()) {
+ if (method.isFor(signature, occurrence)) {
+ return method;
+ }
+ }
+ return null;
+ }
+
+ private void addMethod(JavaResourcePersistentAttribute method) {
+ this.addItemToCollection(method, this.methods, METHODS_COLLECTION);
+ }
+
+ private void removeMethods(Collection<JavaResourcePersistentAttribute> remove) {
+ this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION);
+ }
+
+ private void initializeMethods(CompilationUnit astRoot) {
+ MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot);
+ CounterMap counters = new CounterMap(methodDeclarations.length);
+ for (MethodDeclaration methodDeclaration : methodDeclarations) {
+ MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration);
+ int occurrence = counters.increment(signature);
+ this.methods.add(this.buildMethod(signature, occurrence, astRoot));
+ }
+ }
+
+ private void syncMethods(CompilationUnit astRoot) {
+ MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot);
+ CounterMap counters = new CounterMap(methodDeclarations.length);
+ HashSet<JavaResourcePersistentAttribute> methodsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.methods);
+ for (MethodDeclaration methodDeclaration : methodDeclarations) {
+ MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration);
+ int occurrence = counters.increment(signature);
+
+ JavaResourcePersistentAttribute method = this.getMethod(signature, occurrence);
+ if (method == null) {
+ this.addMethod(this.buildMethod(signature, occurrence, astRoot));
+ } else {
+ methodsToRemove.remove(method);
+ method.synchronizeWith(astRoot);
+ }
+ }
+ this.removeMethods(methodsToRemove);
+ }
+
+ private JavaResourcePersistentAttribute buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) {
+ return SourcePersistentAttribute.newInstance(this, this.annotatedElement, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
+ }
+
+
+ // ********** attributes **********
+
+ @SuppressWarnings("unchecked")
+ public Iterator<JavaResourcePersistentAttribute> persistableAttributes() {
+ return new CompositeIterator<JavaResourcePersistentAttribute>(
+ this.persistableFields(),
+ this.persistableProperties()
+ );
+ }
+
+ public Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess) {
+ switch (specifiedAccess) {
+ case FIELD :
+ return this.persistableAttributesForFieldAccessType();
+ case PROPERTY :
+ return this.persistableAttributesForPropertyAccessType();
+ default :
+ throw new IllegalArgumentException("unknown access: " + specifiedAccess); //$NON-NLS-1$
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private Iterator<JavaResourcePersistentAttribute> persistableAttributesForFieldAccessType() {
+ return new CompositeIterator<JavaResourcePersistentAttribute>(
+ this.persistableFields(),
+ this.persistablePropertiesWithSpecifiedPropertyAccess()
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ private Iterator<JavaResourcePersistentAttribute> persistableAttributesForPropertyAccessType() {
+ return new CompositeIterator<JavaResourcePersistentAttribute>(
+ this.persistableProperties(),
+ this.persistableFieldsWithSpecifiedFieldAccess()
+ );
+ }
+
+
+ // ********** metamodel **********
+
+ // ***** StaticMetamodel
+ private void setStaticMetamodelAnnotation(StaticMetamodelAnnotation staticMetamodelAnnotation) {
+ StaticMetamodelAnnotation old = this.staticMetamodelAnnotation;
+ this.staticMetamodelAnnotation = staticMetamodelAnnotation;
+ this.firePropertyChanged(STATIC_METAMODEL_ANNOTATION_PROPERTY, old, this.staticMetamodelAnnotation);
+ }
+
+ private void addInitialStaticMetamodelAnnotation(CompilationUnit astRoot) {
+ if (this.staticMetamodelAnnotation == null) { // ignore duplicates
+ this.staticMetamodelAnnotation = this.buildStaticMetamodelAnnotation(astRoot);
+ }
+ }
+
+ private StaticMetamodelAnnotation buildStaticMetamodelAnnotation(CompilationUnit astRoot) {
+ StaticMetamodelAnnotation annotation = STATIC_METAMODEL_ANNOTATION_DEFINITION.buildAnnotation(this, this.annotatedElement);
+ annotation.initialize(astRoot);
+ return annotation;
+ }
+
+ private void syncStaticMetamodelAnnotation(CompilationUnit astRoot, ITypeBinding binding) {
+ if (this.bindingContainsStaticMetamodelAnnotation(binding)) {
+ if (this.staticMetamodelAnnotation != null) {
+ this.staticMetamodelAnnotation.synchronizeWith(astRoot);
+ } else {
+ this.setStaticMetamodelAnnotation(this.buildStaticMetamodelAnnotation(astRoot));
+ }
+ } else {
+ this.setStaticMetamodelAnnotation(null);
+ }
+ }
+
+ private boolean bindingContainsStaticMetamodelAnnotation(ITypeBinding binding) {
+ return this.bindingContainsAnnotation(binding, STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName());
+ }
+
+ // ***** Generated
+ public GeneratedAnnotation getGeneratedAnnotation() {
+ return this.generatedAnnotation;
+ }
+
+ private void setGeneratedAnnotation(GeneratedAnnotation generatedAnnotation) {
+ GeneratedAnnotation old = this.generatedAnnotation;
+ this.generatedAnnotation = generatedAnnotation;
+ this.firePropertyChanged(GENERATED_ANNOTATION_PROPERTY, old, this.generatedAnnotation);
+ }
+
+ private void addInitialGeneratedAnnotation(CompilationUnit astRoot) {
+ if (this.generatedAnnotation == null) { // ignore duplicates
+ this.generatedAnnotation = this.buildGeneratedAnnotation(astRoot);
+ }
+ }
+
+ private GeneratedAnnotation buildGeneratedAnnotation(CompilationUnit astRoot) {
+ GeneratedAnnotation annotation = GENERATED_ANNOTATION_DEFINITION.buildAnnotation(this, this.annotatedElement);
+ annotation.initialize(astRoot);
+ return annotation;
+ }
+
+ private void syncGeneratedAnnotation(CompilationUnit astRoot, ITypeBinding binding) {
+ if (this.bindingContainsGeneratedAnnotation(binding)) {
+ if (this.generatedAnnotation != null) {
+ this.generatedAnnotation.synchronizeWith(astRoot);
+ } else {
+ this.setGeneratedAnnotation(this.buildGeneratedAnnotation(astRoot));
+ }
+ } else {
+ this.setGeneratedAnnotation(null);
+ }
+ }
+
+ private boolean bindingContainsGeneratedAnnotation(ITypeBinding binding) {
+ return this.bindingContainsAnnotation(binding, GENERATED_ANNOTATION_DEFINITION.getAnnotationName());
+ }
+
+ private boolean bindingContainsAnnotation(ITypeBinding binding, String annotationName) {
+ for (IAnnotationBinding annotationBinding : binding.getAnnotations()) {
+ ITypeBinding annotationTypeBinding = annotationBinding.getAnnotationType();
+ if ((annotationTypeBinding != null) && annotationTypeBinding.getQualifiedName().equals(annotationName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * The type must be:<ul>
+ * <li>in the specified source folder
+ * <li>a top-level type
+ * <li>annotated with <code>&#64;javax.annotation.Generated</code> with
+ * the appropriate <code>value</code> and <code>date</code>
+ * <li>either itself or one of its nested types annotated with
+ * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
+ * </ul>
+ */
+ public boolean isGeneratedMetamodelTopLevelType(IPackageFragmentRoot sourceFolder) {
+ if ( ! this.getSourceFolder().equals(sourceFolder)) {
+ return false;
+ }
+ return this.isGeneratedMetamodelTopLevelType();
+ }
+
+ /**
+ * The type must be:<ul>
+ * <li>a top-level type
+ * <li>annotated with <code>&#64;javax.annotation.Generated</code> with
+ * the appropriate <code>value</code> and <code>date</code>
+ * <li>either itself or one of its nested types annotated with
+ * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
+ * </ul>
+ */
+ public boolean isGeneratedMetamodelTopLevelType() {
+ if ( ! this.isGenerated()) {
+ return false;
+ }
+ // if we get here we know we have a top-level type, since only top-level
+ // types are annotated @Generated; now see if anything is a metamodel
+ for (Iterator<JavaResourcePersistentType> stream = this.allTypes(); stream.hasNext(); ) {
+ JavaResourcePersistentType2_0 type = (JavaResourcePersistentType2_0) stream.next();
+ if (type.isMetamodel()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * The type must be annotated with
+ * <code>&#64;javax.annotation.Generated</code> with the appropriate
+ * <code>value</code> and <code>date</code>.
+ */
+ private boolean isGenerated() {
+ if (this.generatedAnnotation == null) {
+ return false;
+ }
+ if (this.generatedAnnotation.valuesSize() != 1) {
+ return false;
+ }
+ if ( ! this.generatedAnnotation.getValue(0).equals(METAMODEL_GENERATED_ANNOTATION_VALUE)) {
+ return false;
+ }
+ if (StringTools.stringIsEmpty(this.generatedAnnotation.getDate())) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The type must be annotated with
+ * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>.
+ */
+ public boolean isMetamodel() {
+ return this.staticMetamodelAnnotation != null;
+ }
+
+ private IPackageFragmentRoot getSourceFolder() {
+ return (IPackageFragmentRoot) this.getJavaResourceCompilationUnit().getCompilationUnit().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+ }
+
+
+ // ********** CounterMap **********
+
+ private static class CounterMap {
+ private final HashMap<Object, SimpleIntReference> counters;
+
+ protected CounterMap(int initialCapacity) {
+ super();
+ this.counters = new HashMap<Object, SimpleIntReference>(initialCapacity);
+ }
+
+ /**
+ * Return the incremented count for the specified object.
+ */
+ int increment(Object o) {
+ SimpleIntReference counter = this.counters.get(o);
+ if (counter == null) {
+ counter = new SimpleIntReference();
+ this.counters.put(o, counter);
+ }
+ counter.increment();
+ return counter.getValue();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
new file mode 100644
index 0000000000..d1b38ac243
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
+
+/**
+ * <code>javax.persistence.PrimaryKeyJoinColumn</code>
+ */
+public final class SourcePrimaryKeyJoinColumnAnnotation
+ extends SourceNamedColumnAnnotation
+ implements NestablePrimaryKeyJoinColumnAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
+ private AnnotationElementAdapter<String> referencedColumnNameAdapter;
+ private String referencedColumnName;
+
+
+ public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
+ this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
+ }
+
+ public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ }
+
+ public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.referencedColumnName = this.buildReferencedColumnName(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncReferencedColumnName(this.buildReferencedColumnName(astRoot));
+ }
+
+
+ // ********** JavaSourceNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** PrimaryKeyJoinColumn implementation **********
+
+ // ***** referenced column name
+ public String getReferencedColumnName() {
+ return this.referencedColumnName;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ if (this.attributeValueHasChanged(this.referencedColumnName, referencedColumnName)) {
+ this.referencedColumnName = referencedColumnName;
+ this.referencedColumnNameAdapter.setValue(referencedColumnName);
+ }
+ }
+
+ private void syncReferencedColumnName(String astReferencedColumnName) {
+ String old = this.referencedColumnName;
+ this.referencedColumnName = astReferencedColumnName;
+ this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, astReferencedColumnName);
+ }
+
+ private String buildReferencedColumnName(CompilationUnit astRoot) {
+ return this.referencedColumnNameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.referencedColumnNameDeclarationAdapter, astRoot);
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.referencedColumnNameDeclarationAdapter, pos, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildReferencedColumnNameDeclarationAdapter() {
+ return this.buildStringElementAdapter(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+ }
+
+ private AnnotationElementAdapter<String> buildReferencedColumnNameAdapter() {
+ return this.buildStringElementAdapter(this.referencedColumnNameDeclarationAdapter);
+ }
+
+
+ // ********** NestableAnnotation implementation **********
+
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.referencedColumnName == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
+ this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(REFERENCED_COLUMN_NAME_PROPERTY, this.referencedColumnName);
+ this.referencedColumnName = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setReferencedColumnName((String) map.get(REFERENCED_COLUMN_NAME_PROPERTY));
+ }
+
+
+ // ********** static methods **********
+
+ public static SourcePrimaryKeyJoinColumnAnnotation createPrimaryKeyJoinColumn(JavaResourceNode parent, Member member) {
+ return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ static SourcePrimaryKeyJoinColumnAnnotation createNestedPrimaryKeyJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, pkJoinColumnsAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
+ return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, idaa, annotationAdapter);
+ }
+
+ static NestablePrimaryKeyJoinColumnAnnotation createSecondaryTablePrimaryKeyJoinColumn(DeclarationAnnotationAdapter secondaryTableAdapter, JavaResourceNode parent, Member member, int index) {
+ return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, buildSecondaryTableAnnotationAdapter(secondaryTableAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildSecondaryTableAnnotationAdapter(DeclarationAnnotationAdapter secondaryTableAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(secondaryTableAdapter, JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS, index, ANNOTATION_NAME);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
new file mode 100644
index 0000000000..fcc5e7f99a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+
+/**
+ * <code>javax.persistence.PrimaryKeyJoinColumns</code>
+ */
+public final class SourcePrimaryKeyJoinColumnsAnnotation
+ extends SourceAnnotation<Member>
+ implements PrimaryKeyJoinColumnsAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns = new Vector<NestablePrimaryKeyJoinColumnAnnotation>();
+
+
+ public SourcePrimaryKeyJoinColumnsAnnotation(JavaResourceNode parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.pkJoinColumns.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.pkJoinColumns);
+ }
+
+
+ // ********** AnnotationContainer Implementation **********
+
+ public String getElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.pkJoinColumns.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.pkJoinColumns.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.pkJoinColumns.add(index, (NestablePrimaryKeyJoinColumnAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.pkJoinColumns.remove(0).convertToStandAlone();
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.pkJoinColumns.size());
+ }
+
+ private NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotation(int index) {
+ NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.buildPrimaryKeyJoinColumn(index);
+ this.pkJoinColumns.add(index, pkJoinColumn);
+ return pkJoinColumn;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.pkJoinColumns.size();
+ NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.addNestedAnnotation(index);
+ pkJoinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, pkJoinColumn);
+ }
+
+ private NestablePrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumn(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourcePrimaryKeyJoinColumnAnnotation.createNestedPrimaryKeyJoinColumn(this.parent, this.annotatedElement, index, this.daa);
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return this.pkJoinColumns.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java
new file mode 100644
index 0000000000..40c26b89d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
+
+/**
+ * <ul>
+ * <li><code>javax.persistence.NamedQuery</code>
+ * <li><code>javax.persistence.NamedNativeQuery</code>
+ * </ul>
+ */
+abstract class SourceQueryAnnotation
+ extends SourceAnnotation<Type>
+ implements QueryAnnotation
+{
+ DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ AnnotationElementAdapter<String> nameAdapter;
+ String name;
+
+ DeclarationAnnotationElementAdapter<String> queryDeclarationAdapter;
+ AnnotationElementAdapter<String> queryAdapter;
+ String query;
+
+ final Vector<NestableQueryHintAnnotation> hints = new Vector<NestableQueryHintAnnotation>();
+ final HintsAnnotationContainer hintsContainer = new HintsAnnotationContainer();
+
+
+ SourceQueryAnnotation(JavaResourceNode parent, Type type,DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.queryDeclarationAdapter = this.buildQueryDeclarationAdapter();
+ this.queryAdapter = this.buildQueryAdapter();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.query = this.buildQuery(astRoot);
+ AnnotationContainerTools.initialize(this.hintsContainer, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncQuery(this.buildQuery(astRoot));
+ AnnotationContainerTools.synchronize(this.hintsContainer, astRoot);
+ }
+
+
+ // ********** BaseNamedQueryAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, this.getNameElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildNameAdapter() {
+ return this.buildStringElementAdapter(this.nameDeclarationAdapter);
+ }
+
+ abstract String getNameElementName();
+
+ // ***** query
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String query) {
+ if (this.attributeValueHasChanged(this.query, query)) {
+ this.query = query;
+ this.queryAdapter.setValue(query);
+ }
+ }
+
+ private void syncQuery(String annotationQuery) {
+ String old = this.query;
+ this.query = annotationQuery;
+ this.firePropertyChanged(QUERY_PROPERTY, old, annotationQuery);
+ }
+
+ private String buildQuery(CompilationUnit astRoot) {
+ return this.queryAdapter.getValue(astRoot);
+ }
+
+ public TextRange getQueryTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.queryDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildQueryDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, this.getQueryElementName());
+ }
+
+ private AnnotationElementAdapter<String> buildQueryAdapter() {
+ return this.buildStringElementAdapter(this.queryDeclarationAdapter);
+ }
+
+ abstract String getQueryElementName();
+
+ // ***** hints
+ public ListIterator<QueryHintAnnotation> hints() {
+ return new CloneListIterator<QueryHintAnnotation>(this.hints);
+ }
+
+ Iterable<NestableQueryHintAnnotation> getNestableHints() {
+ return new LiveCloneIterable<NestableQueryHintAnnotation>(this.hints);
+ }
+
+ public int hintsSize() {
+ return this.hints.size();
+ }
+
+ public NestableQueryHintAnnotation hintAt(int index) {
+ return this.hints.get(index);
+ }
+
+ public int indexOfHint(QueryHintAnnotation hint) {
+ return this.hints.indexOf(hint);
+ }
+
+ private NestableQueryHintAnnotation addHint() {
+ return this.addHint(this.hints.size());
+ }
+
+ public NestableQueryHintAnnotation addHint(int index) {
+ return (NestableQueryHintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.hintsContainer);
+ }
+
+ NestableQueryHintAnnotation addHint_() {
+ return this.addHint_(this.hints.size());
+ }
+
+ private NestableQueryHintAnnotation addHint_(int index) {
+ NestableQueryHintAnnotation hint = this.buildHint(index);
+ this.hints.add(index, hint);
+ return hint;
+ }
+
+ void syncAddHint(Annotation astAnnotation) {
+ int index = this.hints.size();
+ NestableQueryHintAnnotation hint = this.addHint_(index);
+ hint.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(HINTS_LIST, index, hint);
+ }
+
+ abstract NestableQueryHintAnnotation buildHint(int index);
+
+ void hintAdded(int index, NestableQueryHintAnnotation hint) {
+ this.fireItemAdded(HINTS_LIST, index, hint);
+ }
+
+ public void moveHint(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.hintsContainer);
+ }
+
+ NestableQueryHintAnnotation moveHint_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.hints, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public void removeHint(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.hintsContainer);
+ }
+
+ NestableQueryHintAnnotation removeHint_(int index) {
+ return this.hints.remove(index);
+ }
+
+ void syncRemoveHints(int index) {
+ this.removeItemsFromList(index, this.hints, HINTS_LIST);
+ }
+
+ abstract String getHintsElementName();
+
+
+ // ********** NestableAnnotation implementation **********
+
+ /**
+ * convenience implementation of method from NestableAnnotation interface
+ * for subclasses
+ */
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null) &&
+ (this.query == null) &&
+ this.hints.isEmpty();
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.queryDeclarationAdapter = this.buildQueryDeclarationAdapter();
+ this.queryAdapter = this.buildQueryAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+
+ map.put(NAME_PROPERTY, this.name);
+ this.name = null;
+ map.put(QUERY_PROPERTY, this.query);
+ this.query = null;
+
+ List<Map<String, Object>> hintsState = this.buildStateList(this.hints.size());
+ for (NestableQueryHintAnnotation hint : this.getNestableHints()) {
+ Map<String, Object> hintState = new HashMap<String, Object>();
+ hint.storeOn(hintState);
+ hintsState.add(hintState);
+ }
+ map.put(HINTS_LIST, hintsState);
+ this.hints.clear();
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+
+ this.setName((String) map.get(NAME_PROPERTY));
+ this.setQuery((String) map.get(QUERY_PROPERTY));
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> hintsState = (List<Map<String, Object>>) map.get(HINTS_LIST);
+ for (Map<String, Object> hintState : hintsState) {
+ this.addHint().restoreFrom(hintState);
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** hint container **********
+
+ /**
+ * adapt the AnnotationContainer interface to the override's join columns
+ */
+ class HintsAnnotationContainer
+ implements AnnotationContainer<NestableQueryHintAnnotation>
+ {
+ public Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return SourceQueryAnnotation.this.getAstAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return SourceQueryAnnotation.this.getHintsElementName();
+ }
+
+ public String getNestedAnnotationName() {
+ return QueryHintAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableQueryHintAnnotation> getNestedAnnotations() {
+ return SourceQueryAnnotation.this.getNestableHints();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceQueryAnnotation.this.hintsSize();
+ }
+
+ public NestableQueryHintAnnotation addNestedAnnotation() {
+ return SourceQueryAnnotation.this.addHint_();
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ SourceQueryAnnotation.this.syncAddHint(astAnnotation);
+ }
+
+ public NestableQueryHintAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceQueryAnnotation.this.moveHint_(targetIndex, sourceIndex);
+ }
+
+ public NestableQueryHintAnnotation removeNestedAnnotation(int index) {
+ return SourceQueryAnnotation.this.removeHint_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceQueryAnnotation.this.syncRemoveHints(index);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java
new file mode 100644
index 0000000000..889dc7e230
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+
+/**
+ * <code>javax.persistence.QueryHint</code>
+ */
+public final class SourceQueryHintAnnotation
+ extends SourceAnnotation<Type>
+ implements NestableQueryHintAnnotation
+{
+ private DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ private AnnotationElementAdapter<String> nameAdapter;
+ private String name;
+
+ private DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
+ private AnnotationElementAdapter<String> valueAdapter;
+ private String value;
+
+
+ public SourceQueryHintAnnotation(JavaResourceNode parent, Type type, IndexedDeclarationAnnotationAdapter idaa) {
+ super(parent, type, idaa, new ElementIndexedAnnotationAdapter(type, idaa));
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.valueDeclarationAdapter = this.buildValueDeclarationAdapter();
+ this.valueAdapter = this.buildValueAdapter();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncValue(this.buildValue(astRoot));
+ }
+
+
+ // ********** QueryHintAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.QUERY_HINT__NAME);
+ }
+
+ private AnnotationElementAdapter<String> buildNameAdapter() {
+ return this.buildStringElementAdapter(this.nameDeclarationAdapter);
+ }
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ }
+ }
+
+ private void syncValue(String astValue) {
+ String old = this.value;
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.valueDeclarationAdapter, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildValueDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.QUERY_HINT__VALUE);
+ }
+
+ private AnnotationElementAdapter<String> buildValueAdapter() {
+ return this.buildStringElementAdapter(this.valueDeclarationAdapter);
+ }
+
+
+ // ********** NestableAnnotation implementation **********
+
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.name == null) &&
+ (this.value == null);
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
+ this.nameAdapter = this.buildNameAdapter();
+ this.valueDeclarationAdapter = this.buildValueDeclarationAdapter();
+ this.valueAdapter = this.buildValueAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+ map.put(NAME_PROPERTY, this.name);
+ this.name = null;
+ map.put(VALUE_PROPERTY, this.value);
+ this.value = null;
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+ this.setName((String) map.get(NAME_PROPERTY));
+ this.setValue((String) map.get(VALUE_PROPERTY));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** static methods **********
+
+ static SourceQueryHintAnnotation createNamedQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedQueryAdapter, int index) {
+ return new SourceQueryHintAnnotation(parent, type, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNamedQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedQueryAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(namedQueryAdapter, JPA.NAMED_QUERY__HINTS, index, ANNOTATION_NAME);
+ }
+
+ static SourceQueryHintAnnotation createNamedNativeQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
+ return new SourceQueryHintAnnotation(parent, type, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(namedNativeQueryAdapter, JPA.NAMED_NATIVE_QUERY__HINTS, index, ANNOTATION_NAME);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
new file mode 100644
index 0000000000..c782f30499
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
@@ -0,0 +1,357 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumArrayDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.CascadeType;
+import org.eclipse.jpt.jpa.core.resource.java.FetchType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.ManyToMany
+ * javax.persistence.ManyToOne
+ * javax.persistence.OneToMany
+ * javax.persistence.OneToOne
+ */
+abstract class SourceRelationshipMappingAnnotation
+ extends SourceAnnotation<Attribute>
+ implements RelationshipMapping2_0Annotation
+{
+ final DeclarationAnnotationElementAdapter<String> targetEntityDeclarationAdapter;
+ final AnnotationElementAdapter<String> targetEntityAdapter;
+ String targetEntity;
+
+ /**
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
+ */
+ private String fullyQualifiedTargetEntityClassName;
+ // we need a flag since the f-q name can be null
+ private boolean fqTargetEntityClassNameStale = true;
+
+ final DeclarationAnnotationElementAdapter<String> fetchDeclarationAdapter;
+ final AnnotationElementAdapter<String> fetchAdapter;
+ FetchType fetch;
+
+ final DeclarationAnnotationElementAdapter<String[]> cascadeDeclarationAdapter;
+ final AnnotationElementAdapter<String[]> cascadeAdapter;
+ CascadeType[] cascadeTypes = EMPTY_CASCADE_TYPE_ARRAY; // this should never be null
+ private static final CascadeType[] EMPTY_CASCADE_TYPE_ARRAY = new CascadeType[0];
+
+
+ SourceRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
+ super(parent, attribute, daa);
+ this.targetEntityDeclarationAdapter = this.getTargetEntityAdapter();
+ this.targetEntityAdapter = this.buildAnnotationElementAdapter(this.targetEntityDeclarationAdapter);
+ this.fetchDeclarationAdapter = this.getFetchAdapter();
+ this.fetchAdapter = this.buildAnnotationElementAdapter(this.fetchDeclarationAdapter);
+ this.cascadeDeclarationAdapter = this.getCascadeAdapter();
+ this.cascadeAdapter = new AnnotatedElementAnnotationElementAdapter<String[]>(attribute, this.cascadeDeclarationAdapter);
+ }
+
+ protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
+ }
+
+ protected AnnotationElementAdapter<Boolean> buildBooleanAnnotationElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.targetEntity = this.buildTargetEntity(astRoot);
+ this.fetch = this.buildFetch(astRoot);
+ this.cascadeTypes = this.buildCascadeTypes(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncFetch(this.buildFetch(astRoot));
+ this.syncTargetEntity(this.buildTargetEntity(astRoot));
+ this.syncCascadeTypes(this.buildCascadeTypes(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.targetEntity == null) &&
+ (this.fetch == null) &&
+ (this.cascadeTypes.length == 0);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.targetEntity);
+ }
+
+
+ // ********** RelationshipMappingAnnotation implementation **********
+
+ // ***** target entity
+ public String getTargetEntity() {
+ return this.targetEntity;
+ }
+
+ public void setTargetEntity(String targetEntity) {
+ if (this.attributeValueHasChanged(this.targetEntity, targetEntity)) {
+ this.targetEntity = targetEntity;
+ this.fqTargetEntityClassNameStale = true;
+ this.targetEntityAdapter.setValue(targetEntity);
+ }
+ }
+
+ private void syncTargetEntity(String astTargetEntity) {
+ if (this.attributeValueHasChanged(this.targetEntity, astTargetEntity)) {
+ this.syncTargetEntity_(astTargetEntity);
+ }
+ }
+
+ private void syncTargetEntity_(String astTargetEntity) {
+ String old = this.targetEntity;
+ this.targetEntity = astTargetEntity;
+ this.fqTargetEntityClassNameStale = true;
+ this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, astTargetEntity);
+ }
+
+ private String buildTargetEntity(CompilationUnit astRoot) {
+ return this.targetEntityAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTargetEntityTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.targetEntityDeclarationAdapter, astRoot);
+ }
+
+ /**
+ * return the Java adapter's 'targetEntity' element adapter config
+ */
+ abstract DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter();
+
+ // ***** fully-qualified target entity class name
+ public String getFullyQualifiedTargetEntityClassName() {
+ if (this.fqTargetEntityClassNameStale) {
+ this.fullyQualifiedTargetEntityClassName = this.buildFullyQualifiedTargetEntityClassName();
+ this.fqTargetEntityClassNameStale = false;
+ }
+ return this.fullyQualifiedTargetEntityClassName;
+ }
+
+ private String buildFullyQualifiedTargetEntityClassName() {
+ return (this.targetEntity == null) ? null : this.buildFullyQualifiedTargetEntityClassName_();
+ }
+
+ private String buildFullyQualifiedTargetEntityClassName_() {
+ return ASTTools.resolveFullyQualifiedName(this.targetEntityAdapter.getExpression(this.buildASTRoot()));
+ }
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ if (this.attributeValueHasChanged(this.fetch, fetch)) {
+ this.fetch = fetch;
+ this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
+ }
+ }
+
+ private void syncFetch(FetchType astFetch) {
+ FetchType old = this.fetch;
+ this.fetch = astFetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, astFetch);
+ }
+
+ private FetchType buildFetch(CompilationUnit astRoot) {
+ return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.fetchDeclarationAdapter, astRoot);
+ }
+
+ /**
+ * return the Java adapter's 'fetch' element adapter config
+ */
+ abstract DeclarationAnnotationElementAdapter<String> getFetchAdapter();
+
+ // ***** cascade types
+ /**
+ * pre-condition: state of 'cascadeTypes' is to change
+ */
+ private void setCascadeType(CascadeType cascadeType, boolean set) {
+ this.setCascadeTypes(set ?
+ ArrayTools.add(this.cascadeTypes, cascadeType) :
+ ArrayTools.remove(this.cascadeTypes, cascadeType)
+ );
+ }
+
+ /**
+ * pre-condition: state of 'cascadeTypes' is to change
+ */
+ private void setCascadeTypes(CascadeType[] cascadeTypes) {
+ this.cascadeTypes = cascadeTypes;
+ this.cascadeAdapter.setValue(CascadeType.toJavaAnnotationValues(cascadeTypes));
+ }
+
+ private void syncCascadeTypes(CascadeType[] astCascadeTypes) {
+ CascadeType[] old = this.cascadeTypes;
+ this.cascadeTypes = astCascadeTypes;
+ this.syncCascadeAll(old);
+ this.syncCascadeMerge(old);
+ this.syncCascadePersist(old);
+ this.syncCascadeRefresh(old);
+ this.syncCascadeRemove(old);
+ this.syncCascadeDetach(old);
+ }
+
+ private CascadeType[] buildCascadeTypes(CompilationUnit astRoot) {
+ return CascadeType.fromJavaAnnotationValues(this.cascadeAdapter.getValue(astRoot));
+ }
+
+ private boolean cascadeTypeIsTrue(CascadeType cascadeType) {
+ return ArrayTools.contains(this.cascadeTypes, cascadeType);
+ }
+
+ public TextRange getCascadeTextRange(CompilationUnit astRoot) {
+ return getElementTextRange(this.cascadeDeclarationAdapter, astRoot);
+ }
+
+ /**
+ * return the Java adapter's 'cascade' element adapter config
+ */
+ abstract DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter();
+
+ // ***** cascade all
+ public boolean isCascadeAll() {
+ return this.cascadeTypeIsTrue(CascadeType.ALL);
+ }
+
+ public void setCascadeAll(boolean cascadeAll) {
+ if (this.isCascadeAll() != cascadeAll) {
+ this.setCascadeType(CascadeType.ALL, cascadeAll);
+ }
+ }
+
+ private void syncCascadeAll(CascadeType[] oldCascadeTypes) {
+ boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.ALL);
+ this.firePropertyChanged(CASCADE_ALL_PROPERTY, old, this.isCascadeAll());
+ }
+
+ // ***** cascade persist
+ public boolean isCascadePersist() {
+ return this.cascadeTypeIsTrue(CascadeType.PERSIST);
+ }
+
+ public void setCascadePersist(boolean cascadePersist) {
+ if (this.isCascadePersist() != cascadePersist) {
+ this.setCascadeType(CascadeType.PERSIST, cascadePersist);
+ }
+ }
+
+ private void syncCascadePersist(CascadeType[] oldCascadeTypes) {
+ boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.PERSIST);
+ this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, this.isCascadePersist());
+ }
+
+ // ***** cascade merge
+ public boolean isCascadeMerge() {
+ return this.cascadeTypeIsTrue(CascadeType.MERGE);
+ }
+
+ public void setCascadeMerge(boolean cascadeMerge) {
+ if (this.isCascadeMerge() != cascadeMerge) {
+ this.setCascadeType(CascadeType.MERGE, cascadeMerge);
+ }
+ }
+
+ private void syncCascadeMerge(CascadeType[] oldCascadeTypes) {
+ boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.MERGE);
+ this.firePropertyChanged(CASCADE_MERGE_PROPERTY, old, this.isCascadeMerge());
+ }
+
+ // ***** cascade remove
+ public boolean isCascadeRemove() {
+ return this.cascadeTypeIsTrue(CascadeType.REMOVE);
+ }
+
+ public void setCascadeRemove(boolean cascadeRemove) {
+ if (this.isCascadeRemove() != cascadeRemove) {
+ this.setCascadeType(CascadeType.REMOVE, cascadeRemove);
+ }
+ }
+
+ private void syncCascadeRemove(CascadeType[] oldCascadeTypes) {
+ boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.REMOVE);
+ this.firePropertyChanged(CASCADE_REMOVE_PROPERTY, old, this.isCascadeRemove());
+ }
+
+ // ***** cascade refresh
+ public boolean isCascadeRefresh() {
+ return this.cascadeTypeIsTrue(CascadeType.REFRESH);
+ }
+
+ public void setCascadeRefresh(boolean cascadeRefresh) {
+ if (this.isCascadeRefresh() != cascadeRefresh) {
+ this.setCascadeType(CascadeType.REFRESH, cascadeRefresh);
+ }
+ }
+
+ private void syncCascadeRefresh(CascadeType[] oldCascadeTypes) {
+ boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.REFRESH);
+ this.firePropertyChanged(CASCADE_REFRESH_PROPERTY, old, this.isCascadeRefresh());
+ }
+
+ // ***** cascade detach - JPA 2.0
+ public boolean isCascadeDetach() {
+ return this.cascadeTypeIsTrue(CascadeType.DETACH);
+ }
+
+ public void setCascadeDetach(boolean cascadeDetach) {
+ if (this.isCascadeDetach() != cascadeDetach) {
+ this.setCascadeType(CascadeType.DETACH, cascadeDetach);
+ }
+ }
+
+ private void syncCascadeDetach(CascadeType[] oldCascadeTypes) {
+ boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.DETACH);
+ this.firePropertyChanged(CASCADE_DETACH_PROPERTY, old, this.isCascadeDetach());
+ }
+
+ // ********** static methods **********
+
+ static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ // TODO what about QualifiedType?
+ return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter);
+ }
+
+ static DeclarationAnnotationElementAdapter<String> buildFetchAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new EnumDeclarationAnnotationElementAdapter(annotationAdapter, elementName);
+ }
+
+ static DeclarationAnnotationElementAdapter<String[]> buildEnumArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new EnumArrayDeclarationAnnotationElementAdapter(annotationAdapter, elementName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
new file mode 100644
index 0000000000..c0652153ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+
+/**
+ * <code>javax.persistence.SecondaryTable</code>
+ */
+public final class SourceSecondaryTableAnnotation
+ extends SourceBaseTableAnnotation
+ implements NestableSecondaryTableAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(SecondaryTableAnnotation.ANNOTATION_NAME);
+
+ private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns = new Vector<NestablePrimaryKeyJoinColumnAnnotation>();
+ private final PkJoinColumnsAnnotationContainer pkJoinColumnsContainer = new PkJoinColumnsAnnotationContainer();
+
+
+ public SourceSecondaryTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ AnnotationContainerTools.initialize(this.pkJoinColumnsContainer, astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ AnnotationContainerTools.synchronize(this.pkJoinColumnsContainer, astRoot);
+ }
+
+
+ // ********** SourceBaseTableAnnotation implementation **********
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.SECONDARY_TABLE__NAME);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildSchemaDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.SECONDARY_TABLE__SCHEMA);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildCatalogDeclarationAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, JPA.SECONDARY_TABLE__CATALOG);
+ }
+
+ @Override
+ protected String getUniqueConstraintsElementName() {
+ return JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+
+ // ************* SecondaryTableAnnotation implementation *******************
+
+ // ***** pk join columns
+ public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() {
+ return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
+ }
+
+ Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestablePkJoinColumns() {
+ return new LiveCloneIterable<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
+ }
+
+ public int pkJoinColumnsSize() {
+ return this.pkJoinColumns.size();
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
+ return this.pkJoinColumns.get(index);
+ }
+
+ public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation joinColumn) {
+ return this.pkJoinColumns.indexOf(joinColumn);
+ }
+
+ private NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn() {
+ return this.addPkJoinColumn(this.pkJoinColumns.size());
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
+ return (NestablePrimaryKeyJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.pkJoinColumnsContainer);
+ }
+
+ NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn_() {
+ return this.addPkJoinColumn_(this.pkJoinColumns.size());
+ }
+
+ private NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn_(int index) {
+ NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.buildPrimaryKeyJoinColumn(index);
+ this.pkJoinColumns.add(index, pkJoinColumn);
+ return pkJoinColumn;
+ }
+
+ void syncAddPkJoinColumn(Annotation astAnnotation) {
+ int index = this.pkJoinColumns.size();
+ NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.addPkJoinColumn_(index);
+ pkJoinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, pkJoinColumn);
+ }
+
+ private NestablePrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumn(int index) {
+ return SourcePrimaryKeyJoinColumnAnnotation.createSecondaryTablePrimaryKeyJoinColumn(this.daa, this, this.annotatedElement, index);
+ }
+
+ void pkJoinColumnAdded(int index, NestablePrimaryKeyJoinColumnAnnotation joinColumn) {
+ this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, joinColumn);
+ }
+
+ public void movePkJoinColumn(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.pkJoinColumnsContainer);
+ }
+
+ NestablePrimaryKeyJoinColumnAnnotation movePkJoinColumn_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public void removePkJoinColumn(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.pkJoinColumnsContainer);
+ }
+
+ NestablePrimaryKeyJoinColumnAnnotation removePkJoinColumn_(int index) {
+ return this.pkJoinColumns.remove(index);
+ }
+
+ void syncRemovePkJoinColumns(int index) {
+ this.removeItemsFromList(index, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
+ }
+
+
+ // ********** NestableAnnotation implementation **********
+
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.pkJoinColumns.isEmpty();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+
+ List<Map<String, Object>> pkJoinColumnsState = this.buildStateList(this.pkJoinColumns.size());
+ for (NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn : this.getNestablePkJoinColumns()) {
+ Map<String, Object> pkJoinColumnState = new HashMap<String, Object>();
+ pkJoinColumn.storeOn(pkJoinColumnState);
+ pkJoinColumnsState.add(pkJoinColumnState);
+ }
+ map.put(PK_JOIN_COLUMNS_LIST, pkJoinColumnsState);
+ this.pkJoinColumns.clear();
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, Object>> pkJoinColumnsState = (List<Map<String, Object>>) map.get(PK_JOIN_COLUMNS_LIST);
+ for (Map<String, Object> pkJoinColumnState : pkJoinColumnsState) {
+ this.addPkJoinColumn().restoreFrom(pkJoinColumnState);
+ }
+ }
+
+
+ // ********** static methods **********
+
+ public static SourceSecondaryTableAnnotation createSecondaryTable(JavaResourceNode parent, Member member) {
+ return new SourceSecondaryTableAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static SourceSecondaryTableAnnotation createNestedSecondaryTable(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter secondaryTablesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, secondaryTablesAdapter, ANNOTATION_NAME);
+ IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
+ return new SourceSecondaryTableAnnotation(parent, member, idaa, annotationAdapter);
+ }
+
+
+ // ********** pk join column container **********
+
+ /**
+ * adapt the AnnotationContainer interface to the secondary table's
+ * primary key join columns
+ */
+ class PkJoinColumnsAnnotationContainer
+ implements AnnotationContainer<NestablePrimaryKeyJoinColumnAnnotation>
+ {
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return SourceSecondaryTableAnnotation.this.getAstAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS;
+ }
+
+ public String getNestedAnnotationName() {
+ return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestedAnnotations() {
+ return SourceSecondaryTableAnnotation.this.getNestablePkJoinColumns();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceSecondaryTableAnnotation.this.pkJoinColumnsSize();
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotation() {
+ return SourceSecondaryTableAnnotation.this.addPkJoinColumn_();
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ SourceSecondaryTableAnnotation.this.syncAddPkJoinColumn(astAnnotation);
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceSecondaryTableAnnotation.this.movePkJoinColumn_(targetIndex, sourceIndex);
+ }
+
+ public NestablePrimaryKeyJoinColumnAnnotation removeNestedAnnotation(int index) {
+ return SourceSecondaryTableAnnotation.this.removePkJoinColumn_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceSecondaryTableAnnotation.this.syncRemovePkJoinColumns(index);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
new file mode 100644
index 0000000000..151f2df51f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
+
+/**
+ * <code>javax.persistence.SecondaryTables</code>
+ */
+public final class SourceSecondaryTablesAnnotation
+ extends SourceAnnotation<Member>
+ implements SecondaryTablesAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<NestableSecondaryTableAnnotation> secondaryTables = new Vector<NestableSecondaryTableAnnotation>();
+
+
+ public SourceSecondaryTablesAnnotation(JavaResourcePersistentType parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.secondaryTables.isEmpty();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.secondaryTables);
+ }
+
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getElementName() {
+ return JPA.SECONDARY_TABLES__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return SecondaryTableAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableSecondaryTableAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<NestableSecondaryTableAnnotation>(this.secondaryTables);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.secondaryTables.size();
+ }
+
+ public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
+ this.nestStandAloneAnnotation(standAloneAnnotation, this.secondaryTables.size());
+ }
+
+ private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
+ standAloneAnnotation.convertToNested(this, this.daa, index);
+ }
+
+ public void addNestedAnnotation(int index, NestableAnnotation annotation) {
+ this.secondaryTables.add(index, (NestableSecondaryTableAnnotation) annotation);
+ }
+
+ public void convertLastNestedAnnotationToStandAlone() {
+ this.secondaryTables.remove(0).convertToStandAlone();
+ }
+
+ public NestableSecondaryTableAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.secondaryTables.size());
+ }
+
+ private NestableSecondaryTableAnnotation addNestedAnnotation(int index) {
+ NestableSecondaryTableAnnotation secondaryTable = this.buildSecondaryTable(index);
+ this.secondaryTables.add(index, secondaryTable);
+ return secondaryTable;
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ int index = this.secondaryTables.size();
+ NestableSecondaryTableAnnotation secondaryTable = this.addNestedAnnotation(index);
+ secondaryTable.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(SECONDARY_TABLES_LIST, index, secondaryTable);
+ }
+
+ private NestableSecondaryTableAnnotation buildSecondaryTable(int index) {
+ // pass the Java resource persistent member as the nested annotation's parent
+ // since the nested annotation can be converted to stand-alone
+ return SourceSecondaryTableAnnotation.createNestedSecondaryTable(this.parent, this.annotatedElement, index, this.daa);
+ }
+
+ public NestableSecondaryTableAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.secondaryTables, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public NestableSecondaryTableAnnotation removeNestedAnnotation(int index) {
+ return this.secondaryTables.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.secondaryTables, SECONDARY_TABLES_LIST);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
new file mode 100644
index 0000000000..12d42800fb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+
+/**
+ * javax.persistence.SequenceGenerator
+ */
+public abstract class SourceSequenceGeneratorAnnotation
+ extends SourceGeneratorAnnotation
+ implements SequenceGeneratorAnnotation
+{
+ 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 final AnnotationElementAdapter<String> sequenceNameAdapter;
+ private String sequenceName;
+
+
+ protected SourceSequenceGeneratorAnnotation(JavaResourceNode parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.sequenceNameAdapter = this.buildAdapter(SEQUENCE_NAME_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.sequenceName = this.buildSequenceName(astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncSequenceName(this.buildSequenceName(astRoot));
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.sequenceName == null);
+ }
+
+
+ // ********** AbstractGeneratorAnnotation implementation **********
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getNameAdapter() {
+ return NAME_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<Integer> getInitialValueAdapter() {
+ return INITIAL_VALUE_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter() {
+ return ALLOCATION_SIZE_ADAPTER;
+ }
+
+
+ // ********** SequenceGeneratorAnnotation implementation **********
+
+ // ***** sequence name
+ public String getSequenceName() {
+ return this.sequenceName;
+ }
+
+ public void setSequenceName(String sequenceName) {
+ if (this.attributeValueHasChanged(this.sequenceName, sequenceName)) {
+ this.sequenceName = sequenceName;
+ this.sequenceNameAdapter.setValue(sequenceName);
+ }
+ }
+
+ public void syncSequenceName(String astSequenceName) {
+ String old = this.sequenceName;
+ this.sequenceName = astSequenceName;
+ this.firePropertyChanged(SEQUENCE_NAME_PROPERTY, old, astSequenceName);
+ }
+
+ private String buildSequenceName(CompilationUnit astRoot) {
+ return this.sequenceNameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getSequenceNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(SEQUENCE_NAME_ADAPTER, astRoot);
+ }
+
+ public boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(SEQUENCE_NAME_ADAPTER, pos, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
+ return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+ protected static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
+ return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java
new file mode 100644
index 0000000000..6edc847a72
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
+
+/**
+ * <code>javax.persistence.Table</code>
+ */
+public final class SourceTableAnnotation
+ extends SourceBaseTableAnnotation
+ implements TableAnnotation
+{
+ 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);
+
+
+ public SourceTableAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** SourceBaseTableAnnotation implementation **********
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
+ return NAME_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildSchemaDeclarationAdapter() {
+ return SCHEMA_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> buildCatalogDeclarationAdapter() {
+ return CATALOG_ADAPTER;
+ }
+
+ @Override
+ protected String getUniqueConstraintsElementName() {
+ return JPA.TABLE__UNIQUE_CONSTRAINTS;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
new file mode 100644
index 0000000000..9b5d0ade9b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
@@ -0,0 +1,470 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableUniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+
+/**
+ * javax.persistence.TableGenerator
+ */
+public final class SourceTableGeneratorAnnotation
+ extends SourceGeneratorAnnotation
+ implements TableGeneratorAnnotation
+{
+ 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 final AnnotationElementAdapter<String> tableAdapter;
+ private String table;
+
+ private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__SCHEMA);
+ private final AnnotationElementAdapter<String> schemaAdapter;
+ private String schema;
+
+ private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__CATALOG);
+ private final AnnotationElementAdapter<String> catalogAdapter;
+ private String catalog;
+
+ private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
+ private final AnnotationElementAdapter<String> pkColumnNameAdapter;
+ private String pkColumnName;
+
+ private static final DeclarationAnnotationElementAdapter<String> VALUE_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
+ private final AnnotationElementAdapter<String> valueColumnNameAdapter;
+ private String valueColumnName;
+
+ private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_VALUE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
+ private final AnnotationElementAdapter<String> pkColumnValueAdapter;
+ private String pkColumnValue;
+
+ private final Vector<NestableUniqueConstraintAnnotation> uniqueConstraints = new Vector<NestableUniqueConstraintAnnotation>();
+ private final UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
+
+
+ public SourceTableGeneratorAnnotation(JavaResourceNode 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);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.table = this.buildTable(astRoot);
+ this.schema = this.buildSchema(astRoot);
+ this.catalog = this.buildCatalog(astRoot);
+ this.pkColumnName = this.buildPkColumnName(astRoot);
+ this.valueColumnName = this.buildValueColumnName(astRoot);
+ this.pkColumnValue = this.buildPkColumnValue(astRoot);
+ AnnotationContainerTools.initialize(this.uniqueConstraintsContainer, astRoot);
+ }
+
+ @Override
+ public void synchronizeWith(CompilationUnit astRoot) {
+ super.synchronizeWith(astRoot);
+ this.syncTable(this.buildTable(astRoot));
+ this.syncSchema(this.buildSchema(astRoot));
+ this.syncCatalog(this.buildCatalog(astRoot));
+ this.syncPkColumnName(this.buildPkColumnName(astRoot));
+ this.syncValueColumnName(this.buildValueColumnName(astRoot));
+ this.syncPkColumnValue(this.buildPkColumnValue(astRoot));
+ AnnotationContainerTools.synchronize(this.uniqueConstraintsContainer, astRoot);
+ }
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ (this.table == null) &&
+ (this.schema == null) &&
+ (this.catalog == null) &&
+ (this.pkColumnName == null) &&
+ (this.valueColumnName == null) &&
+ (this.pkColumnValue == null);
+ }
+
+
+ // ********** AbstractGeneratorAnnotation implementation **********
+
+ @Override
+ DeclarationAnnotationElementAdapter<String> getNameAdapter() {
+ return NAME_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<Integer> getInitialValueAdapter() {
+ return INITIAL_VALUE_ADAPTER;
+ }
+
+ @Override
+ DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter() {
+ return ALLOCATION_SIZE_ADAPTER;
+ }
+
+
+ // ********** TableGeneratorAnnotation implementation **********
+
+ // ***** table
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String table) {
+ if (this.attributeValueHasChanged(this.table, table)) {
+ this.table = table;
+ this.tableAdapter.setValue(table);
+ }
+ }
+
+ private void syncTable(String astTable) {
+ String old = this.table;
+ this.table = astTable;
+ this.firePropertyChanged(TABLE_PROPERTY, old, astTable);
+ }
+
+ private String buildTable(CompilationUnit astRoot) {
+ return this.tableAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTableTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(TABLE_ADAPTER, astRoot);
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(TABLE_ADAPTER, pos, astRoot);
+ }
+
+ // ***** schema
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String schema) {
+ if (this.attributeValueHasChanged(this.schema, schema)) {
+ this.schema = schema;
+ this.schemaAdapter.setValue(schema);
+ }
+ }
+
+ private void syncSchema(String astSchema) {
+ String old = this.schema;
+ this.schema = astSchema;
+ this.firePropertyChanged(SCHEMA_PROPERTY, old, astSchema);
+ }
+
+ private String buildSchema(CompilationUnit astRoot) {
+ return this.schemaAdapter.getValue(astRoot);
+ }
+
+ public TextRange getSchemaTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(SCHEMA_ADAPTER, astRoot);
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(SCHEMA_ADAPTER, pos, astRoot);
+ }
+
+ // ***** catalog
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String catalog) {
+ if (this.attributeValueHasChanged(this.catalog, catalog)) {
+ this.catalog = catalog;
+ this.catalogAdapter.setValue(catalog);
+ }
+ }
+
+ private void syncCatalog(String astCatalog) {
+ String old = this.catalog;
+ this.catalog = astCatalog;
+ this.firePropertyChanged(CATALOG_PROPERTY, old, astCatalog);
+ }
+
+ private String buildCatalog(CompilationUnit astRoot) {
+ return this.catalogAdapter.getValue(astRoot);
+ }
+
+ public TextRange getCatalogTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(CATALOG_ADAPTER, astRoot);
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(CATALOG_ADAPTER, pos, astRoot);
+ }
+
+ // ***** pk column name
+ public String getPkColumnName() {
+ return this.pkColumnName;
+ }
+
+ public void setPkColumnName(String pkColumnName) {
+ if (this.attributeValueHasChanged(this.pkColumnName, pkColumnName)) {
+ this.pkColumnName = pkColumnName;
+ this.pkColumnNameAdapter.setValue(pkColumnName);
+ }
+ }
+
+ private void syncPkColumnName(String astPkColumnName) {
+ String old = this.pkColumnName;
+ this.pkColumnName = astPkColumnName;
+ this.firePropertyChanged(PK_COLUMN_NAME_PROPERTY, old, astPkColumnName);
+ }
+
+ private String buildPkColumnName(CompilationUnit astRoot) {
+ return this.pkColumnNameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getPkColumnNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(PK_COLUMN_NAME_ADAPTER, astRoot);
+ }
+
+ public boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(PK_COLUMN_NAME_ADAPTER, pos, astRoot);
+ }
+
+ // ***** value column name
+ public String getValueColumnName() {
+ return this.valueColumnName;
+ }
+
+ public void setValueColumnName(String valueColumnName) {
+ if (this.attributeValueHasChanged(this.valueColumnName, valueColumnName)) {
+ this.valueColumnName = valueColumnName;
+ this.valueColumnNameAdapter.setValue(valueColumnName);
+ }
+ }
+
+ private void syncValueColumnName(String astValueColumnName) {
+ String old = this.valueColumnName;
+ this.valueColumnName = astValueColumnName;
+ this.firePropertyChanged(VALUE_COLUMN_NAME_PROPERTY, old, astValueColumnName);
+ }
+
+ private String buildValueColumnName(CompilationUnit astRoot) {
+ return this.valueColumnNameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueColumnNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_COLUMN_NAME_ADAPTER, astRoot);
+ }
+
+ public boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(VALUE_COLUMN_NAME_ADAPTER, pos, astRoot);
+ }
+
+ // ***** pk column value
+ public String getPkColumnValue() {
+ return this.pkColumnValue;
+ }
+
+ public void setPkColumnValue(String pkColumnValue) {
+ if (this.attributeValueHasChanged(this.pkColumnValue, pkColumnValue)) {
+ this.pkColumnValue = pkColumnValue;
+ this.pkColumnValueAdapter.setValue(pkColumnValue);
+ }
+ }
+
+ private void syncPkColumnValue(String astPkColumnValue) {
+ String old = this.pkColumnValue;
+ this.pkColumnValue = astPkColumnValue;
+ this.firePropertyChanged(PK_COLUMN_VALUE_PROPERTY, old, astPkColumnValue);
+ }
+
+ private String buildPkColumnValue(CompilationUnit astRoot) {
+ return this.pkColumnValueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getPkColumnValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(PK_COLUMN_VALUE_ADAPTER, astRoot);
+ }
+
+ public boolean pkColumnValueTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(PK_COLUMN_VALUE_ADAPTER, pos, astRoot);
+ }
+
+ // ***** unique constraints
+ public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
+ return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
+ }
+
+ Iterable<NestableUniqueConstraintAnnotation> getNestableUniqueConstraints() {
+ return new LiveCloneIterable<NestableUniqueConstraintAnnotation>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public NestableUniqueConstraintAnnotation uniqueConstraintAt(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
+ return this.uniqueConstraints.indexOf(uniqueConstraint);
+ }
+
+ public NestableUniqueConstraintAnnotation addUniqueConstraint(int index) {
+ return (NestableUniqueConstraintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.uniqueConstraintsContainer);
+ }
+
+ NestableUniqueConstraintAnnotation addUniqueConstraint_() {
+ return this.addUniqueConstraint_(this.uniqueConstraints.size());
+ }
+
+ private NestableUniqueConstraintAnnotation addUniqueConstraint_(int index) {
+ NestableUniqueConstraintAnnotation uniqueConstraint = this.buildUniqueConstraint(index);
+ this.uniqueConstraints.add(index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ void syncAddUniqueConstraint(Annotation astAnnotation) {
+ int index = this.uniqueConstraints.size();
+ NestableUniqueConstraintAnnotation uniqueConstraint = this.addUniqueConstraint_(index);
+ uniqueConstraint.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
+ }
+
+ NestableUniqueConstraintAnnotation buildUniqueConstraint(int index) {
+ return new SourceUniqueConstraintAnnotation(this, this.annotatedElement, buildUniqueConstraintAnnotationAdapter(index));
+ }
+
+ IndexedDeclarationAnnotationAdapter buildUniqueConstraintAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
+ }
+
+ void uniqueConstraintAdded(int index, NestableUniqueConstraintAnnotation constraint) {
+ this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, constraint);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.uniqueConstraintsContainer);
+ }
+
+ NestableUniqueConstraintAnnotation moveUniqueConstraint_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public void removeUniqueConstraint(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.uniqueConstraintsContainer);
+ }
+
+ NestableUniqueConstraintAnnotation removeUniqueConstraint_(int index) {
+ return this.uniqueConstraints.remove(index);
+ }
+
+ void syncRemoveUniqueConstraints(int index) {
+ this.removeItemsFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+
+ // ********** 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);
+ }
+
+
+ // ********** unique constraint container **********
+
+ /**
+ * adapt the AnnotationContainer interface to the table generator's unique constraints
+ */
+ class UniqueConstraintsAnnotationContainer
+ implements AnnotationContainer<NestableUniqueConstraintAnnotation>
+ {
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return SourceTableGeneratorAnnotation.this.getAstAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS;
+ }
+
+ public String getNestedAnnotationName() {
+ return UniqueConstraintAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableUniqueConstraintAnnotation> getNestedAnnotations() {
+ return SourceTableGeneratorAnnotation.this.getNestableUniqueConstraints();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return SourceTableGeneratorAnnotation.this.uniqueConstraintsSize();
+ }
+
+ public NestableUniqueConstraintAnnotation addNestedAnnotation() {
+ return SourceTableGeneratorAnnotation.this.addUniqueConstraint_();
+ }
+
+ public void syncAddNestedAnnotation(Annotation astAnnotation) {
+ SourceTableGeneratorAnnotation.this.syncAddUniqueConstraint(astAnnotation);
+ }
+
+ public NestableUniqueConstraintAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return SourceTableGeneratorAnnotation.this.moveUniqueConstraint_(targetIndex, sourceIndex);
+ }
+
+ public NestableUniqueConstraintAnnotation removeNestedAnnotation(int index) {
+ return SourceTableGeneratorAnnotation.this.removeUniqueConstraint_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ SourceTableGeneratorAnnotation.this.syncRemoveUniqueConstraints(index);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java
new file mode 100644
index 0000000000..61d6c20b08
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * javax.persistence.Temporal
+ */
+public final class SourceTemporalAnnotation
+ extends SourceBaseTemporalAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceTemporalAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String getValueElementName() {
+ return JPA.TEMPORAL__VALUE;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java
new file mode 100644
index 0000000000..eace57de22
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
+
+/**
+ * javax.persistence.Transient
+ */
+public final class SourceTransientAnnotation
+ extends SourceAnnotation<Attribute>
+ implements TransientAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceTransientAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java
new file mode 100644
index 0000000000..7a4ab83de4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
+import org.eclipse.jpt.common.utility.CommandExecutor;
+import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java compilation unit (source file)
+ * non package-info.java file
+ */
+public final class SourceTypeCompilationUnit
+ extends SourceCompilationUnit
+{
+
+ /**
+ * The primary type of the AST compilation unit. We are not going to handle
+ * multiple types defined in a single compilation unit. Entities must have
+ * a public/protected no-arg constructor, and there is no way to access
+ * the constructor in a package class (which is what all top-level,
+ * non-primary classes must be).
+ */
+ private JavaResourcePersistentType persistentType;
+
+
+ // ********** construction **********
+
+ public SourceTypeCompilationUnit(
+ ICompilationUnit compilationUnit,
+ JpaAnnotationProvider annotationProvider,
+ AnnotationEditFormatter annotationEditFormatter,
+ CommandExecutor modifySharedDocumentCommandExecutor) {
+ super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the JPA compilation unit is the root of its sub-tree
+ this.persistentType = this.buildPersistentType();
+ }
+
+ private JavaResourcePersistentType buildPersistentType() {
+ this.openCompilationUnit();
+ CompilationUnit astRoot = this.buildASTRoot();
+ this.closeCompilationUnit();
+ return this.buildPersistentType(astRoot);
+ }
+
+
+ // ********** JavaResourceNode implementation **********
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncPersistentType(astRoot);
+ }
+
+
+ // ********** JavaResourceNode.Root implementation **********
+
+ /**
+ * NB: return *all* the persistent types since we build them all
+ */
+ public Iterator<JavaResourcePersistentType> persistentTypes() {
+ return (this.persistentType == null) ?
+ EmptyIterator.<JavaResourcePersistentType>instance() :
+ this.persistentType.allTypes();
+ }
+
+
+ // ********** JptResourceModel implementation **********
+
+ public JptResourceType getResourceType() {
+ return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ }
+
+
+ // ********** JavaResourceCompilationUnit implementation **********
+
+ public void resolveTypes() {
+ if (this.persistentType != null) {
+ this.persistentType.resolveTypes(this.buildASTRoot());
+ }
+ }
+
+
+ // ********** persistent type **********
+
+ private JavaResourcePersistentType buildPersistentType(CompilationUnit astRoot) {
+ TypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot);
+ return (td == null) ? null : this.buildPersistentType(astRoot, td);
+ }
+
+
+ private void syncPersistentType(CompilationUnit astRoot) {
+ TypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot);
+ if (td == null) {
+ this.syncPersistentType_(null);
+ } else {
+ if (this.persistentType == null) {
+ this.syncPersistentType_(this.buildPersistentType(astRoot, td));
+ } else {
+ this.persistentType.synchronizeWith(astRoot);
+ }
+ }
+ }
+
+ private void syncPersistentType_(JavaResourcePersistentType astPersistentType) {
+ JavaResourcePersistentType old = this.persistentType;
+ this.persistentType = astPersistentType;
+ this.firePropertyChanged(PERSISTENT_TYPES_COLLECTION, old, astPersistentType);
+ }
+
+
+ // ********** internal **********
+
+ private JavaResourcePersistentType buildPersistentType(CompilationUnit astRoot, TypeDeclaration typeDeclaration) {
+ return SourcePersistentType.newInstance(this, typeDeclaration, astRoot);
+ }
+
+ /**
+ * i.e. the type with the same name as the compilation unit;
+ * return the first class or interface (ignore annotations and enums) with
+ * the same name as the compilation unit (file);
+ * NB: this type could be in error if there is an annotation or enum
+ * with the same name preceding it in the compilation unit
+ *
+ * Return null if the parser did not resolve the type declaration's binding.
+ * This can occur if the project JRE is removed (bug 225332).
+ */
+ private TypeDeclaration getPrimaryTypeDeclaration(CompilationUnit astRoot) {
+ String primaryTypeName = this.getPrimaryTypeName();
+ for (AbstractTypeDeclaration atd : this.types(astRoot)) {
+ if (this.nodeIsPrimaryTypeDeclaration(atd, primaryTypeName)) {
+ return (atd.resolveBinding() == null) ? null : (TypeDeclaration) atd;
+ }
+ }
+ return null;
+ }
+
+ private boolean nodeIsPrimaryTypeDeclaration(AbstractTypeDeclaration atd, String primaryTypeName) {
+ return (atd.getNodeType() == ASTNode.TYPE_DECLARATION) &&
+ atd.getName().getFullyQualifiedName().equals(primaryTypeName);
+ }
+
+ private String getPrimaryTypeName() {
+ return this.getCompilationUnitName();
+ }
+
+ // minimize scope of suppressed warnings
+ @SuppressWarnings("unchecked")
+ private List<AbstractTypeDeclaration> types(CompilationUnit astRoot) {
+ return astRoot.types();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
new file mode 100644
index 0000000000..ba3ff98598
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableUniqueConstraintAnnotation;
+
+/**
+ * <code>javax.persistence.UniqueConstraint</code>
+ */
+public final class SourceUniqueConstraintAnnotation
+ extends SourceAnnotation<Member>
+ implements NestableUniqueConstraintAnnotation
+{
+ private DeclarationAnnotationElementAdapter<String[]> columnNamesDeclarationAdapter;
+ private AnnotationElementAdapter<String[]> columnNamesAdapter;
+ private final Vector<String> columnNames = new Vector<String>();
+
+
+ public SourceUniqueConstraintAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ super(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ this.columnNamesDeclarationAdapter = buildColumnNamesDeclarationAdapter();
+ this.columnNamesAdapter = buildColumnNamesAdapter();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.initializeColumnNames(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncColumnNames(astRoot);
+ }
+
+
+ // ********** UniqueConstraintAnnotation implementation **********
+
+ // ***** column names
+ public ListIterator<String> columnNames() {
+ return new CloneListIterator<String>(this.columnNames);
+ }
+
+ private Iterable<String> getColumnNames() {
+ return new LiveCloneIterable<String>(this.columnNames);
+ }
+
+ public int columnNamesSize() {
+ return this.columnNames.size();
+ }
+
+ public void addColumnName(String columnName) {
+ this.addColumnName(this.columnNames.size(), columnName);
+ }
+
+ public void addColumnName(int index, String columnName) {
+ this.columnNames.add(index, columnName);
+ this.writeColumnNames();
+ }
+
+ public void moveColumnName(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.columnNames, targetIndex, sourceIndex);
+ this.writeColumnNames();
+ }
+
+ public void removeColumnName(String columnName) {
+ this.columnNames.remove(columnName);
+ this.writeColumnNames();
+ }
+
+ public void removeColumnName(int index) {
+ this.columnNames.remove(index);
+ this.writeColumnNames();
+ }
+
+ private void writeColumnNames() {
+ this.columnNamesAdapter.setValue(this.columnNames.toArray(new String[this.columnNames.size()]));
+ }
+
+ private void initializeColumnNames(CompilationUnit astRoot) {
+ String[] astColumnNames = this.columnNamesAdapter.getValue(astRoot);
+ for (int i = 0; i < astColumnNames.length; i++) {
+ this.columnNames.add(astColumnNames[i]);
+ }
+ }
+
+ private void syncColumnNames(CompilationUnit astRoot) {
+ String[] javaColumnNames = this.columnNamesAdapter.getValue(astRoot);
+ this.synchronizeList(Arrays.asList(javaColumnNames), this.columnNames, COLUMN_NAMES_LIST);
+ }
+
+ public boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.columnNamesDeclarationAdapter, pos, astRoot);
+ }
+
+ private DeclarationAnnotationElementAdapter<String[]> buildColumnNamesDeclarationAdapter() {
+ return buildArrayAnnotationElementAdapter(this.daa, JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
+ }
+
+ private AnnotationElementAdapter<String[]> buildColumnNamesAdapter() {
+ return this.buildAnnotationElementAdapter(this.columnNamesDeclarationAdapter);
+ }
+
+ private AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
+ return new AnnotatedElementAnnotationElementAdapter<String[]>(this.annotatedElement, daea);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, converter);
+ }
+
+
+ // ********** NestableAnnotation implementation **********
+
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+
+ // ********** misc **********
+
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.columnNames.isEmpty();
+ }
+
+ @Override
+ protected void rebuildAdapters() {
+ super.rebuildAdapters();
+ this.columnNamesDeclarationAdapter = buildColumnNamesDeclarationAdapter();
+ this.columnNamesAdapter = buildColumnNamesAdapter();
+ }
+
+ @Override
+ public void storeOn(Map<String, Object> map) {
+ super.storeOn(map);
+
+ List<String> columnNamesState = new ArrayList<String>(this.columnNames.size());
+ for (String columnName : this.getColumnNames()) {
+ columnNamesState.add(columnName);
+ }
+ map.put(COLUMN_NAMES_LIST, columnNamesState);
+ this.columnNames.clear();
+ }
+
+ @Override
+ public void restoreFrom(Map<String, Object> map) {
+ super.restoreFrom(map);
+
+ @SuppressWarnings("unchecked")
+ List<String> columnNamesState = (List<String>) map.get(COLUMN_NAMES_LIST);
+ for (String columnName : columnNamesState) {
+ this.addColumnName(columnName);
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.columnNames);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java
new file mode 100644
index 0000000000..b62fbd15a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
+
+/**
+ * javax.persistence.Version
+ */
+public final class SourceVersionAnnotation
+ extends SourceAnnotation<Attribute>
+ implements VersionAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceVersionAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java
new file mode 100644
index 0000000000..315c4a5664
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.orm;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties;
+import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.orm.AccessType;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class OrmXmlResourceProvider
+ extends AbstractXmlResourceProvider
+ implements OrmFileCreationDataModelProperties
+{
+ /**
+ * (Convenience method) Returns an ORM resource model provider for
+ * the given file.
+ */
+ public static OrmXmlResourceProvider getXmlResourceProvider(IFile file) {
+ return getXmlResourceProvider_(file.getProject(), file.getFullPath());
+ }
+
+ /**
+ * (Convenience method) Returns an ORM resource model provider for
+ * the given project in the specified runtime location
+ */
+ public static OrmXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) {
+ return getXmlResourceProvider_(project, runtimePath);
+ }
+
+ /**
+ * (Convenience method) Returns an ORM resource model provider for
+ * the given project in the default runtime location
+ */
+ public static OrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
+ return getXmlResourceProvider(project, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ }
+
+ private static OrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
+ return new OrmXmlResourceProvider(project, fullPath);
+ }
+
+
+ public OrmXmlResourceProvider(IProject project) {
+ this(project, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ }
+
+ public OrmXmlResourceProvider(IProject project, IPath filePath) {
+ super(project, filePath, JptJpaCorePlugin.ORM_XML_CONTENT_TYPE);
+ }
+
+ @Override
+ protected void populateRoot(Object config) {
+ IDataModel dataModel = (IDataModel) config;
+ XmlEntityMappings entityMappings = OrmFactory.eINSTANCE.createXmlEntityMappings();
+ entityMappings.setVersion(dataModel.getStringProperty(VERSION));
+ getResourceContents().add(entityMappings);
+
+ AccessType defaultAccess = (AccessType) dataModel.getProperty(DEFAULT_ACCESS);
+ if (defaultAccess != null) {
+ XmlPersistenceUnitMetadata puMetadata = OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata();
+ entityMappings.setPersistenceUnitMetadata(puMetadata);
+ XmlPersistenceUnitDefaults puDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
+ puMetadata.setPersistenceUnitDefaults(puDefaults);
+ puDefaults.setAccess(defaultAccess);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
new file mode 100644
index 0000000000..84ad7a641f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.persistence;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProperties;
+import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class PersistenceXmlResourceProvider
+ extends AbstractXmlResourceProvider
+ implements PersistenceFileCreationDataModelProperties
+{
+ /**
+ * (Convenience method) Returns a persistence resource model provider for
+ * the given file.
+ */
+ public static PersistenceXmlResourceProvider getXmlResourceProvider(IFile file) {
+ return getXmlResourceProvider_(file.getProject(), file.getFullPath());
+ }
+
+ /**
+ * (Convenience method) Returns an persistence resource model provider for
+ * the given project in the specified runtime location
+ */
+ public static PersistenceXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) {
+ return getXmlResourceProvider_(project, runtimePath);
+ }
+
+ /**
+ * (Convenience method) Returns a persistence resource model provider for
+ * the given project in the default runtime location
+ */
+ public static PersistenceXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
+ return getXmlResourceProvider(project, JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
+ }
+
+ private static PersistenceXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
+ return new PersistenceXmlResourceProvider(project, fullPath);
+ }
+
+
+ public PersistenceXmlResourceProvider(IProject project) {
+ this(project, JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
+ }
+
+ public PersistenceXmlResourceProvider(IProject project, IPath filePath) {
+ super(project, filePath, JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE);
+ }
+
+
+ @Override
+ protected void populateRoot(Object config) {
+ IDataModel dataModel = (IDataModel) config;
+ XmlPersistence persistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
+ persistence.setVersion(dataModel.getStringProperty(VERSION));
+ XmlPersistenceUnit persistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ persistenceUnit.setName(getProject().getName());
+ persistence.getPersistenceUnits().add(persistenceUnit);
+ getResourceContents().add(persistence);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java
new file mode 100644
index 0000000000..4ed01aa73c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.xml;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+public class JpaXmlResourceAdapterFactory
+ implements IAdapterFactory
+{
+ private static final Class<?>[] ADAPTER_LIST = new Class[] { JpaXmlResource.class };
+
+ public Class<?>[] getAdapterList() {
+ return ADAPTER_LIST;
+ }
+
+ public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
+ if (adaptableObject instanceof IFile) {
+ return this.getAdapter((IFile) adaptableObject, adapterType);
+ }
+ return null;
+ }
+
+ private Object getAdapter(final IFile file, Class <?>adapterType) {
+ if (adapterType == JpaXmlResource.class) {
+ JpaFile jpaFile = JptJpaCorePlugin.getJpaFile(file);
+ if (jpaFile != null) {
+ JptResourceModel resourceModel = jpaFile.getResourceModel();
+ if (resourceModel instanceof JpaXmlResource) {
+ return resourceModel;
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java
new file mode 100644
index 0000000000..c06f2204a8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.resource.xml;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+// TODO move to o.e.jpt.core.internal(.context)?
+// rename to JpaXmlPropertyTester
+public class JpaXmlResourcePropertyTester
+ extends PropertyTester
+{
+ public static final String IS_LATEST_SUPPORTED_VERSION = "isLatestSupportedVersion"; //$NON-NLS-1$
+
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ JpaXmlResource xmlResource = null;
+ if (receiver instanceof JpaXmlResource) {
+ xmlResource = (JpaXmlResource) receiver;
+ }
+ else if (receiver instanceof XmlFile) {
+ xmlResource = ((XmlFile) receiver).getXmlResource();
+ }
+ else {
+ return false;
+ }
+
+ if (IS_LATEST_SUPPORTED_VERSION.equals(property)) {
+ boolean expected = ((Boolean) expectedValue).booleanValue();
+ JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(xmlResource.getProject());
+ IContentType contentType = xmlResource.getContentType();
+ boolean actual =
+ xmlResource.getVersion() != null
+ && xmlResource.getVersion().equals(
+ jpaProject.getJpaPlatform().getMostRecentSupportedResourceType(contentType).getVersion());
+
+ return actual == expected;
+ }
+
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java
new file mode 100644
index 0000000000..a15741ea02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.synch;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResourceRuleFactory;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * Synchronizes the lists of persistent classes in a persistence unit and a
+ * persistence project.
+ */
+public class SynchronizeClassesJob extends WorkspaceJob
+{
+ private IFile persistenceXmlFile;
+
+
+ public SynchronizeClassesJob(IFile file) {
+ super(JptCoreMessages.SYNCHRONIZE_CLASSES_JOB);
+ IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
+ setRule(ruleFactory.modifyRule(file.getProject()));
+ this.persistenceXmlFile = file;
+ }
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ final SubMonitor sm = SubMonitor.convert(monitor, JptCoreMessages.SYNCHRONIZING_CLASSES_TASK, 20);
+ final JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(this.persistenceXmlFile.getProject());
+ final JpaXmlResource resource = jpaProject.getPersistenceXmlResource();
+ if (resource == null) {
+ //the resource would only be null if the persistence.xml file had an invalid content type
+ return Status.OK_STATUS;
+ }
+ if (sm.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ sm.worked(1);
+
+ resource.modify(new Runnable() {
+ public void run() {
+ XmlPersistence persistence = (XmlPersistence) resource.getRootObject();
+ XmlPersistenceUnit persistenceUnit;
+
+ if (persistence.getPersistenceUnits().size() > 0) {
+ persistenceUnit = persistence.getPersistenceUnits().get(0);
+ }
+ else {
+ persistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ persistenceUnit.setName(jpaProject.getName());
+ persistence.getPersistenceUnits().add(persistenceUnit);
+ }
+ sm.worked(1);
+
+ persistenceUnit.getClasses().clear();
+ sm.worked(1);
+
+ addClassRefs(sm.newChild(17), jpaProject, persistenceUnit);
+ }
+ });
+ return Status.OK_STATUS;
+ }
+
+ protected void addClassRefs(IProgressMonitor monitor, JpaProject jpaProject, XmlPersistenceUnit persistenceUnit) {
+ Iterable<String> mappedClassNames = getMappedClassNames(jpaProject, '$');
+ final SubMonitor sm = SubMonitor.convert(monitor, CollectionTools.size(mappedClassNames));
+
+ for (String fullyQualifiedTypeName : mappedClassNames) {
+ if ( ! mappingFileContains(jpaProject, fullyQualifiedTypeName)) {
+ XmlJavaClassRef classRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ classRef.setJavaClass(fullyQualifiedTypeName);
+ persistenceUnit.getClasses().add(classRef);
+ }
+ sm.worked(1);
+ }
+ }
+
+ protected Iterable<String> getMappedClassNames(final JpaProject jpaProject, final char enclosingTypeSeparator) {
+ return new TransformationIterable<String, String>(jpaProject.getMappedJavaSourceClassNames()) {
+ @Override
+ protected String transform(String fullyQualifiedName) {
+ IType jdtType = SynchronizeClassesJob.this.findType(jpaProject, fullyQualifiedName);
+ return jdtType.getFullyQualifiedName(enclosingTypeSeparator);
+ }
+ };
+ }
+
+ protected IType findType(JpaProject jpaProject, String typeName) {
+ try {
+ return jpaProject.getJavaProject().findType(typeName);
+ } catch (JavaModelException ex) {
+ return null; // ignore exception?
+ }
+ }
+
+ boolean mappingFileContains(JpaProject jpaProject, String fullyQualifiedTypeName) {
+ PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
+ if (persistenceXml == null) {
+ return false;
+ }
+ Persistence persistence = persistenceXml.getPersistence();
+ if (persistence == null) {
+ return false;
+ }
+ if (persistence.persistenceUnitsSize() == 0) {
+ return false;
+ }
+ PersistenceUnit persistenceUnit = persistence.persistenceUnits().next();
+ for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ if (mappingFileRef.getPersistentType(fullyQualifiedTypeName) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java
new file mode 100644
index 0000000000..eedc8ee9ba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.validation;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class DefaultJpaValidationMessages {
+
+ private static String[] DEFAULT_PARMS = new String[0];
+ private static TextRange DEFAULT_TEXT_RANGE = TextRange.Empty.instance();
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, Object targetObject) {
+ return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject);
+ }
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, String[] parms, Object targetObject) {
+ return buildMessage(defaultSeverity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE);
+ }
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, Object targetObject, TextRange textRange) {
+ return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject, textRange);
+ }
+
+ public static IMessage buildMessage(
+ int defaultSeverity, String messageId, String[] parms, Object targetObject, TextRange textRange) {
+
+ //determine whether default severity should be overridden
+ int severity = defaultSeverity;
+ int severityPreference = JpaValidationPreferences.getProblemSeverityPreference(targetObject, messageId);
+ if (severityPreference!=JpaValidationPreferences.NO_SEVERITY_PREFERENCE){
+ severity = severityPreference;
+ }
+ IMessage message = new Message(JpaValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject);
+ message.setMarkerId(JptJpaCorePlugin.VALIDATION_MARKER_ID);
+ if (textRange == null) {
+ //log an exception and then continue without setting location information
+ //At least the user will still get the validation message and will
+ //be able to see other validation messages with valid textRanges
+ JptJpaCorePlugin.log(new IllegalArgumentException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
+ }
+ else {
+ message.setLineNo(textRange.getLineNumber());
+ message.setOffset(textRange.getOffset());
+ message.setLength(textRange.getLength());
+ }
+ return message;
+ }
+
+
+ private DefaultJpaValidationMessages() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java
new file mode 100644
index 0000000000..df5ffa2b51
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.jpa.core.internal.validation;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jpt.jpa.core.JpaNode;
+
+public class JpaHelper extends org.eclipse.wst.validation.internal.operations.WorkbenchContext {
+
+ @Override
+ public IResource getResource(Object obj) {
+ return ((JpaNode) obj).getResource();
+ }
+
+ /*
+ * This is used when no line number is set. We generally use line numbers.
+ * Therefore, when this is called, we will use the default location, i.e.
+ * null.
+ */
+ @Override
+ public String getLocation(Object object) {
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java
new file mode 100644
index 0000000000..2b1df175a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.validation;
+
+import org.eclipse.osgi.util.NLS;
+
+public class JpaValidationDescriptionMessages {
+
+ public static String DOES_NOT_MATCH_JOIN_TABLE;
+ public static String DOES_NOT_MATCH_COLLECTION_TABLE;
+ public static String NOT_VALID_FOR_THIS_ENTITY;
+
+ public static String ATTRIBUTE_DESC;
+ public static String VIRTUAL_ATTRIBUTE_DESC;
+
+ public static String ON_MAPPED_SUPERCLASS;
+ public static String ON_EMBEDDABLE;
+
+
+ private static final String BUNDLE_NAME = "jpa_validation_description"; //$NON-NLS-1$
+ private static final Class<?> BUNDLE_CLASS = JpaValidationDescriptionMessages.class;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
+ }
+
+ private JpaValidationDescriptionMessages() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java
new file mode 100644
index 0000000000..dce1ce6b29
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.validation;
+
+@SuppressWarnings("nls")
+public interface JpaValidationMessages {
+
+ public static final String BUNDLE_NAME = "jpa_validation";
+
+ public static final String PROJECT_INVALID_LIBRARY_PROVIDER = "PROJECT_INVALID_LIBRARY_PROVIDER";
+ public static final String PROJECT_NO_CONNECTION = "PROJECT_NO_CONNECTION";
+ public static final String PROJECT_INVALID_CONNECTION = "PROJECT_INVALID_CONNECTION";
+ public static final String PROJECT_INACTIVE_CONNECTION = "PROJECT_INACTIVE_CONNECTION";
+ public static final String PROJECT_NO_PERSISTENCE_XML = "PROJECT_NO_PERSISTENCE_XML";
+ public static final String PROJECT_MULTIPLE_PERSISTENCE_XML = "PROJECT_MULTIPLE_PERSISTENCE_XML";
+ public static final String XML_VERSION_NOT_LATEST = "XML_VERSION_NOT_LATEST";
+ public static final String PERSISTENCE_XML_INVALID_CONTENT = "PERSISTENCE_XML_INVALID_CONTENT";
+ public static final String PERSISTENCE_XML_UNSUPPORTED_CONTENT = "PERSISTENCE_XML_UNSUPPORTED_CONTENT";
+ public static final String PERSISTENCE_NO_PERSISTENCE_UNIT = "PERSISTENCE_NO_PERSISTENCE_UNIT";
+ public static final String PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS = "PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS";
+ public static final String PERSISTENCE_UNIT_ENTITY_NAME_ATTRIBUTE_MISSING = "PERSISTENCE_UNIT_ENTITY_NAME_ATTRIBUTE_MISSING";
+ public static final String PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE = "PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE";
+ public static final String PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT = "PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT";
+ public static final String PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE = "PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE";
+ public static final String PERSISTENCE_UNIT_INVALID_MAPPING_FILE = "PERSISTENCE_UNIT_INVALID_MAPPING_FILE";
+ public static final String PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE = "PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE";
+ public static final String PERSISTENCE_UNIT_UNSPECIFIED_CLASS = "PERSISTENCE_UNIT_UNSPECIFIED_CLASS";
+ public static final String PERSISTENCE_UNIT_NONEXISTENT_CLASS = "PERSISTENCE_UNIT_NONEXISTENT_CLASS";
+ public static final String PERSISTENCE_UNIT_INVALID_CLASS = "PERSISTENCE_UNIT_INVALID_CLASS";
+ public static final String PERSISTENCE_UNIT_DUPLICATE_CLASS = "PERSISTENCE_UNIT_DUPLICATE_CLASS";
+ public static final String PERSISTENCE_UNIT_REDUNDANT_CLASS = "PERSISTENCE_UNIT_REDUNDANT_CLASS";
+ public static final String PERSISTENCE_UNIT_DUPLICATE_JAR_FILE = "PERSISTENCE_UNIT_DUPLICATE_JAR_FILE";
+ public static final String PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE = "PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE";
+ public static final String PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING = "PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING";
+ public static final String PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE = "PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE";
+ public static final String GENERATOR_DUPLICATE_NAME = "GENERATOR_DUPLICATE_NAME";
+ public static final String GENERATOR_NAME_UNDEFINED = "GENERATOR_NAME_UNDEFINED";
+ public static final String QUERY_DUPLICATE_NAME = "QUERY_DUPLICATE_NAME";
+ public static final String QUERY_NAME_UNDEFINED = "QUERY_NAME_UNDEFINED";
+ public static final String QUERY_STATEMENT_UNDEFINED = "QUERY_STATEMENT_UNDEFINED";
+ public static final String MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA = "MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA";
+ public static final String PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT = "PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT";
+ public static final String PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT = "PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT";
+ public static final String PERSISTENT_TYPE_UNSPECIFIED_CLASS = "PERSISTENT_TYPE_UNSPECIFIED_CLASS";
+ public static final String PERSISTENT_TYPE_UNRESOLVED_CLASS = "PERSISTENT_TYPE_UNRESOLVED_CLASS";
+ public static final String TYPE_MAPPING_PK_REDEFINED_ID_CLASS = "TYPE_MAPPING_PK_REDEFINED_ID_CLASS";
+ public static final String TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE = "TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE";
+ public static final String TYPE_MAPPING_ID_CLASS_REDEFINED = "TYPE_MAPPING_ID_CLASS_REDEFINED";
+ public static final String TYPE_MAPPING_ID_CLASS_REQUIRED = "TYPE_MAPPING_ID_CLASS_REQUIRED";
+ public static final String TYPE_MAPPING_ID_CLASS_AND_EMBEDDED_ID_BOTH_USED = "TYPE_MAPPING_ID_CLASS_AND_EMBEDDED_ID_BOTH_USED";
+ public static final String TYPE_MAPPING_MULTIPLE_EMBEDDED_ID = "TYPE_MAPPING_MULTIPLE_EMBEDDED_ID";
+ public static final String TYPE_MAPPING_ID_CLASS_WITH_MAPS_ID = "TYPE_MAPPING_ID_CLASS_WITH_MAPS_ID";
+ public static final String TYPE_MAPPING_MAPS_ID_ATTRIBUTE_TYPE_DOES_NOT_AGREE = "TYPE_MAPPING_MAPS_ID_ATTRIBUTE_TYPE_DOES_NOT_AGREE";
+ public static final String TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NO_MATCH = "TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NO_MATCH";
+ public static final String TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_NO_MATCH = "TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_NO_MATCH";
+ public static final String TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_DUPLICATE_MATCH = "TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_DUPLICATE_MATCH";
+ public static final String TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NOT_PRIMARY_KEY = "TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NOT_PRIMARY_KEY";
+ public static final String TYPE_MAPPING_ID_CLASS_ATTRIBUTE_TYPE_DOES_NOT_AGREE = "TYPE_MAPPING_ID_CLASS_ATTRIBUTE_TYPE_DOES_NOT_AGREE";
+ public static final String ENTITY_NON_ROOT_ID_CLASS_SPECIFIED = "ENTITY_NON_ROOT_ID_CLASS_SPECIFIED";
+ public static final String ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED = "ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED";
+ public static final String ENTITY_NO_PK = "ENTITY_NO_PK";
+ public static final String TYPE_MAPPING_FINAL_CLASS = "TYPE_MAPPING_FINAL_CLASS";
+ public static final String TYPE_MAPPING_MEMBER_CLASS = "TYPE_MAPPING_MEMBER_CLASS";
+ public static final String TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR = "TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR";
+ public static final String TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR = "TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR";
+ public static final String ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE = "ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE";
+ public static final String ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE = "ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE";
+ public static final String ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED = "ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED";
+ public static final String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED = "ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED";
+ public static final String ENTITY_NAME_MISSING = "ENTITY_NAME_MISSING";
+ public static final String ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED = "ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED";
+ public static final String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED = "ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED";
+ public static final String PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME = "PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME";
+ public static final String PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME = "PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME";
+ public static final String PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED = "PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED";
+ public static final String PERSISTENT_ATTRIBUTE_FINAL_FIELD = "PERSISTENT_ATTRIBUTE_FINAL_FIELD";
+ public static final String PERSISTENT_ATTRIBUTE_FINAL_GETTER = "PERSISTENT_ATTRIBUTE_FINAL_GETTER";
+ public static final String PERSISTENT_ATTRIBUTE_PUBLIC_FIELD = "PERSISTENT_ATTRIBUTE_PUBLIC_FIELD";
+ public static final String PERSISTENT_ATTRIBUTE_INVALID_MAPPING = "PERSISTENT_ATTRIBUTE_INVALID_MAPPING";
+ public static final String MAPPING_UNRESOLVED_MAPPED_BY = "MAPPING_UNRESOLVED_MAPPED_BY";
+ public static final String MAPPING_INVALID_MAPPED_BY = "MAPPING_INVALID_MAPPED_BY";
+ public static final String MAPPING_MAPPED_BY_ON_BOTH_SIDES = "MAPPING_MAPPED_BY_ON_BOTH_SIDES";
+ public static final String ID_MAPPING_UNRESOLVED_GENERATOR_NAME = "ID_MAPPING_UNRESOLVED_GENERATOR_NAME";
+ public static final String ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED = "ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED";
+ public static final String EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED = "EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED";
+ public static final String ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED = "ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED";
+ public static final String ATTRIBUTE_OVERRIDE_INVALID_NAME = "ATTRIBUTE_OVERRIDE_INVALID_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME = "VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME";
+ public static final String ASSOCIATION_OVERRIDE_INVALID_NAME = "ASSOCIATION_OVERRIDE_INVALID_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_NAME = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME = "VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_NAME";
+ public static final String VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME = "VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME = "VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME";
+ public static final String TABLE_UNRESOLVED_CATALOG = "TABLE_UNRESOLVED_CATALOG";
+ public static final String TABLE_UNRESOLVED_SCHEMA = "TABLE_UNRESOLVED_SCHEMA";
+ public static final String TABLE_UNRESOLVED_NAME = "TABLE_UNRESOLVED_NAME";
+ public static final String SECONDARY_TABLE_UNRESOLVED_CATALOG = "SECONDARY_TABLE_UNRESOLVED_CATALOG";
+ public static final String SECONDARY_TABLE_UNRESOLVED_SCHEMA = "SECONDARY_TABLE_UNRESOLVED_SCHEMA";
+ public static final String SECONDARY_TABLE_UNRESOLVED_NAME = "SECONDARY_TABLE_UNRESOLVED_NAME";
+ public static final String JOIN_TABLE_UNRESOLVED_CATALOG = "JOIN_TABLE_UNRESOLVED_CATALOG";
+ public static final String JOIN_TABLE_UNRESOLVED_SCHEMA = "JOIN_TABLE_UNRESOLVED_SCHEMA";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA";
+ public static final String JOIN_TABLE_UNRESOLVED_NAME = "JOIN_TABLE_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME";
+ public static final String COLUMN_UNRESOLVED_TABLE = "COLUMN_UNRESOLVED_TABLE";
+ public static final String COLUMN_UNRESOLVED_NAME = "COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE";
+ public static final String JOIN_COLUMN_UNRESOLVED_NAME = "JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String INVERSE_JOIN_COLUMN_UNRESOLVED_NAME = "INVERSE_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS = "VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS = "VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA";
+
+ public static final String GENERATED_VALUE_UNRESOLVED_GENERATOR = "GENERATED_VALUE_UNRESOLVED_GENERATOR";
+ public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
+ public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+ public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
+
+ public static final String NO_JPA_PROJECT = "NO_JPA_PROJECT";
+ public static final String TARGET_ENTITY_NOT_DEFINED = "TARGET_ENTITY_NOT_DEFINED";
+ public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED";
+ public static final String TARGET_ENTITY_IS_NOT_AN_ENTITY = "TARGET_ENTITY_IS_NOT_AN_ENTITY";
+ public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY";
+ public static final String DISCRIMINATOR_COLUMN_UNRESOLVED_NAME = "DISCRIMINATOR_COLUMN_UNRESOLVED_NAME";
+ public static final String ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM";
+ public static final String ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM";
+ public static final String TARGET_NOT_AN_EMBEDDABLE = "TARGET_NOT_AN_EMBEDDABLE";
+
+ public static final String COLUMN_TABLE_NOT_VALID="COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
+ public static final String JOIN_COLUMN_TABLE_NOT_VALID = "JOIN_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID";
+ public static final String INVERSE_JOIN_COLUMN_TABLE_NOT_VALID = "INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
+
+ //JPA 2.0 validation messages
+ public static final String MAPS_ID_VALUE_NOT_SPECIFIED = "MAPS_ID_VALUE_NOT_SPECIFIED";
+ public static final String MAPS_ID_VALUE_NOT_RESOLVED = "MAPS_ID_VALUE_NOT_RESOLVED";
+ public static final String MAPS_ID_VALUE_INVALID = "MAPS_ID_VALUE_INVALID";
+ public static final String ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED = "ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED";
+ public static final String ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED = "ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED";
+ public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED";
+ public static final String ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED = "ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED";
+ public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED";
+ public static final String ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE = "ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE";
+ public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE";
+ public static final String MAP_KEY_COLUMN_UNRESOLVED_NAME="MAP_KEY_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME="VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME";
+ public static final String COLLECTION_TABLE_UNRESOLVED_CATALOG = "COLLECTION_TABLE_UNRESOLVED_CATALOG";
+ public static final String COLLECTION_TABLE_UNRESOLVED_SCHEMA = "COLLECTION_TABLE_UNRESOLVED_SCHEMA";
+ public static final String VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_CATALOG = "VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_CATALOG";
+ public static final String VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA";
+ public static final String COLLECTION_TABLE_UNRESOLVED_NAME = "COLLECTION_TABLE_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME";
+ public static final String ORDER_COLUMN_UNRESOLVED_NAME = "ORDER_COLUMN_UNRESOLVED_NAME";
+ public static final String VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME";
+
+ public static final String VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
+ public static final String MAP_KEY_COLUMN_TABLE_NOT_VALID="MAP_KEY_COLUMN_TABLE_NOT_VALID";
+ public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java
new file mode 100644
index 0000000000..45b7fa7697
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.validation;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jpt.common.core.IResourcePart;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.osgi.service.prefs.BackingStoreException;
+
+//TODO: Probably want to merge the behavior in this class into JptJpaCorePlugin
+public class JpaValidationPreferences {
+
+ /*
+ * prefix for all preference strings. This is only used internally.
+ * Clients of get*LevelProblemPrefernce() and set*LevelProblemPreference
+ * should not include the prefix.
+ */
+ private static final String PROBLEM_PREFIX = "problem."; //$NON-NLS-1$
+
+ public static final String ERROR = "error"; //$NON-NLS-1$
+ public static final String WARNING = "warning"; //$NON-NLS-1$
+ public static final String INFO = "info"; //$NON-NLS-1$
+ public static final String IGNORE = "ignore"; //$NON-NLS-1$
+
+ static final int NO_SEVERITY_PREFERENCE = -1;
+
+ public static final String WORKSPACE_PREFERENCES_OVERRIDEN = "workspace_preferences_overriden"; //$NON-NLS-1$
+
+ /**
+ * Returns only the severity level of a given problem preference. This does not
+ * include information on whether the problem is ignored. See isProblemIgnored.
+ * @return an IMessage severity level
+ */
+ public static int getProblemSeverityPreference(Object targetObject, String messageId) {
+ IProject project = getProject(targetObject);
+ String problemPreference = getPreference(project, messageId);
+
+ if (problemPreference == null){
+ return NO_SEVERITY_PREFERENCE;
+ } else if (problemPreference.equals(ERROR)){
+ return IMessage.HIGH_SEVERITY;
+ } else if (problemPreference.equals(WARNING)){
+ return IMessage.NORMAL_SEVERITY;
+ } else if (problemPreference.equals(INFO)){
+ return IMessage.LOW_SEVERITY;
+ }
+ return NO_SEVERITY_PREFERENCE;
+ }
+
+ private static IProject getProject(Object targetObject) {
+ IAdaptable target = (IAdaptable)targetObject;
+ IResource resource = ((IResourcePart) target.getAdapter(IResourcePart.class)).getResource();
+ IProject project = resource.getProject();
+ return project;
+ }
+
+ /**
+ * Returns whether or not this problem should be ignored based on project or
+ * workspace preferences
+ */
+ public static boolean isProblemIgnored(IProject project, String messageId){
+ String problemPreference = getPreference(project, messageId);
+ if (problemPreference != null && problemPreference.equals(IGNORE)){
+ return true;
+ }
+ return false;
+ }
+
+ private static String getPreference(IProject project, String messageId) {
+ String problemPreference = null;
+ problemPreference = getProjectLevelProblemPreference(project, messageId);
+ //if severity is still null, check the workspace preferences
+ if (problemPreference == null) {
+ problemPreference = getWorkspaceLevelProblemPreference(messageId);
+ }
+ return problemPreference;
+ }
+
+ /**
+ * Returns the String value of the problem preference from the project preferences
+ */
+ public static String getProjectLevelProblemPreference(IProject project, String messageId){
+ return getPreference(JptJpaCorePlugin.getProjectPreferences(project), messageId);
+ }
+
+ public static void setProjectLevelProblemPreference(IProject project, String messageId, String problemPreference) {
+ IEclipsePreferences projectPreferences = JptJpaCorePlugin.getProjectPreferences(project);
+ setPreference(projectPreferences, messageId, problemPreference);
+ flush(projectPreferences);
+ }
+
+ /**
+ * Returns the String value of the problem preference from the workspace preferences
+ */
+ public static String getWorkspaceLevelProblemPreference(String messageId){
+ return getPreference(JptJpaCorePlugin.getWorkspacePreferences(), messageId);
+ }
+
+ public static void setWorkspaceLevelProblemPreference(String messageId, String problemPreference) {
+ IEclipsePreferences workspacePreferences = JptJpaCorePlugin.getWorkspacePreferences();
+ setPreference(workspacePreferences, messageId, problemPreference);
+ flush(workspacePreferences);
+ }
+
+ private static String getPreference(IEclipsePreferences preferences, String messageId) {
+ return preferences.get(appendProblemPrefix(messageId), null);
+ }
+
+ private static void setPreference(IEclipsePreferences preferences, String messageId, String problemPreference) {
+ if (problemPreference == null){
+ preferences.remove(appendProblemPrefix(messageId));
+ }
+ else {
+ preferences.put(appendProblemPrefix(messageId), problemPreference);
+ }
+ }
+
+ private static String appendProblemPrefix(String messageId) {
+ return PROBLEM_PREFIX + messageId;
+ }
+
+ public static void flush(IEclipsePreferences prefs) {
+ try {
+ prefs.flush();
+ } catch(BackingStoreException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java
new file mode 100644
index 0000000000..e56712c0f4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.validation;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jpt.common.core.IResourcePart;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.wst.validation.AbstractValidator;
+import org.eclipse.wst.validation.ValidationResult;
+import org.eclipse.wst.validation.ValidationState;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IProjectValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+
+/**
+ * This class is referenced in the JPA extension for the
+ * WTP validator extension point.
+ */
+public class JpaValidator extends AbstractValidator implements IValidator {
+
+ public JpaValidator() {
+ super();
+ }
+
+
+ // ********** IValidator implementation **********
+
+ public void validate(IValidationContext context, IReporter reporter) {
+ validate(reporter, project(context));
+ }
+
+ public void cleanup(IReporter reporter) {
+ // nothing to do
+ }
+
+
+ // **************** AbstractValidator impl *********************************
+
+ @Override
+ public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
+ if (resource.getType() != IResource.FILE)
+ return null;
+ ValidationResult result = new ValidationResult();
+ IReporter reporter = result.getReporter(monitor);
+ IProject project = resource.getProject();
+ this.clearMarkers(project);
+ result.setSuspendValidation(project);
+ this.validate(reporter, project);
+ return result;
+ }
+
+
+ // **************** internal conv. *****************************************
+ private void clearMarkers(IProject project) {
+ try {
+ clearMarkers_(project);
+ }
+ catch (CoreException ce) {
+ JptJpaCorePlugin.log(ce);
+ }
+ }
+
+ private void clearMarkers_(IProject project) throws CoreException {
+ IMarker[] markers = project.findMarkers(JptJpaCorePlugin.VALIDATION_MARKER_ID, true, IResource.DEPTH_INFINITE);
+ for (IMarker marker : markers) {
+ marker.delete();
+ }
+ }
+
+ private void validate(IReporter reporter, IProject project) {
+ for (IMessage message : this.getValidationMessages(reporter, project)) {
+ // check to see if the message should be ignored based on preferences
+ if (!JpaValidationPreferences.isProblemIgnored(project, message.getId())){
+ reporter.addMessage(this, adjustMessage(message));
+ }
+ }
+ }
+
+ private IProject project(IValidationContext context) {
+ return ((IProjectValidationContext) context).getProject();
+ }
+
+ private Iterable<IMessage> getValidationMessages(IReporter reporter, IProject project) {
+ JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
+ if (jpaProject != null) {
+ return CollectionTools.iterable(jpaProject.validationMessages(reporter));
+ }
+ return new SingleElementIterable<IMessage>(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.NO_JPA_PROJECT,
+ project
+ ));
+ }
+
+ private IMessage adjustMessage(IMessage message) {
+ IAdaptable targetObject = (IAdaptable) message.getTargetObject();
+ IResource targetResource = ((IResourcePart) targetObject.getAdapter(IResourcePart.class)).getResource();
+ message.setTargetObject(targetResource);
+ if (message.getLineNumber() == IMessage.LINENO_UNSET) {
+ message.setAttribute(IMarker.LOCATION, " ");
+ }
+ return message;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaFactory2_0.java
new file mode 100644
index 0000000000..ebf2260b44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaFactory2_0.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2;
+
+import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0.Owner;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
+import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
+
+/**
+ * JPA 2.0 factory
+ *<p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see org.eclipse.jpt.jpa.core.internal.jpa2.GenericJpaFactory2_0
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JpaFactory2_0
+ extends JpaFactory
+{
+
+ // ********** Core Model **********
+
+ /**
+ * Return an identifier adapter that can be used to convert database
+ * identifiers to names and vice versa, respecting the <code>delimited-identifiers</code>
+ * in <code>persistence.xml</code>.
+ */
+ DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter(JpaDataSource dataSource);
+
+ MetamodelSourceType.Synchronizer buildMetamodelSynchronizer(MetamodelSourceType sourceType);
+
+
+ // ********** Java Context Model **********
+
+ //overloaded because the 2.0 JPA spec supports association overrides on an embedded mapping while the 1.0 spec did not
+ JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEmbeddedMapping2_0 parent, JavaAssociationOverrideContainer.Owner owner);
+
+ JavaDerivedIdentity2_0 buildJavaDerivedIdentity(JavaSingleRelationshipMapping2_0 parent);
+
+ JavaElementCollectionMapping2_0 buildJavaElementCollectionMapping2_0(JavaPersistentAttribute parent);
+
+ JavaCacheable2_0 buildJavaCacheable(JavaCacheableHolder2_0 parent);
+
+ JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent);
+
+ JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner);
+
+ JavaCollectionTable2_0 buildJavaCollectionTable(JavaElementCollectionMapping2_0 parent, Table.Owner owner);
+
+ JavaColumn buildJavaMapKeyColumn(JavaJpaContextNode parent, JavaColumn.Owner owner);
+
+ JavaOrderable2_0 buildJavaOrderable(JavaAttributeMapping parent, Orderable2_0.Owner owner);
+
+ /**
+ * Use {@link #buildJavaOrderable(JavaAttributeMapping, Owner)}.
+ */
+ JavaOrderable buildJavaOrderable(JavaAttributeMapping parent);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
new file mode 100644
index 0000000000..60d4e079db
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
+
+/**
+ * JPA 2.0 project.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JpaProject2_0
+ extends JpaProject, MetamodelSynchronizer
+{
+
+ // ********** Canonical Metamodel **********
+
+ /**
+ * ID string used when metamodelSourceFolderName property is changed.
+ * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener)
+ */
+ String METAMODEL_SOURCE_FOLDER_NAME_PROPERTY = "metamodelSourceFolderName"; //$NON-NLS-1$
+
+ /**
+ * Return the name of the folder that holds the generated Canonical
+ * Metamodel.
+ */
+ String getMetamodelSourceFolderName();
+
+ /**
+ * Set the name of the folder that holds the generated Canonical
+ * Metamodel.
+ */
+ void setMetamodelSourceFolderName(String metamodelSourceFolderName);
+
+ /**
+ * Return the package fragment root that holds the generated Canonical
+ * Metamodel.
+ */
+ IPackageFragmentRoot getMetamodelPackageFragmentRoot();
+
+ /**
+ * Return a list of the names of the Java source folders. (These
+ * can be used to hold the generated Canonical Metamodel.)
+ */
+ Iterable<String> getJavaSourceFolderNames();
+
+ /**
+ * Return the JPA project's generated metamodel Java resource persistent
+ * top-level types.
+ * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePersistentType#isGeneratedMetamodel(IPackageFragmentRoot)
+ */
+ Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTopLevelTypes();
+
+ /**
+ * Return the top-level generated metamodel Java resource persistent type
+ * in the specified file. Return null if any of the following is true:<ul>
+ * <li>the file is not a Java source file
+ * <li>the top-level Java class is not annotated with the appropriate
+ * <code>javax.annotation.Generated</code> annotation
+ * <li>neither the top-level Java class nor any of its nested classes
+ * is annotated with the appropriate
+ * <code>javax.persistence.metamodel.StaticMetamodel</code> annotation
+ * <ul>
+ */
+ JavaResourcePersistentType2_0 getGeneratedMetamodelTopLevelType(IFile file);
+
+
+ // ********** construction config **********
+
+ /**
+ * The settings used to construct a JPA 2.0 project.
+ */
+ interface Config extends JpaProject.Config {
+
+ /**
+ * Return the name of the folder that holds the generated Canonical
+ * Metamodel. Return null if the Canonical Metamodel is not to be
+ * generated.
+ */
+ String getMetamodelSourceFolderName();
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MappingKeys2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MappingKeys2_0.java
new file mode 100644
index 0000000000..6e0cdd236c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MappingKeys2_0.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+@SuppressWarnings("nls")
+public interface MappingKeys2_0 {
+
+ String ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY = "elementCollection";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java
new file mode 100644
index 0000000000..08a22a3bee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2;
+
+import java.io.Serializable;
+
+/**
+ * JPA 2.0 Canonical Metamodel synchronizer.
+ * <p>
+ * Notes:
+ * <ul><li>
+ * When a JPA project is first created (e.g. when the user adds the JPA
+ * Facet to a Faceted project or when a workspace containing a JPA project is
+ * opened), if it is configured to generate the
+ * Canonical Metamodel (i.e. its metamodel source folder is non-null), it will
+ * first discover what metamodel classes are already present in the metamodel
+ * source folder. Any class appropriately annotated with
+ * <code>javax.persistence.metamodel.StaticMetamodel</code>
+ * and <code>javax.annotation.Generated</code>
+ * will be added to the Canonical Metamodel
+ * (see {@link org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePersistentType#isGeneratedMetamodel()}).
+ * Once the JPA project's context model is constructed, a new Canonical
+ * Metamodel is generated and merged with the classes already present in the
+ * metamodel source folder.
+ * </li><li>
+ * When a JPA project's metamodel source folder setting is cleared, the Canonical
+ * Metamodel is cleared from the context model, but the generated source files are
+ * left in place.
+ * </li><li>
+ * When a JPA project's metamodel source folder is set to a non-null value,
+ * like when a JPA project is first created, the resulting Canonical Metamodel
+ * will be merged with whatever is already present in the folder.
+ * </li></ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MetamodelSynchronizer {
+
+ void initializeMetamodel();
+
+ void synchronizeMetamodel();
+
+ void disposeMetamodel();
+
+
+ /**
+ * Singleton implemetation of the metamodel synchronizer interface that
+ * does nothing. (Not sure we need this....)
+ */
+ final class Null implements MetamodelSynchronizer, Serializable {
+ public static final MetamodelSynchronizer INSTANCE = new Null();
+ public static MetamodelSynchronizer instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public void initializeMetamodel() {
+ // do nothing
+ }
+ public void synchronizeMetamodel() {
+ // do nothing
+ }
+ public void disposeMetamodel() {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return "MetamodelSynchronizer.Null"; //$NON-NLS-1$
+ }
+ private static final long serialVersionUID = 1L;
+ private Object readResolve() {
+ // replace this object with the singleton
+ return INSTANCE;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/AttributeMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/AttributeMapping2_0.java
new file mode 100644
index 0000000000..6c97944a00
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/AttributeMapping2_0.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+
+/**
+ * JPA 2.0 attribute mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface AttributeMapping2_0
+ extends AttributeMapping
+{
+ /**
+ * Return the Canonical Metamodel field corresponding to the mapping.
+ * Return <code>null</code> if the mapping is not to be part of the
+ * Canonical Metamodel.
+ */
+ MetamodelField getMetamodelField();
+
+ /**
+ * Return the name of the mapping's type as used in the Canonical Metamodel.
+ */
+ String getMetamodelTypeName();
+
+ @SuppressWarnings("nls")
+ Iterable<String> STANDARD_METAMODEL_FIELD_MODIFIERS =
+ new ArrayIterable<String>(new String[] { "public", "static", "volatile" });
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cacheable2_0.java
new file mode 100644
index 0000000000..fb2bc5fc18
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cacheable2_0.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+
+/**
+ * cacheable
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface Cacheable2_0
+ extends JpaContextNode
+{
+ boolean isCacheable();
+
+ Boolean getSpecifiedCacheable();
+ void setSpecifiedCacheable(Boolean cacheable);
+ String SPECIFIED_CACHEABLE_PROPERTY = "specifiedCacheable"; //$NON-NLS-1$
+
+ boolean isDefaultCacheable();
+ String DEFAULT_CACHEABLE_PROPERTY = "defaultCacheable"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CacheableHolder2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CacheableHolder2_0.java
new file mode 100644
index 0000000000..4dd035225f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CacheableHolder2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+
+/**
+ * cacheable holder/parent
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface CacheableHolder2_0
+ extends JpaContextNode
+{
+ Cacheable2_0 getCacheable();
+
+ boolean calculateDefaultCacheable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cascade2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cascade2_0.java
new file mode 100644
index 0000000000..32b0cb518a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cascade2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.Cascade;
+
+/**
+ * JPA 2.0 cascade (persist, merge, remove, refresh, detach)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface Cascade2_0
+ extends Cascade
+{
+ boolean isDetach();
+ void setDetach(boolean value);
+ String DETACH_PROPERTY = "detach"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
new file mode 100644
index 0000000000..d2d53d61a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.CollectionMapping;
+import org.eclipse.jpt.jpa.core.context.Column;
+
+/**
+ * JPA 2.0 collection mapping (e.g. 1:m, m:m, element collection)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface CollectionMapping2_0
+ extends CollectionMapping, AttributeMapping2_0
+{
+ // ********** map key class **********
+
+ String getMapKeyClass();
+
+ String getSpecifiedMapKeyClass();
+ void setSpecifiedMapKeyClass(String value);
+ String SPECIFIED_MAP_KEY_CLASS_PROPERTY = "specifiedMapKeyClass"; //$NON-NLS-1$
+
+ String getDefaultMapKeyClass();
+ String DEFAULT_MAP_KEY_CLASS_PROPERTY = "defaultMapKeyClass"; //$NON-NLS-1$
+
+ /**
+ * Return the character to be used for browsing or creating the map key
+ * class {@link IType}.
+ * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
+ */
+ char getMapKeyClassEnclosingTypeSeparator();
+
+
+ // ********** map key column **********
+
+ /**
+ * Return the map key column for this collection mapping.
+ */
+ Column getMapKeyColumn();
+
+ AttributeOverrideContainer getMapKeyAttributeOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionTable2_0.java
new file mode 100644
index 0000000000..62784130c5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionTable2_0.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.ReferenceTable;
+
+/**
+ * Used by element collection mappings.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface CollectionTable2_0
+ extends ReferenceTable
+{
+ ElementCollectionMapping2_0 getParent();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java
new file mode 100644
index 0000000000..76e29ce643
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+
+/**
+ * Derived identity
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface DerivedIdentity2_0
+ extends JpaContextNode
+{
+// TODO bjv rename methods
+ /**
+ * Return the associated single relationship mapping.
+ */
+ SingleRelationshipMapping2_0 getMapping();
+
+ // ********** predominant strategy **********
+
+ /**
+ * String associated with changes to the predominant derived identity
+ * strategy property.
+ */
+ String PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY = "predominantDerivedIdentityStrategy"; //$NON-NLS-1$
+
+ /**
+ * Return the mapping's predominant strategy.
+ */
+ DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy();
+
+
+ // ********** null strategy **********
+
+ /**
+ * Return whether the mapping has no strategy.
+ */
+ boolean usesNullDerivedIdentityStrategy();
+
+ /**
+ * Configure the mapping so it has no strategy.
+ * This will remove all other strategies.
+ */
+ void setNullDerivedIdentityStrategy();
+
+
+ // ********** ID strategy **********
+
+ /**
+ * Return the mapping's ID strategy.
+ */
+ IdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy();
+
+ /**
+ * Return whether the mapping uses an ID strategy.
+ */
+ boolean usesIdDerivedIdentityStrategy();
+
+ /**
+ * Configure the mapping so it has an ID strategy.
+ * This will remove all other strategies.
+ */
+ void setIdDerivedIdentityStrategy();
+
+ /**
+ * Clear the mapping's ID strategy.
+ * This will not set any other strategy; so whichever other strategy is
+ * present (or the null strategy) will apply.
+ */
+ void unsetIdDerivedIdentityStrategy();
+
+
+ // ********** maps ID strategy **********
+
+ /**
+ * Return the mapping's "maps ID" strategy.
+ */
+ MapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy();
+
+ /**
+ * Return whether the mapping uses a "maps ID" strategy.
+ */
+ boolean usesMapsIdDerivedIdentityStrategy();
+
+ /**
+ * Configure the mapping so it has a "maps ID" strategy.
+ * This will remove all other strategies.
+ */
+ void setMapsIdDerivedIdentityStrategy();
+
+ /**
+ * Clear the mapping's "maps ID" strategy.
+ * This will not set any other strategy; so whichever other strategy is
+ * present (or the null strategy) will apply.
+ */
+ void unsetMapsIdDerivedIdentityStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..466dfea80a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentityStrategy2_0.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+
+/**
+ * Derived identity strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface DerivedIdentityStrategy2_0
+ extends JpaContextNode
+{
+ /**
+ * Return whether the strategy is specified on the resource model.
+ */
+ boolean isSpecified();
+
+ /**
+ * Add this strategy to the relationship reference.
+ */
+ void addStrategy();
+
+ /**
+ * Remove this strategy from the relationship reference.
+ */
+ void removeStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
new file mode 100644
index 0000000000..0ddfda7d8f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.Column;
+import org.eclipse.jpt.jpa.core.context.ConvertibleMapping;
+import org.eclipse.jpt.jpa.core.context.Entity;
+
+/**
+ * JPA 2.0 element collection mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ElementCollectionMapping2_0
+ extends CollectionMapping2_0, ConvertibleMapping
+{
+ /**
+ * Return the entity that owns the mapping. This is
+ * just a convenience method that calls {@link #getTypeMapping()} and returns
+ * <code>null</code> if it is not an {@link Entity}.
+ */
+ Entity getEntity();
+
+
+ // ********** target class **********
+
+ String getTargetClass();
+
+ String getSpecifiedTargetClass();
+ void setSpecifiedTargetClass(String value);
+ String SPECIFIED_TARGET_CLASS_PROPERTY = "specifiedTargetClass"; //$NON-NLS-1$
+
+ String getDefaultTargetClass();
+ String DEFAULT_TARGET_CLASS_PROPERTY = "defaultTargetClass"; //$NON-NLS-1$
+
+ /**
+ * Return the character to be used for browsing or creating the target
+ * class {@link IType}.
+ * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
+ */
+ char getTargetClassEnclosingTypeSeparator();
+
+
+ // ********** collection table **********
+
+ /**
+ * Return the mapping's collection table.
+ * This will not be null.
+ */
+ CollectionTable2_0 getCollectionTable();
+
+
+ // ********** value column **********
+
+ /**
+ * Return the mapping's value column.
+ */
+ Column getValueColumn();
+
+
+ // ********** override containers **********
+
+ AttributeOverrideContainer getValueAttributeOverrideContainer();
+
+ AssociationOverrideContainer getValueAssociationOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedIdMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedIdMapping2_0.java
new file mode 100644
index 0000000000..1612665a3a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedIdMapping2_0.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
+
+/**
+ * JPA 2.0 embedded ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface EmbeddedIdMapping2_0
+ extends EmbeddedIdMapping, MappedByRelationshipMapping2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedMapping2_0.java
new file mode 100644
index 0000000000..43d47a6e03
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.EmbeddedMapping;
+
+/**
+ * JPA 2.0 embedded mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+ public interface EmbeddedMapping2_0
+ extends EmbeddedMapping, AttributeMapping2_0
+{
+ AssociationOverrideContainer getAssociationOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..caf3fe784e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+/**
+ * ID derived identity strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface IdDerivedIdentityStrategy2_0
+ extends DerivedIdentityStrategy2_0
+{
+ /**
+ * String associated with changes to the value property of this object
+ */
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Return whether this object uses a derived id
+ */
+ boolean getValue();
+
+ /**
+ * Set whether this object uses a derived id
+ */
+ void setValue(boolean value);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdMapping2_0.java
new file mode 100644
index 0000000000..f72838c729
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdMapping2_0.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.IdMapping;
+
+/**
+ * JPA 2.0 ID mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface IdMapping2_0
+ extends IdMapping, MappedByRelationshipMapping2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/JpaRootContextNode2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/JpaRootContextNode2_0.java
new file mode 100644
index 0000000000..ccd7dd2eb9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/JpaRootContextNode2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
+
+/**
+ * Root of the Dali JPA 2.0 context model.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JpaRootContextNode2_0
+ extends JpaRootContextNode, MetamodelSynchronizer
+{
+ // nothing yet...
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/LockModeType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/LockModeType2_0.java
new file mode 100644
index 0000000000..65826a933f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/LockModeType2_0.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+/**
+ * LockMode Type
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public enum LockModeType2_0 {
+
+ READ(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.READ,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.READ
+ ),
+ WRITE(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.WRITE,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.WRITE
+ ),
+ OPTIMISTIC(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.OPTIMISTIC,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.OPTIMISTIC
+ ),
+ OPTIMISTIC_FORCE_INCREMENT(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.OPTIMISTIC_FORCE_INCREMENT,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.OPTIMISTIC_FORCE_INCREMENT
+ ),
+ PESSIMISTIC_READ(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.PESSIMISTIC_READ,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.PESSIMISTIC_READ
+ ),
+ PESSIMISTIC_WRITE(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.PESSIMISTIC_WRITE,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.PESSIMISTIC_WRITE
+ ),
+ PESSIMISTIC_FORCE_INCREMENT(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.PESSIMISTIC_FORCE_INCREMENT,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.PESSIMISTIC_FORCE_INCREMENT
+ ),
+ NONE(
+ org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0.NONE,
+ org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0.NONE
+ );
+
+
+ private org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0 javaLockModeType;
+ private org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 ormLockModeType;
+
+ LockModeType2_0(org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0 javaLockModeType, org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 ormLockModeType) {
+ if (javaLockModeType == null) {
+ throw new NullPointerException();
+ }
+ if (ormLockModeType == null) {
+ throw new NullPointerException();
+ }
+ this.javaLockModeType = javaLockModeType;
+ this.ormLockModeType = ormLockModeType;
+ }
+
+ public org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0 getJavaLockModeType() {
+ return this.javaLockModeType;
+ }
+
+ public org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 getOrmLockModeType() {
+ return this.ormLockModeType;
+ }
+
+
+ // ********** static methods **********
+
+ public static LockModeType2_0 fromJavaResourceModel(org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0 javaLockModeType) {
+ return (javaLockModeType == null) ? null : fromJavaResourceModel_(javaLockModeType);
+ }
+
+ private static LockModeType2_0 fromJavaResourceModel_(org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0 javaLockModeType) {
+ for (LockModeType2_0 lockModeType : LockModeType2_0.values()) {
+ if (lockModeType.getJavaLockModeType() == javaLockModeType) {
+ return lockModeType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0 toJavaResourceModel(LockModeType2_0 lockModeType) {
+ return (lockModeType == null) ? null : lockModeType.getJavaLockModeType();
+ }
+
+
+ public static LockModeType2_0 fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 ormLockModeType) {
+ return (ormLockModeType == null) ? null : fromOrmResourceModel_(ormLockModeType);
+ }
+
+ private static LockModeType2_0 fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 ormLockModeType) {
+ for (LockModeType2_0 lockModeType : LockModeType2_0.values()) {
+ if (lockModeType.getOrmLockModeType() == ormLockModeType) {
+ return lockModeType;
+ }
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 toOrmResourceModel(LockModeType2_0 lockModeType) {
+ return (lockModeType == null) ? null : lockModeType.getOrmLockModeType();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToManyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToManyMapping2_0.java
new file mode 100644
index 0000000000..51095a4b82
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToManyMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.ManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship;
+
+/**
+ * JPA 2.0 m:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ManyToManyMapping2_0
+ extends ManyToManyMapping, CollectionMapping2_0
+{
+ ManyToManyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneMapping2_0.java
new file mode 100644
index 0000000000..255d89272e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.ManyToOneMapping;
+import org.eclipse.jpt.jpa.core.context.ManyToOneRelationship;
+
+/**
+ * JPA 2.0 m:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ManyToOneMapping2_0
+ extends ManyToOneMapping, SingleRelationshipMapping2_0
+{
+ ManyToOneRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneRelationship2_0.java
new file mode 100644
index 0000000000..fbe1033083
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneRelationship2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.ManyToOneRelationship;
+
+/**
+ * JPA 2.0 m:1 relationship (mapped by, join column, join table)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ManyToOneRelationship2_0
+ extends ManyToOneRelationship, JoinTableRelationship
+{
+ // add join table support to JPA 1.0 m:1
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappedByRelationshipMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappedByRelationshipMapping2_0.java
new file mode 100644
index 0000000000..650dd4c9f1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappedByRelationshipMapping2_0.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+/**
+ * JPA 2.0 attribute mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface MappedByRelationshipMapping2_0
+ extends AttributeMapping2_0
+{
+ /**
+ * Return whether the ID (or embedded ID) mapping is mapped by a
+ * relationship; i.e. a relationship maps the ID using the
+ * <code>@MapsId</code> annotation.
+ * <p>
+ * <strong>NB:</strong> There can be several relationships
+ * (erroneously, of course).
+ */
+ boolean isMappedByRelationship();
+
+ /**
+ * Property string associated with changes to the mapped by relationship
+ */
+ final String MAPPED_BY_RELATIONSHIP_PROPERTY = "mappedByRelationship"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitDefaults2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitDefaults2_0.java
new file mode 100644
index 0000000000..60aa6f2854
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitDefaults2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults;
+
+/**
+ * JPA 2.0 Persistence unit defaults held by a mapping file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MappingFilePersistenceUnitDefaults2_0
+ extends MappingFilePersistenceUnitDefaults
+{
+ /**
+ * Return whether all the database identifiers in the
+ * persistence unit are to be considered delimited.
+ */
+ boolean isDelimitedIdentifiers();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitMetadata2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitMetadata2_0.java
new file mode 100644
index 0000000000..c412c367eb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitMetadata2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
+
+/**
+ * JPA 2.0
+ * Persistence unit metadata held by a mapping file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface MappingFilePersistenceUnitMetadata2_0
+ extends MappingFilePersistenceUnitMetadata
+{
+ /**
+ * Return a description of the mapping file's persistence unit.
+ */
+ String getDescription();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MapsIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..37cd352442
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MapsIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+
+/**
+ * Maps ID derived identity strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapsIdDerivedIdentityStrategy2_0
+ extends DerivedIdentityStrategy2_0
+{
+// TODO bjv rename value to attribute name
+ /**
+ * Return the specfied value, or in absence of that, the default value
+ */
+ String getValue();
+
+ /**
+ * String associated with changes to the specified value property of this object
+ */
+ String SPECIFIED_VALUE_PROPERTY = "specifiedValue"; //$NON-NLS-1$
+
+ /**
+ * Return the specified value (the id which has been specified in code)
+ * Will return null if no value is specified
+ */
+ String getSpecifiedValue();
+
+ /**
+ * Set the specified value (the id to specify in code)
+ */
+ void setSpecifiedValue(String value);
+
+ /**
+ * Return whether a default value is ever used (in some cases, there can be no default)
+ */
+ boolean usesDefaultValue();
+
+ /**
+ * String associated with changes to the default value property of this object
+ */
+ String DEFAULT_VALUE_PROPERTY = "defaultValue"; //$NON-NLS-1$
+
+ /**
+ * Return the default value (the id which would be used in the absence of a specified value)
+ */
+ String getDefaultValue();
+
+ /**
+ * Return a sorted iterator of possible value choices
+ */
+ Iterable<String> getSortedValueChoices();
+
+ /**
+ * Return a resolved attribute mapping, which may be a mapping on the entity, or a mapping
+ * within an embeddable mapping on the entity
+ */
+ AttributeMapping getResolvedAttributeMappingValue();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelField.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelField.java
new file mode 100644
index 0000000000..4e68b8268e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelField.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+/**
+ * JPA 2.0 Canonical Metamodel field corresponding to a persistent attribute.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MetamodelField {
+
+ Iterable<String> getModifiers();
+
+ String getTypeName();
+
+ Iterable<String> getTypeArgumentNames();
+
+ String getName();
+
+ String DEFAULT_TYPE_NAME = java.lang.Object.class.getName(); // ???
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java
new file mode 100644
index 0000000000..5722f45ee2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.common.core.utility.BodySourceWriter;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+
+import com.ibm.icu.text.Collator;
+
+/**
+ * JPA 2.0 metamodel source type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MetamodelSourceType {
+
+ /**
+ * Return the source type's name.
+ */
+ String getName();
+
+ /**
+ * Return whether the source type is "managed" (i.e. persistent).
+ */
+ boolean isManaged();
+
+ /**
+ * Return the source type's super type.
+ */
+ PersistentType getSuperPersistentType();
+
+ /**
+ * Return the source type's attributes.
+ */
+ <T extends PersistentAttribute> ListIterator<T> attributes();
+
+ /**
+ * Return the file generated as a result of the metamodel synchronization.
+ */
+ IFile getMetamodelFile();
+
+ /**
+ * Return the source type's JPA project.
+ */
+ JpaProject getJpaProject();
+
+ /**
+ * Synchronize the source type's metamodel, using the specified member type
+ * tree.
+ */
+ void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree);
+
+ /**
+ * Print the body of the source type's metamodel class on the specified
+ * writer, using the specified member type tree.
+ */
+ void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree);
+
+
+ /**
+ * {@link Comparator} that can be used to compare source types.
+ */
+ Comparator<MetamodelSourceType> COMPARATOR =
+ new Comparator<MetamodelSourceType>() {
+ public int compare(MetamodelSourceType type1, MetamodelSourceType type2) {
+ return Collator.getInstance().compare(type1.getName(), type2.getName());
+ }
+ };
+
+
+ /**
+ * This interface is used by the source type to synchronize the metamodel
+ * as required by changes to the context model.
+ */
+ interface Synchronizer {
+ /**
+ * Return the file generated as a result of the metamodel synchronization.
+ */
+ IFile getFile();
+
+ /**
+ * Synchronize the metamodel with the current state of the source
+ * type, using the specified member type tree.
+ */
+ void synchronize(Map<String, Collection<MetamodelSourceType>> memberTypeTree);
+
+ /**
+ * Print the body of the metamodel class on the specified writer,
+ * using the specified member type tree.
+ */
+ void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/NamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/NamedQuery2_0.java
new file mode 100644
index 0000000000..0d4be3ba44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/NamedQuery2_0.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+
+/**
+ * JPA 2.0 named query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface NamedQuery2_0
+ extends NamedQuery
+{
+ // ********** lock mode **********
+
+ /**
+ * Return the specified lock mode if present, otherwise return the default
+ * lock mode.
+ */
+ LockModeType2_0 getLockMode();
+ LockModeType2_0 getSpecifiedLockMode();
+ void setSpecifiedLockMode(LockModeType2_0 lockMode);
+ String SPECIFIED_LOCK_MODE_PROPERTY = "specifiedLockMode"; //$NON-NLS-1$
+ LockModeType2_0 getDefaultLockMode();
+ String DEFAULT_LOCK_MODE_PROPERTY = "defaultLockMode"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyMapping2_0.java
new file mode 100644
index 0000000000..e916dad3c0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.OneToManyMapping;
+import org.eclipse.jpt.jpa.core.context.OneToManyRelationship;
+
+/**
+ * JPA 2.0 1:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OneToManyMapping2_0
+ extends OneToManyMapping, CollectionMapping2_0
+{
+ OneToManyRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyRelationship2_0.java
new file mode 100644
index 0000000000..a67f09cd4c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyRelationship2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.OneToManyRelationship;
+
+/**
+ * JPA 2.0 1:m relationship (mapped by, join table, join column)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OneToManyRelationship2_0
+ extends OneToManyRelationship, JoinColumnRelationship
+{
+ // add join column support to JPA 1.0 1:m
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneMapping2_0.java
new file mode 100644
index 0000000000..c9a8427f0d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.OneToOneMapping;
+import org.eclipse.jpt.jpa.core.context.OneToOneRelationship;
+
+/**
+ * JPA 2.0 1:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OneToOneMapping2_0
+ extends OneToOneMapping, SingleRelationshipMapping2_0
+{
+ OneToOneRelationship getRelationship();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneRelationship2_0.java
new file mode 100644
index 0000000000..f60caa4f5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneRelationship2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.OneToOneRelationship;
+
+/**
+ * JPA 2.0 1:1 relationship (mapped by, join column, primary key join column,
+ * join table)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OneToOneRelationship2_0
+ extends OneToOneRelationship, JoinTableRelationship
+{
+ // add join table support to JPA 1.0 1:1
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrderColumn2_0.java
new file mode 100644
index 0000000000..19f51dde76
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrderColumn2_0.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.NamedColumn;
+
+/**
+ * order column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrderColumn2_0
+ extends NamedColumn
+{
+ // ********** nullable **********
+
+ /**
+ * Return the specified nullable setting if present, otherwise return the
+ * default nullable setting.
+ */
+ boolean isNullable();
+ Boolean getSpecifiedNullable();
+ void setSpecifiedNullable(Boolean newSpecifiedNullable);
+ String SPECIFIED_NULLABLE_PROPERTY = "specifiedNullable"; //$NON-NLS-1$
+ boolean isDefaultNullable();
+ String DEFAULT_NULLABLE_PROPERTY = "defaultNullable"; //$NON-NLS-1$
+ boolean DEFAULT_NULLABLE = true;
+
+
+ // ********** insertable **********
+
+ /**
+ * Return the specified insertable setting if present, otherwise return the
+ * default insertable setting.
+ */
+ boolean isInsertable();
+ Boolean getSpecifiedInsertable();
+ void setSpecifiedInsertable(Boolean newSpecifiedInsertable);
+ String SPECIFIED_INSERTABLE_PROPERTY = "specifiedInsertable"; //$NON-NLS-1$
+ boolean isDefaultInsertable();
+ String DEFAULT_INSERTABLE_PROPERTY = "defaultInsertable"; //$NON-NLS-1$
+ boolean DEFAULT_INSERTABLE = true;
+
+
+ // ********** updatable **********
+
+ /**
+ * Return the specified updatable setting if present, otherwise return the
+ * default updatable setting.
+ */
+ boolean isUpdatable();
+ Boolean getSpecifiedUpdatable();
+ void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable);
+ String SPECIFIED_UPDATABLE_PROPERTY = "specifiedUpdatable"; //$NON-NLS-1$
+ boolean isDefaultUpdatable();
+ String DEFAULT_UPDATABLE_PROPERTY = "defaultUpdatable"; //$NON-NLS-1$
+ boolean DEFAULT_UPDATABLE = true;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Orderable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Orderable2_0.java
new file mode 100644
index 0000000000..acd5de3c7e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Orderable2_0.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.Orderable;
+import org.eclipse.jpt.jpa.db.Table;
+
+/**
+ * Multi-valued (1:m, m:m) relationship and element collection mappings support
+ * ordering.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface Orderable2_0
+ extends Orderable
+{
+ boolean isOrderColumnOrdering();
+ void setOrderColumnOrdering(boolean value);
+ String ORDER_COLUMN_ORDERING_PROPERTY = "orderColumnOrdering"; //$NON-NLS-1$
+
+ OrderColumn2_0 getOrderColumn();
+
+ String getDefaultTableName();
+
+
+ /**
+ * interface allowing ordering in multiple places
+ * (i.e. multi-value relationship and element collection mappings)
+ */
+ interface Owner
+ {
+ /**
+ * Return the name of the column's table.
+ */
+ String getTableName();
+
+ Table resolveDbTable(String tableName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovable2_0.java
new file mode 100644
index 0000000000..599ea17e18
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovable2_0.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+
+/**
+ * Oprhan removal
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrphanRemovable2_0
+ extends JpaContextNode
+{
+ boolean isOrphanRemoval();
+
+ Boolean getSpecifiedOrphanRemoval();
+ void setSpecifiedOrphanRemoval(Boolean orphanRemoval);
+ String SPECIFIED_ORPHAN_REMOVAL_PROPERTY = "specifiedOrphanRemoval"; //$NON-NLS-1$
+
+ boolean isDefaultOrphanRemoval();
+ String DEFAULT_ORPHAN_REMOVAL_PROPERTY = "defaultOrphanRemoval"; //$NON-NLS-1$
+ boolean DEFAULT_ORPHAN_REMOVAL = false;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovalHolder2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovalHolder2_0.java
new file mode 100644
index 0000000000..b4736135c0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovalHolder2_0.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.JpaNode;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrphanRemovalHolder2_0
+ extends JpaNode
+{
+ OrphanRemovable2_0 getOrphanRemoval();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OverrideRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OverrideRelationship2_0.java
new file mode 100644
index 0000000000..a44fbe4fb4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OverrideRelationship2_0.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
+
+/**
+ * JPA 2.0 association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see AssociationOverride
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OverrideRelationship2_0
+ extends OverrideRelationship,
+ JoinTableRelationship,
+ ReadOnlyOverrideRelationship2_0
+{
+ // add join table support to JPA 1.0 association override
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentAttribute2_0.java
new file mode 100644
index 0000000000..a847dd0c03
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentAttribute2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+
+/**
+ * JPA 2.0
+ * Context persistent <em>attribute</em> (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface PersistentAttribute2_0
+ extends PersistentAttribute, ReadOnlyPersistentAttribute2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentType2_0.java
new file mode 100644
index 0000000000..65a6fd9f59
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentType2_0.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+
+/**
+ * JPA 2.0 context persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface PersistentType2_0
+ extends PersistentType, MetamodelSourceType
+{
+ /**
+ * Return the name of the persistent type's "declaring type".
+ * Return <code>null</code> if the persistent type is a top-level type.
+ * The declaring type may or may not be a persistent type.
+ */
+ String getDeclaringTypeName();
+ String DECLARING_TYPE_NAME_PROPERTY = "declaringTypeName"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyOverrideRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyOverrideRelationship2_0.java
new file mode 100644
index 0000000000..14d0aceef3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyOverrideRelationship2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.AssociationOverride;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
+
+/**
+ * Association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see AssociationOverride
+ */
+public interface ReadOnlyOverrideRelationship2_0
+ extends ReadOnlyOverrideRelationship,
+ ReadOnlyJoinTableRelationship
+{
+ // add join table support to JPA 1.0 association override
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyPersistentAttribute2_0.java
new file mode 100644
index 0000000000..00fc7c7b93
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyPersistentAttribute2_0.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+
+/**
+ * JPA 2.0
+ * Read-only context persistent <em>attribute</em> (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface ReadOnlyPersistentAttribute2_0
+ extends ReadOnlyPersistentAttribute
+{
+ /**
+ * Return the name of the container type to be used in the metamodel field
+ * declaration corresponding to the attribute's mapping.
+ */
+ String getMetamodelContainerFieldTypeName();
+
+ /**
+ * Return the name of the container map key type to be used in the
+ * metamodel field declaration corresponding to the attribute's mapping.
+ * Return <code>null</code> if the attribute's type is not
+ * {@link java.util.Map}.
+ */
+ String getMetamodelContainerFieldMapKeyTypeName();
+
+ /**
+ * Return the attribute's type name for the metamodel.
+ */
+ String getMetamodelTypeName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SequenceGenerator2_0.java
new file mode 100644
index 0000000000..4c390df246
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SequenceGenerator2_0.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
+
+/**
+ * JPA 2.0 sequence generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface SequenceGenerator2_0
+ extends SequenceGenerator
+{
+ // ********** catalog **********
+
+ /**
+ * Return the specified catalog if present, otherwise return the default
+ * catalog.
+ */
+ String getCatalog();
+ String getSpecifiedCatalog();
+ void setSpecifiedCatalog(String value);
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$
+
+
+ // ********** schema **********
+
+ /**
+ * Return the specified schema if present, otherwise return the default
+ * schema.
+ */
+ String getSchema();
+ String getSpecifiedSchema();
+ void setSpecifiedSchema(String value);
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SingleRelationshipMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SingleRelationshipMapping2_0.java
new file mode 100644
index 0000000000..6fb656dae7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SingleRelationshipMapping2_0.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.SingleRelationshipMapping;
+
+/**
+ * JPA 2.0 single (m:1, 1:2) mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface SingleRelationshipMapping2_0
+ extends SingleRelationshipMapping, AttributeMapping2_0
+{
+ DerivedIdentity2_0 getDerivedIdentity();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/VirtualOverrideRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/VirtualOverrideRelationship2_0.java
new file mode 100644
index 0000000000..5f2cb9985b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/VirtualOverrideRelationship2_0.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context;
+
+import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.VirtualOverrideRelationship;
+
+/**
+ * JPA 2.0 virtual association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface VirtualOverrideRelationship2_0
+ extends VirtualOverrideRelationship,
+ VirtualJoinTableRelationship,
+ ReadOnlyOverrideRelationship2_0
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheable2_0.java
new file mode 100644
index 0000000000..5979afa47d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheable2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
+
+/**
+ * Java cacheable
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaCacheable2_0
+ extends Cacheable2_0, JavaJpaContextNode
+{
+ // combine two interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java
new file mode 100644
index 0000000000..d6f9225bcc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * Java cacheable holder/parent
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaCacheableHolder2_0
+ extends CacheableHolder2_0, JavaJpaContextNode
+{
+ JavaResourcePersistentType getResourcePersistentType();
+ JavaCacheable2_0 getCacheable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCascade2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCascade2_0.java
new file mode 100644
index 0000000000..058d01a308
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCascade2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaCascade;
+import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0;
+
+/**
+ * Java cascade (persist, merge, remove, refresh, detach)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaCascade2_0
+ extends JavaCascade, Cascade2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java
new file mode 100644
index 0000000000..1c62018f68
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaCollectionMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0;
+
+/**
+ * Java collection mapping (e.g. 1:m, m:m, element collection)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaCollectionMapping2_0
+ extends CollectionMapping2_0, JavaCollectionMapping
+{
+ JavaAttributeOverrideContainer getMapKeyAttributeOverrideContainer();
+
+ /**
+ * If the map key class is specified, this will return it fully qualified.
+ * If not specified, it returns the default map key class, which is always
+ * fully qualified.
+ */
+ String getFullyQualifiedMapKeyClass();
+ String FULLY_QUALIFIED_MAP_KEY_CLASS_PROPERTY = "fullyQualifiedMapKeyClass"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionTable2_0.java
new file mode 100644
index 0000000000..f7690c0d31
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionTable2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaReferenceTable;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
+
+/**
+ * Java collection table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaCollectionTable2_0
+ extends CollectionTable2_0, JavaReferenceTable
+{
+ CollectionTable2_0Annotation getTableAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaDerivedIdentity2_0.java
new file mode 100644
index 0000000000..8deb0ade29
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaDerivedIdentity2_0.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentity2_0;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Java derived identity
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaDerivedIdentity2_0
+ extends DerivedIdentity2_0, JavaJpaContextNode
+{
+ JavaSingleRelationshipMapping2_0 getMapping();
+
+ JavaIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy();
+
+ JavaMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy();
+
+ void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaElementCollectionMapping2_0.java
new file mode 100644
index 0000000000..f4bae3b67e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaElementCollectionMapping2_0.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
+import org.eclipse.jpt.jpa.core.context.java.JavaConvertibleMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
+
+/**
+ * Java element collection mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaElementCollectionMapping2_0
+ extends ElementCollectionMapping2_0, JavaCollectionMapping2_0, JavaConvertibleMapping
+{
+ ElementCollection2_0Annotation getMappingAnnotation();
+
+ JavaCollectionTable2_0 getCollectionTable();
+
+ JavaColumn getValueColumn();
+
+ JavaAttributeOverrideContainer getValueAttributeOverrideContainer();
+
+ JavaAssociationOverrideContainer getValueAssociationOverrideContainer();
+
+ /**
+ * If the target class is specified, this will return it fully qualified. If not
+ * specified, it returns the default target class, which is always fully qualified
+ */
+ String getFullyQualifiedTargetClass();
+ String FULLY_QUALIFIED_TARGET_CLASS_PROPERTY = "fullyQualifiedTargetClass"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaEmbeddedMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaEmbeddedMapping2_0.java
new file mode 100644
index 0000000000..e9260e3cd6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaEmbeddedMapping2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedMapping2_0;
+
+/**
+ * JPA 2.0 Java embedded mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaEmbeddedMapping2_0
+ extends EmbeddedMapping2_0, JavaEmbeddedMapping
+{
+ JavaAssociationOverrideContainer getAssociationOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..5768792f44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.IdDerivedIdentityStrategy2_0;
+
+/**
+ * Java ID derived identity strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaIdDerivedIdentityStrategy2_0
+ extends JavaJpaContextNode, IdDerivedIdentityStrategy2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToManyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToManyMapping2_0.java
new file mode 100644
index 0000000000..b0b9ca3f51
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToManyMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToManyMapping2_0;
+
+/**
+ * JPA 2.0 Java m:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaManyToManyMapping2_0
+ extends ManyToManyMapping2_0, JavaManyToManyMapping, JavaCollectionMapping2_0
+{
+ // combine various mappings
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneMapping2_0.java
new file mode 100644
index 0000000000..d605e66a1f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneMapping2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneMapping2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToOne2_0Annotation;
+
+/**
+ * JPA 2.0 Java m:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaManyToOneMapping2_0
+ extends ManyToOneMapping2_0, JavaManyToOneMapping, JavaSingleRelationshipMapping2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneRelationship2_0.java
new file mode 100644
index 0000000000..a4ca264c8d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneRelationship2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneRelationship2_0;
+
+/**
+ * JPA 2.0 Java m:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaManyToOneRelationship2_0
+ extends ManyToOneRelationship2_0,
+ JavaManyToOneRelationship,
+ JavaMappingJoinTableRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapsIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..23293e88b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapsIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.MapsIdDerivedIdentityStrategy2_0;
+
+/**
+ * Java maps ID derived identity strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaMapsIdDerivedIdentityStrategy2_0
+ extends JavaJpaContextNode, MapsIdDerivedIdentityStrategy2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaNamedQuery2_0.java
new file mode 100644
index 0000000000..ad6d339b0c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaNamedQuery2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
+import org.eclipse.jpt.jpa.core.jpa2.context.NamedQuery2_0;
+
+/**
+ * JPA 2.0
+ * Java named native query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaNamedQuery2_0
+ extends NamedQuery2_0, JavaNamedQuery
+{
+ // combine 2 interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyMapping2_0.java
new file mode 100644
index 0000000000..39e2316cd3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToManyMapping2_0;
+
+/**
+ * JPA 2.0 Java 1:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOneToManyMapping2_0
+ extends OneToManyMapping2_0, JavaOneToManyMapping, JavaCollectionMapping2_0
+{
+ // combine various interfaces
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyRelationship2_0.java
new file mode 100644
index 0000000000..168cfa5235
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyRelationship2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToManyRelationship2_0;
+
+/**
+ * JPA 2.0 Java 1:m relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOneToManyRelationship2_0
+ extends OneToManyRelationship2_0,
+ JavaOneToManyRelationship,
+ JavaMappingJoinColumnRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneMapping2_0.java
new file mode 100644
index 0000000000..20746176bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToOneMapping2_0;
+
+/**
+ * JPA 2.0 Java 1:1 mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOneToOneMapping2_0
+ extends OneToOneMapping2_0, JavaOneToOneMapping, JavaSingleRelationshipMapping2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneRelationship2_0.java
new file mode 100644
index 0000000000..eb44db096e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneRelationship2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToOneRelationship2_0;
+
+/**
+ * JPA 2.0 Java 1:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOneToOneRelationship2_0
+ extends OneToOneRelationship2_0,
+ JavaOneToOneRelationship,
+ JavaMappingJoinTableRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderColumn2_0.java
new file mode 100644
index 0000000000..c257db1828
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderColumn2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
+
+/**
+ * orm.xml order column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOrderColumn2_0
+ extends OrderColumn2_0, JavaNamedColumn
+{
+ OrderColumn2_0Annotation getColumnAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java
new file mode 100644
index 0000000000..d417cc26dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+
+/**
+ * JPA 2.0 Java ordering
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOrderable2_0
+ extends Orderable2_0, JavaOrderable
+{
+ JavaResourcePersistentAttribute getResourcePersistentAttribute();
+
+ JavaOrderColumn2_0 getOrderColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovable2_0.java
new file mode 100644
index 0000000000..924a98d2ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovable2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrphanRemovable2_0;
+
+/**
+ * Java orphan removal
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOrphanRemovable2_0
+ extends JavaJpaContextNode, OrphanRemovable2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovalHolder2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovalHolder2_0.java
new file mode 100644
index 0000000000..05497f76a4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovalHolder2_0.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrphanRemovalHolder2_0;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOrphanRemovalHolder2_0
+ extends OrphanRemovalHolder2_0, JavaJpaContextNode
+{
+ JavaOrphanRemovable2_0 getOrphanRemoval();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOverrideRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOverrideRelationship2_0.java
new file mode 100644
index 0000000000..2d578376a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOverrideRelationship2_0.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.OverrideRelationship2_0;
+
+/**
+ * JPA 2.0 Java association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaOverrideRelationship2_0
+ extends OverrideRelationship2_0,
+ JavaOverrideRelationship,
+ JavaJoinTableRelationship
+{
+ JavaJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentAttribute2_0.java
new file mode 100644
index 0000000000..41cdcc8b38
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentAttribute2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.PersistentAttribute2_0;
+
+/**
+ * JPA 2.0
+ * Context Java persistent <em>attribute</em> (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaPersistentAttribute2_0
+ extends JavaPersistentAttribute, PersistentAttribute2_0
+{
+ // combine two interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java
new file mode 100644
index 0000000000..4483641f19
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
+
+/**
+ * JPA 2.0 context Java persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaPersistentType2_0
+ extends JavaPersistentType, PersistentType2_0
+{
+ @SuppressWarnings("unchecked")
+ ListIterator<JavaPersistentAttribute> attributes();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSequenceGenerator2_0.java
new file mode 100644
index 0000000000..bcaba68fa5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSequenceGenerator2_0.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
+import org.eclipse.jpt.jpa.core.jpa2.context.SequenceGenerator2_0;
+
+/**
+ * JPA 2.0
+ * Java sequence generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaSequenceGenerator2_0
+ extends JavaSequenceGenerator, SequenceGenerator2_0
+{
+ // nothing
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java
new file mode 100644
index 0000000000..b0b6f5d878
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaSingleRelationshipMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
+
+/**
+ * JPA 2.0 Java single (m:1, 1:1) mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaSingleRelationshipMapping2_0
+ extends SingleRelationshipMapping2_0, JavaSingleRelationshipMapping
+{
+ JavaDerivedIdentity2_0 getDerivedIdentity();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaVirtualOverrideRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaVirtualOverrideRelationship2_0.java
new file mode 100644
index 0000000000..06e744eeb6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaVirtualOverrideRelationship2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.java;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.VirtualOverrideRelationship2_0;
+
+/**
+ * JPA 2.0 Java virtual association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaVirtualOverrideRelationship2_0
+ extends VirtualOverrideRelationship2_0,
+ JavaVirtualOverrideRelationship,
+ JavaVirtualJoinTableRelationship
+{
+ JavaVirtualJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheable2_0.java
new file mode 100644
index 0000000000..2c70badf2c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheable2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
+
+/**
+ * <code>orm.xml</code> cacheable
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmCacheable2_0
+ extends Cacheable2_0, XmlContextNode
+{
+ // combine two interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheableHolder2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheableHolder2_0.java
new file mode 100644
index 0000000000..b0f21ae95d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheableHolder2_0.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
+
+/**
+ * <code>orm.xml</code> cacheable holder/parent
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmCacheableHolder2_0
+ extends CacheableHolder2_0, XmlContextNode
+{
+ XmlCacheable_2_0 getXmlCacheable();
+ OrmCacheable2_0 getCacheable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCascade2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCascade2_0.java
new file mode 100644
index 0000000000..bfa95fc752
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCascade2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmCascade;
+import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0;
+
+/**
+ * <code>orm.xml</code> cascade (persist, merge, remove, refresh, detach)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmCascade2_0
+ extends OrmCascade, Cascade2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java
new file mode 100644
index 0000000000..6451a12115
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmCollectionMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0;
+
+/**
+ * <code>orm.xml</code> collection mapping (e.g. 1:m, m:m, element collection)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmCollectionMapping2_0
+ extends CollectionMapping2_0, OrmCollectionMapping
+{
+ OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionTable2_0.java
new file mode 100644
index 0000000000..834a0db803
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionTable2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmReferenceTable;
+import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
+
+/**
+ * <code>orm.xml</code> collection table
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmCollectionTable2_0
+ extends CollectionTable2_0, OrmReferenceTable
+{
+ void initializeFrom(CollectionTable2_0 oldCollectionTable);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmDerivedIdentity2_0.java
new file mode 100644
index 0000000000..eae448147e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmDerivedIdentity2_0.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentity2_0;
+
+/**
+ * <code>orm.xml</code> derived identity
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmDerivedIdentity2_0
+ extends DerivedIdentity2_0, XmlContextNode
+{
+ OrmSingleRelationshipMapping2_0 getMapping();
+
+ OrmIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy();
+
+ OrmMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy();
+
+ void initializeFrom(OrmDerivedIdentity2_0 oldDerivedIdentity);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java
new file mode 100644
index 0000000000..28862fb25f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
+import org.eclipse.jpt.jpa.core.context.orm.OrmConvertibleMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+
+/**
+ * <code>orm.xml</code> element collection mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmElementCollectionMapping2_0
+ extends ElementCollectionMapping2_0, OrmCollectionMapping2_0, OrmConvertibleMapping
+{
+ XmlElementCollection getXmlAttributeMapping();
+
+ OrmCollectionTable2_0 getCollectionTable();
+
+ OrmColumn getValueColumn();
+
+ OrmAttributeOverrideContainer getValueAttributeOverrideContainer();
+
+ OrmAssociationOverrideContainer getValueAssociationOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmEmbeddedMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmEmbeddedMapping2_0.java
new file mode 100644
index 0000000000..f7c79bc30b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmEmbeddedMapping2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedMapping2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> embedded mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmEmbeddedMapping2_0
+ extends EmbeddedMapping2_0, OrmEmbeddedMapping
+{
+ OrmAssociationOverrideContainer getAssociationOverrideContainer();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..0d587dfcfc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.IdDerivedIdentityStrategy2_0;
+
+/**
+ * <code>orm.xml</code> ID derived identity strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmIdDerivedIdentityStrategy2_0
+ extends XmlContextNode, IdDerivedIdentityStrategy2_0
+{
+ void initializeFrom(OrmIdDerivedIdentityStrategy2_0 oldStrategy);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToManyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToManyMapping2_0.java
new file mode 100644
index 0000000000..68305194a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToManyMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToManyMapping2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> m:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmManyToManyMapping2_0
+ extends ManyToManyMapping2_0, OrmManyToManyMapping, OrmCollectionMapping2_0
+{
+ // combine various mappings
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneMapping2_0.java
new file mode 100644
index 0000000000..9e5da40de2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneMapping2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> m:1 mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmManyToOneMapping2_0
+ extends ManyToOneMapping2_0, OrmManyToOneMapping, OrmSingleRelationshipMapping2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneRelationship2_0.java
new file mode 100644
index 0000000000..4b37b6a4a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneRelationship2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneRelationship2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> m:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmManyToOneRelationship2_0
+ extends ManyToOneRelationship2_0,
+ OrmManyToOneRelationship,
+ OrmMappingJoinTableRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapsIdDerivedIdentityStrategy2_0.java
new file mode 100644
index 0000000000..3668696dc0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapsIdDerivedIdentityStrategy2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.MapsIdDerivedIdentityStrategy2_0;
+
+/**
+ * <code>orm.xml</code> maps ID derived identity strategy
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmMapsIdDerivedIdentityStrategy2_0
+ extends XmlContextNode, MapsIdDerivedIdentityStrategy2_0
+{
+ void initializeFrom(OrmMapsIdDerivedIdentityStrategy2_0 oldStrategy);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmNamedQuery2_0.java
new file mode 100644
index 0000000000..7eaa568841
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmNamedQuery2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
+import org.eclipse.jpt.jpa.core.jpa2.context.NamedQuery2_0;
+
+/**
+ * JPA 2.0
+ * <code>orm.xml</code> named query
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmNamedQuery2_0
+ extends OrmNamedQuery, NamedQuery2_0
+{
+ // combine 2 interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyMapping2_0.java
new file mode 100644
index 0000000000..47c81ee816
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToManyMapping2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> 1:m mapping
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOneToManyMapping2_0
+ extends OneToManyMapping2_0, OrmOneToManyMapping, OrmCollectionMapping2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyRelationship2_0.java
new file mode 100644
index 0000000000..0b2ae25196
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyRelationship2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinColumnRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToManyRelationship2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> 1:m relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOneToManyRelationship2_0
+ extends OneToManyRelationship2_0,
+ OrmOneToManyRelationship,
+ OrmMappingJoinColumnRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneMapping2_0.java
new file mode 100644
index 0000000000..a78fa8a746
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToOneMapping2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> 1:1 mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOneToOneMapping2_0
+ extends OneToOneMapping2_0, OrmOneToOneMapping, OrmSingleRelationshipMapping2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneRelationship2_0.java
new file mode 100644
index 0000000000..380b471f75
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneRelationship2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.OneToOneRelationship2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> 1:1 relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOneToOneRelationship2_0
+ extends OneToOneRelationship2_0,
+ OrmOneToOneRelationship,
+ OrmMappingJoinTableRelationship
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderColumn2_0.java
new file mode 100644
index 0000000000..b27ad72124
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderColumn2_0.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn;
+
+/**
+ * <code>orm.xml</code> order column
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOrderColumn2_0
+ extends OrderColumn2_0, OrmNamedColumn
+{
+ XmlOrderColumn getXmlColumn();
+
+
+ // ********** owner **********
+
+ /**
+ * interface allowing order columns to be used in multiple places
+ */
+ interface Owner
+ extends OrmNamedColumn.Owner
+ {
+ XmlOrderColumn getXmlColumn();
+
+ XmlOrderColumn buildXmlColumn();
+
+ void removeXmlColumn();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderable2_0.java
new file mode 100644
index 0000000000..48bd529572
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderable2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> ordering
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOrderable2_0
+ extends Orderable2_0, OrmOrderable
+{
+ OrmOrderColumn2_0 getOrderColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovable2_0.java
new file mode 100644
index 0000000000..4066c21dae
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovable2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrphanRemovable2_0;
+
+/**
+ * <code>orm.xml</code> orphan removal
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOrphanRemovable2_0
+ extends XmlContextNode, OrphanRemovable2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovalHolder2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovalHolder2_0.java
new file mode 100644
index 0000000000..2af8ca8c2c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovalHolder2_0.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.jpa2.context.OrphanRemovalHolder2_0;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmOrphanRemovalHolder2_0
+ extends OrphanRemovalHolder2_0, XmlContextNode
+{
+ OrmOrphanRemovable2_0 getOrphanRemoval();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOverrideRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOverrideRelationship2_0.java
new file mode 100644
index 0000000000..6482ea2742
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOverrideRelationship2_0.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
+import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
+import org.eclipse.jpt.jpa.core.jpa2.context.OverrideRelationship2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.3
+ */
+public interface OrmOverrideRelationship2_0
+ extends OverrideRelationship2_0,
+ OrmOverrideRelationship,
+ OrmJoinTableRelationship
+{
+ OrmJoinTableRelationshipStrategy getJoinTableStrategy();
+
+ JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver);
+
+ JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitDefaults2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitDefaults2_0.java
new file mode 100644
index 0000000000..6651e7ae4d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitDefaults2_0.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.jpa2.context.MappingFilePersistenceUnitDefaults2_0;
+
+/**
+ * JPA 2.0 context model corresponding to the
+ * XML resource model {@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0},
+ * which corresponds to the <code>persistence-unit-defaults</code> element
+ * in the <code>orm.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmPersistenceUnitDefaults2_0
+ extends MappingFilePersistenceUnitDefaults2_0, OrmPersistenceUnitDefaults
+{
+ void setDelimitedIdentifiers(boolean value);
+ String DELIMITED_IDENTIFIERS_PROPERTY = "delimitedIdentifiers"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitMetadata2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitMetadata2_0.java
new file mode 100644
index 0000000000..13513392b3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitMetadata2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.jpa2.context.MappingFilePersistenceUnitMetadata2_0;
+
+/**
+ * JPA 2.0
+ * Context <code>orm.xml</code> persistence unit metadata.
+ * Context model corresponding to the
+ * XML resource model {@link XmlPersistenceUnitMetadata},
+ * which corresponds to the <code>persistence-unit-metadata</code> element
+ * in the <code>orm.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmPersistenceUnitMetadata2_0
+ extends MappingFilePersistenceUnitMetadata2_0, OrmPersistenceUnitMetadata
+{
+ void setDescription(String description);
+ String DESCRIPTION_PROPERTY = "description"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentAttribute2_0.java
new file mode 100644
index 0000000000..6610cd06a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentAttribute2_0.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.PersistentAttribute2_0;
+
+/**
+ * JPA 2.0
+ * Context <code>orm.xml</code> persistent <em>attribute</em>
+ * (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmPersistentAttribute2_0
+ extends OrmPersistentAttribute, PersistentAttribute2_0
+{
+ // combine two interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java
new file mode 100644
index 0000000000..c429661c27
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
+
+/**
+ * JPA 2.0 context <code>orm.xml</code> persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmPersistentType2_0
+ extends OrmPersistentType, PersistentType2_0
+{
+ @SuppressWarnings("unchecked")
+ ListIterator<OrmReadOnlyPersistentAttribute> attributes();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmReadOnlyPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmReadOnlyPersistentAttribute2_0.java
new file mode 100644
index 0000000000..fff1c9a9b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmReadOnlyPersistentAttribute2_0.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyPersistentAttribute2_0;
+
+/**
+ * JPA 2.0
+ * Read-only context <code>orm.xml</code> persistent <em>attribute</em>
+ * (field or property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmReadOnlyPersistentAttribute2_0
+ extends OrmReadOnlyPersistentAttribute, ReadOnlyPersistentAttribute2_0
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSequenceGenerator2_0.java
new file mode 100644
index 0000000000..773b945717
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSequenceGenerator2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
+import org.eclipse.jpt.jpa.core.jpa2.context.SequenceGenerator2_0;
+
+/**
+ * JPA 2.0
+ * <code>orm.xml</code> sequence generator
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmSequenceGenerator2_0
+ extends SequenceGenerator2_0, OrmSequenceGenerator
+{
+ // nothing
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSingleRelationshipMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSingleRelationshipMapping2_0.java
new file mode 100644
index 0000000000..5e5c9c1e16
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSingleRelationshipMapping2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmSingleRelationshipMapping;
+import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> single (1:1, m:1) mapping.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmSingleRelationshipMapping2_0
+ extends SingleRelationshipMapping2_0, OrmSingleRelationshipMapping
+{
+ OrmDerivedIdentity2_0 getDerivedIdentity();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmVirtualOverrideRelationship2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmVirtualOverrideRelationship2_0.java
new file mode 100644
index 0000000000..cbc36fb12c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmVirtualOverrideRelationship2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationship;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
+import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
+import org.eclipse.jpt.jpa.core.jpa2.context.VirtualOverrideRelationship2_0;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> virtual association override relationship
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmVirtualOverrideRelationship2_0
+ extends VirtualOverrideRelationship2_0,
+ OrmVirtualOverrideRelationship,
+ OrmVirtualJoinTableRelationship
+{
+ OrmVirtualJoinTableRelationshipStrategy getJoinTableStrategy();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
new file mode 100644
index 0000000000..b5095b430d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.orm;
+
+import org.eclipse.jpt.jpa.core.context.Table;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+
+/**
+ * JPA 2.0 <code>orm.xml</code> context node factory
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrmXml2_0ContextNodeFactory
+ extends OrmXmlContextNodeFactory
+{
+ // ********** ORM Context Model **********
+
+ OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEmbeddedMapping2_0 parent, OrmAssociationOverrideContainer.Owner owner);
+
+ OrmDerivedIdentity2_0 buildOrmDerivedIdentity(OrmSingleRelationshipMapping2_0 parent);
+
+ OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, XmlElementCollection resourceMapping);
+
+ OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent);
+
+ OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent);
+
+ OrmOrderable2_0 buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner);
+
+ OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner);
+
+ OrmCollectionTable2_0 buildOrmCollectionTable(OrmElementCollectionMapping2_0 parent, Table.Owner owner);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java
new file mode 100644
index 0000000000..1a8cf4126e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
+
+/**
+ * The <code>persistence</code> element in the JPA 2.0 <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface Persistence2_0
+ extends Persistence, MetamodelSynchronizer
+{
+ // nothing yet...
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java
new file mode 100644
index 0000000000..27f5e08718
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
+import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
+import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode;
+
+/**
+ * JPA 2.0 <code>persistence-unit</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface PersistenceUnit2_0
+ extends PersistenceUnit, MetamodelSynchronizer
+{
+ // ********** shared cache mode **********
+
+ /**
+ * Return the persistence unit's shared cache mode,
+ * whether specified or defaulted.
+ */
+ SharedCacheMode getSharedCacheMode();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * specified shared cache mode
+ */
+ String SPECIFIED_SHARED_CACHE_MODE_PROPERTY = "specifiedSharedCacheMode"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's specified shared cache mode.
+ */
+ SharedCacheMode getSpecifiedSharedCacheMode();
+
+ /**
+ * Set the persistence unit's specified shared cache mode.
+ */
+ void setSpecifiedSharedCacheMode(SharedCacheMode sharedCacheMode);
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default shared cache mode (not typically changed).
+ */
+ String DEFAULT_SHARED_CACHE_MODE_PROPERTY = "defaultSharedCacheMode"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's default shared cache mode.
+ */
+ SharedCacheMode getDefaultSharedCacheMode();
+
+ boolean calculateDefaultCacheable();
+
+ // ********** validation mode **********
+
+ /**
+ * Return the persistence unit's validation mode,
+ * whether specified or defaulted.
+ */
+ ValidationMode getValidationMode();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * specified validation mode
+ */
+ String SPECIFIED_VALIDATION_MODE_PROPERTY = "specifiedValidationMode"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's specified validation mode.
+ */
+ ValidationMode getSpecifiedValidationMode();
+
+ /**
+ * Set the persistence unit's specified validation mode.
+ */
+ void setSpecifiedValidationMode(ValidationMode validationMode);
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default validation mode (not typically changed).
+ */
+ String DEFAULT_VALIDATION_MODE_PROPERTY = "defaultValidationMode"; //$NON-NLS-1$
+
+ /**
+ * Return the persistence unit's default validation mode.
+ */
+ ValidationMode getDefaultValidationMode();
+
+ ValidationMode DEFAULT_VALIDATION_MODE = ValidationMode.AUTO;
+
+ // ********** properties **********
+
+ PersistenceUnitProperties getConnection();
+
+ PersistenceUnitProperties getOptions();
+
+ // ********** ORM persistence unit defaults **********
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default "delimited identifiers" flag.
+ */
+ String DEFAULT_DELIMITED_IDENTIFIERS_PROPERTY = "defaultDelimitedIdentifiers"; //$NON-NLS-1$
+
+ /**
+ * Return the default "delimited identifiers" flag from the first persistence unit defaults
+ * found in the persistence unit's list of mapping files.
+ */
+ boolean getDefaultDelimitedIdentifiers();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java
new file mode 100644
index 0000000000..c707a9d6c2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.persistence;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
+
+/**
+ * JPA 2.0 <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface PersistenceXml2_0
+ extends PersistenceXml, MetamodelSynchronizer
+{
+ // nothing yet...
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/connection/JpaConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/connection/JpaConnection2_0.java
new file mode 100644
index 0000000000..b003fc6cde
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/connection/JpaConnection2_0.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JpaConnection2_0
+ extends PersistenceUnitProperties
+{
+ String getDefaultDriver();
+ String getDriver();
+ void setDriver(String newDriver);
+ static final String DRIVER_PROPERTY = "driver"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_JDBC_DRIVER = "javax.persistence.jdbc.driver"; //$NON-NLS-1$
+ static final String DEFAULT_JDBC_DRIVER = ""; //$NON-NLS-1$
+
+ String getDefaultUrl();
+ String getUrl();
+ void setUrl(String newUrl);
+ static final String URL_PROPERTY = "url"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_JDBC_URL = "javax.persistence.jdbc.url"; //$NON-NLS-1$
+ static final String DEFAULT_JDBC_URL = ""; //$NON-NLS-1$
+
+ String getDefaultUser();
+ String getUser();
+ void setUser(String newUser);
+ static final String USER_PROPERTY = "user"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_JDBC_USER = "javax.persistence.jdbc.user"; //$NON-NLS-1$
+ static final String DEFAULT_JDBC_USER = ""; //$NON-NLS-1$
+
+ String getDefaultPassword();
+ String getPassword();
+ void setPassword(String newPassword);
+ static final String PASSWORD_PROPERTY = "password"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_JDBC_PASSWORD = "javax.persistence.jdbc.password"; //$NON-NLS-1$
+ static final String DEFAULT_JDBC_PASSWORD = ""; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/JpaOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/JpaOptions2_0.java
new file mode 100644
index 0000000000..2f841e139b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/JpaOptions2_0.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.persistence.options;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JpaOptions2_0
+ extends PersistenceUnitProperties
+{
+ Integer getDefaultLockTimeout();
+ Integer getLockTimeout();
+ void setLockTimeout(Integer newLockTimeout);
+ static final String LOCK_TIMEOUT_PROPERTY = "lockTimeout"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_LOCK_TIMEOUT = "javax.persistence.lock.timeout"; //$NON-NLS-1$
+ static final Integer DEFAULT_LOCK_TIMEOUT = Integer.valueOf(5);
+
+ Integer getDefaultQueryTimeout();
+ Integer getQueryTimeout();
+ void setQueryTimeout(Integer newQueryTimeout);
+ static final String QUERY_TIMEOUT_PROPERTY = "queryTimeout"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_QUERY_TIMEOUT = "javax.persistence.query.timeout"; //$NON-NLS-1$
+ static final Integer DEFAULT_QUERY_TIMEOUT = Integer.valueOf(5);
+
+ ListIterator<String> validationGroupPrePersists();
+ int validationGroupPrePersistsSize();
+ boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName);
+ String addValidationGroupPrePersist(String newValidationGroupPrePersistClassName);
+ void removeValidationGroupPrePersist(String validationGroupPrePersistClassName);
+ static final String VALIDATION_GROUP_PRE_PERSIST_LIST = "validationGroupPrePersists"; //$NON-NLS-1$
+ static final String VALIDATION_GROUP_PRE_PERSIST_PROPERTY = "validationGroupPrePersist"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST = "javax.persistence.validation.group.pre-persist"; //$NON-NLS-1$
+
+ ListIterator<String> validationGroupPreUpdates();
+ int validationGroupPreUpdatesSize();
+ boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName);
+ String addValidationGroupPreUpdate(String newValidationGroupPreUpdateClassName);
+ void removeValidationGroupPreUpdate(String validationGroupPreUpdateClassName);
+ static final String VALIDATION_GROUP_PRE_UPDATE_LIST = "validationGroupPreUpdates"; //$NON-NLS-1$
+ static final String VALIDATION_GROUP_PRE_UPDATE_PROPERTY = "validationGroupPreUpdate"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE = "javax.persistence.validation.group.pre-update"; //$NON-NLS-1$
+
+ ListIterator<String> validationGroupPreRemoves();
+ int validationGroupPreRemovesSize();
+ boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName);
+ String addValidationGroupPreRemove(String newValidationGroupPreRemoveClassName);
+ void removeValidationGroupPreRemove(String validationGroupPreRemoveClassName);
+ static final String VALIDATION_GROUP_PRE_REMOVE_LIST = "validationGroupPreRemoves"; //$NON-NLS-1$
+ static final String VALIDATION_GROUP_PRE_REMOVE_PROPERTY = "validationGroupPreRemove"; //$NON-NLS-1$
+ // Property key
+ static final String PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE = "javax.persistence.validation.group.pre-remove"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/SharedCacheMode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/SharedCacheMode.java
new file mode 100644
index 0000000000..43874acde1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/SharedCacheMode.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.persistence.options;
+
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0;
+
+/**
+ * Context model corresponding to the XML resource model
+ * {@link XmlPersistenceUnitCachingType_2_0},
+ * which corresponds to the <code>shared-cache-mode</code> element in the
+ * <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public enum SharedCacheMode
+{
+ ALL,
+ NONE,
+ ENABLE_SELECTIVE,
+ DISABLE_SELECTIVE,
+ UNSPECIFIED;
+
+
+ public static SharedCacheMode fromXmlResourceModel(XmlPersistenceUnitCachingType_2_0 sharedCacheMode) {
+ if (sharedCacheMode == null) {
+ return null;
+ }
+ switch (sharedCacheMode) {
+ case ALL:
+ return ALL;
+ case NONE:
+ return NONE;
+ case ENABLE_SELECTIVE:
+ return ENABLE_SELECTIVE;
+ case DISABLE_SELECTIVE:
+ return DISABLE_SELECTIVE;
+ case UNSPECIFIED:
+ return UNSPECIFIED;
+ default:
+ throw new IllegalArgumentException("unknown validation mode: " + sharedCacheMode); //$NON-NLS-1$
+ }
+ }
+
+ public static XmlPersistenceUnitCachingType_2_0 toXmlResourceModel(SharedCacheMode sharedCacheMode) {
+ if (sharedCacheMode == null) {
+ return null;
+ }
+ switch (sharedCacheMode) {
+ case ALL:
+ return XmlPersistenceUnitCachingType_2_0.ALL;
+ case NONE:
+ return XmlPersistenceUnitCachingType_2_0.NONE;
+ case ENABLE_SELECTIVE:
+ return XmlPersistenceUnitCachingType_2_0.ENABLE_SELECTIVE;
+ case DISABLE_SELECTIVE:
+ return XmlPersistenceUnitCachingType_2_0.DISABLE_SELECTIVE;
+ case UNSPECIFIED:
+ return XmlPersistenceUnitCachingType_2_0.UNSPECIFIED;
+ default:
+ throw new IllegalArgumentException("unknown shared cache mode: " + sharedCacheMode); //$NON-NLS-1$
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/ValidationMode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/ValidationMode.java
new file mode 100644
index 0000000000..d5e52506db
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/ValidationMode.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.context.persistence.options;
+
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0;
+
+/**
+ * Context model corresponding to the XML resource model
+ * {@link XmlPersistenceUnitValidationModeType_2_0},
+ * which corresponds to the <code>validation-mode</code> element in the
+ * <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public enum ValidationMode
+{
+ AUTO(XmlPersistenceUnitValidationModeType_2_0.AUTO),
+ CALLBACK(XmlPersistenceUnitValidationModeType_2_0.CALLBACK),
+ NONE(XmlPersistenceUnitValidationModeType_2_0.NONE);
+
+ private XmlPersistenceUnitValidationModeType_2_0 xmlEnumValue;
+
+ ValidationMode(XmlPersistenceUnitValidationModeType_2_0 xmlEnumValue) {
+ if (xmlEnumValue == null) {
+ throw new NullPointerException();
+ }
+ this.xmlEnumValue = xmlEnumValue;
+ }
+
+ public XmlPersistenceUnitValidationModeType_2_0 getXmlEnumValue() {
+ return this.xmlEnumValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static ValidationMode fromXmlResourceModel(XmlPersistenceUnitValidationModeType_2_0 xmlValidationMode) {
+ return (xmlValidationMode == null) ? null : fromXmlResourceModel_(xmlValidationMode);
+ }
+
+ private static ValidationMode fromXmlResourceModel_(XmlPersistenceUnitValidationModeType_2_0 xmlValidationMode) {
+ for (ValidationMode validationMode : ValidationMode.values()) {
+ if (validationMode.getXmlEnumValue().equals(xmlValidationMode)) {
+ return validationMode;
+ }
+ }
+ return null;
+ }
+
+ public static XmlPersistenceUnitValidationModeType_2_0 toXmlResourceModel(ValidationMode validationMode) {
+ return (validationMode == null) ? null : validationMode.getXmlEnumValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java
new file mode 100644
index 0000000000..f45dd33bac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.Access
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface Access2_0Annotation
+ extends Annotation
+{
+
+ String ANNOTATION_NAME = JPA2_0.ACCESS;
+
+ /**
+ * Corresponds to the 'value' element of the Access annotation.
+ * Returns null if the element does not exist in Java.
+ */
+ AccessType getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the Access annotation.
+ * Set to null to remove the element.
+ */
+ void setValue(AccessType access);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the Access annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/AssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/AssociationOverride2_0Annotation.java
new file mode 100644
index 0000000000..fde6bd770a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/AssociationOverride2_0Annotation.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.AssociationOverride
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface AssociationOverride2_0Annotation
+ extends AssociationOverrideAnnotation
+{
+
+ /**
+ * Corresponds to the 'joinTable' element of the AssociationOverride annotation.
+ * Return null if the element does not exist in Java.
+ */
+ JoinTableAnnotation getJoinTable();
+ String JOIN_TABLE_PROPERTY = "joinTable"; //$NON-NLS-1$
+
+ JoinTableAnnotation getNonNullJoinTable();
+
+ /**
+ * Add the 'joinTable' element to the AssociationOverride annotation.
+ */
+ JoinTableAnnotation addJoinTable();
+
+ /**
+ * Remove the 'joinTable' element from the AssociationOverride annotation.
+ */
+ void removeJoinTable();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java
new file mode 100644
index 0000000000..3d4a0815e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.Cacheable
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface Cacheable2_0Annotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA2_0.CACHEABLE;
+
+ /**
+ * Corresponds to the 'value' element of the Cacheable annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the Cacheable annotation.
+ * Set to null to remove the element.
+ */
+ void setValue(Boolean value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the Cacheable annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/CollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/CollectionTable2_0Annotation.java
new file mode 100644
index 0000000000..abd7aadf29
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/CollectionTable2_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.ReferenceTableAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.CollectionTable</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface CollectionTable2_0Annotation
+ extends ReferenceTableAnnotation
+{
+ String ANNOTATION_NAME = JPA2_0.COLLECTION_TABLE;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java
new file mode 100644
index 0000000000..38d3120e65
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.jpa.core.resource.java.FetchType;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.ElementCollection
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ElementCollection2_0Annotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA2_0.ELEMENT_COLLECTION;
+
+ /**
+ * Corresponds to the 'targetClass' element of the element collection
+ * annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * &#64;ElementCollection(targetClass=Employee.class)
+ * </pre>
+ * will return "Employee"
+ */
+ String getTargetClass();
+ String TARGET_CLASS_PROPERTY = "targetClass"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'targetClass' element of the element collection
+ * annotation.
+ * Set to null to remove the element.
+ */
+ void setTargetClass(String targetClass);
+
+ /**
+ * Return the {@link TextRange} for the 'targetClass' element. If the element
+ * does not exist return the {@link TextRange} for the element collection annotation.
+ */
+ TextRange getTargetClassTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the fully-qualified target class name as resolved by the AST's
+ * bindings.
+ * <pre>
+ * &#64;ElementCollection(targetClass=Employee.class)
+ * </pre>
+ * will return <code>"model.Employee"</code> if there is an import for
+ * <code>model.Employee</code>.
+ */
+ String getFullyQualifiedTargetClassName();
+
+
+ /**
+ * Corresponds to the 'fetch' element of the element collection annotation.
+ * Return null if the element does not exist in Java.
+ */
+ FetchType getFetch();
+ String FETCH_PROPERTY = "fetch"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'fetch' element of the element collection annotation.
+ * Set to null to remove the element.
+ */
+ void setFetch(FetchType fetch);
+
+ /**
+ * Return the {@link TextRange} for the 'fetch' element. If the element
+ * does not exist return the {@link TextRange} for the element collection annotation.
+ */
+ TextRange getFetchTextRange(CompilationUnit astRoot);
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java
new file mode 100644
index 0000000000..cfcf848ae6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the Java 6 annotation
+ * <code>javax.annotation.Generated</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface GeneratedAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = "javax.annotation.Generated"; // requires JRE 1.6 //$NON-NLS-1$
+ String VALUE_ELEMENT_NAME = "value"; //$NON-NLS-1$
+ String DATE_ELEMENT_NAME = "date"; //$NON-NLS-1$
+ String COMMENTS_ELEMENT_NAME = "comments"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ * Return <code>null</code> if the element does not exist in the annotation.
+ */
+ ListIterator<String> values();
+ String VALUES_LIST = "values"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ int valuesSize();
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ String getValue(int index);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void addValue(String value);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void addValue(int index, String value);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void moveValue(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void removeValue(String value);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void removeValue(int index);
+
+ /**
+ * Corresponds to the <code>date</code> element of the <code>Generated</code>
+ * annotation.
+ * Return <code>null</code> if the element does not exist in the annotation.
+ */
+ String getDate();
+ String DATE_PROPERTY = "date"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>date</code> element of the <code>Generated</code>
+ * annotation.
+ * Set to <code>null</code> to remove the element.
+ */
+ void setDate(String date);
+
+ /**
+ * Corresponds to the <code>comments</code> element of the <code>Generated</code>
+ * annotation.
+ * Return <code>null</code> if the element does not exist in the annotation.
+ */
+ String getComments();
+ String COMMENTS_PROPERTY = "comments"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>comments</code> element of the <code>Generated</code>
+ * annotation.
+ * Set to <code>null</code> to remove the element.
+ */
+ void setComments(String comments);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JPA2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JPA2_0.java
new file mode 100644
index 0000000000..5216c538a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JPA2_0.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
+
+/**
+ * JPA 2.0 Java-related stuff (annotations etc.)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+@SuppressWarnings("nls")
+public interface JPA2_0
+{
+ // JPA package
+ String PACKAGE = "javax.persistence";
+ String PACKAGE_ = PACKAGE + '.';
+
+
+ // ********** API **********
+
+ // JPA 2.0 annotations
+ String ACCESS = PACKAGE_ + "Access";
+ String ACCESS__VALUE = "value";
+
+ // ASSOCIATION_OVERRIDE
+ String ASSOCIATION_OVERRIDE__JOIN_TABLE = "joinTable";
+
+ String CACHEABLE = PACKAGE_ + "Cacheable";
+ String CACHEABLE__VALUE = "value";
+
+ String CASCADE_TYPE__DETACH = JPA.CASCADE_TYPE_ + "DETACH";
+
+ String COLLECTION_TABLE = PACKAGE_ + "CollectionTable";
+ String COLLECTION_TABLE__NAME = "name";
+ String COLLECTION_TABLE__SCHEMA = "schema";
+ String COLLECTION_TABLE__CATALOG = "catalog";
+ String COLLECTION_TABLE__JOIN_COLUMNS = "joinColumns";
+ String COLLECTION_TABLE__UNIQUE_CONSTRAINTS = "uniqueConstraints";
+
+ String ELEMENT_COLLECTION = PACKAGE_ + "ElementCollection";
+ String ELEMENT_COLLECTION__FETCH = "fetch";
+ String ELEMENT_COLLECTION__TARGET_CLASS = "targetClass";
+
+ String MAP_KEY_CLASS = PACKAGE_ + "MapKeyClass";
+ String MAP_KEY_CLASS__VALUE = "value";
+
+ String MAP_KEY_COLUMN = PACKAGE_ + "MapKeyColumn";
+ String MAP_KEY_COLUMN__NAME = "name";
+ String MAP_KEY_COLUMN__UNIQUE = "unique";
+ String MAP_KEY_COLUMN__NULLABLE = "nullable";
+ String MAP_KEY_COLUMN__INSERTABLE = "insertable";
+ String MAP_KEY_COLUMN__UPDATABLE = "updatable";
+ String MAP_KEY_COLUMN__COLUMN_DEFINITION = "columnDefinition";
+ String MAP_KEY_COLUMN__TABLE = "table";
+ String MAP_KEY_COLUMN__LENGTH = "length";
+ String MAP_KEY_COLUMN__PRECISION = "precision";
+ String MAP_KEY_COLUMN__SCALE = "scale";
+
+ String MAP_KEY_ENUMERATED = PACKAGE_ + "MapKeyEnumerated";
+ String MAP_KEY_ENUMERATED__VALUE = "value";
+
+ String MAP_KEY_JOIN_COLUMN = PACKAGE_ + "MapKeyJoinColumn";
+ String MAP_KEY_JOIN_COLUMN__NAME = "name";
+ String MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = "referencedColumnName";
+ String MAP_KEY_JOIN_COLUMN__UNIQUE = "unique";
+ String MAP_KEY_JOIN_COLUMN__NULLABLE = "nullable";
+ String MAP_KEY_JOIN_COLUMN__INSERTABLE = "insertable";
+ String MAP_KEY_JOIN_COLUMN__UPDATABLE = "updatable";
+ String MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION = "columnDefinition";
+ String MAP_KEY_JOIN_COLUMN__TABLE = "table";
+
+ String MAP_KEY_JOIN_COLUMNS = PACKAGE_ + "MapKeyJoinColumns";
+ String MAP_KEY_JOIN_COLUMNS__VALUE = "value";
+
+ String MAP_KEY_TEMPORAL = PACKAGE_ + "MapKeyTemporal";
+ String MAP_KEY_TEMPORAL__VALUE = "value";
+
+ String MAPS_ID = PACKAGE_ + "MapsId";
+ String MAPS_ID__VALUE = "value";
+
+ // NAMED_QUERY
+ String NAMED_QUERY__LOCK_MODE = "lockMode";
+
+ // ONE_TO_MANY
+ String ONE_TO_MANY__ORPHAN_REMOVAL = "orphanRemoval";
+
+ // ONE_TO_ONE
+ String ONE_TO_ONE__ORPHAN_REMOVAL = "orphanRemoval";
+
+ String ORDER_COLUMN = PACKAGE_ + "OrderColumn";
+ String ORDER_COLUMN__NAME = "name";
+ String ORDER_COLUMN__NULLABLE = "nullable";
+ String ORDER_COLUMN__INSERTABLE = "insertable";
+ String ORDER_COLUMN__UPDATABLE = "updatable";
+ String ORDER_COLUMN__COLUMN_DEFINITION = "columnDefinition";
+
+ // SEQUENCE_GENERATOR
+ String SEQUENCE_GENERATOR__CATALOG = "catalog";
+ String SEQUENCE_GENERATOR__SCHEMA = "schema";
+
+
+ // JPA 2.0 enums
+ String ACCESS_TYPE = PACKAGE_ + "AccessType";
+ String ACCESS_TYPE_ = ACCESS_TYPE + '.';
+ String ACCESS_TYPE__FIELD = ACCESS_TYPE_ + "FIELD";
+ String ACCESS_TYPE__PROPERTY = ACCESS_TYPE_ + "PROPERTY";
+
+ String LOCK_MODE_TYPE = PACKAGE_ + "LockModeType";
+ String LOCK_MODE_TYPE_ = LOCK_MODE_TYPE + '.';
+ String LOCK_MODE_TYPE__READ = LOCK_MODE_TYPE_ + "READ";
+ String LOCK_MODE_TYPE__WRITE = LOCK_MODE_TYPE_ + "WRITE";
+ String LOCK_MODE_TYPE__OPTIMISTIC = LOCK_MODE_TYPE_ + "OPTIMISTIC";
+ String LOCK_MODE_TYPE__OPTIMISTIC_FORCE_INCREMENT = LOCK_MODE_TYPE_ + "OPTIMISTIC_FORCE_INCREMENT";
+ String LOCK_MODE_TYPE__PESSIMISTIC_READ = LOCK_MODE_TYPE_ + "PESSIMISTIC_READ";
+ String LOCK_MODE_TYPE__PESSIMISTIC_WRITE = LOCK_MODE_TYPE_ + "PESSIMISTIC_WRITE";
+ String LOCK_MODE_TYPE__PESSIMISTIC_FORCE_INCREMENT = LOCK_MODE_TYPE_ + "PESSIMISTIC_FORCE_INCREMENT";
+ String LOCK_MODE_TYPE__NONE = LOCK_MODE_TYPE_ + "NONE";
+
+ // JPA 2.0 metamodel
+ String METAMODEL_PACKAGE = PACKAGE_ + "metamodel";
+ String METAMODEL_PACKAGE_ = METAMODEL_PACKAGE + '.';
+
+ String STATIC_METAMODEL = METAMODEL_PACKAGE_ + "StaticMetamodel";
+ String STATIC_METAMODEL__VALUE = "value";
+
+ String SINGULAR_ATTRIBUTE = METAMODEL_PACKAGE_ + "SingularAttribute";
+
+ String COLLECTION_ATTRIBUTE = METAMODEL_PACKAGE_ + "CollectionAttribute";
+ String LIST_ATTRIBUTE = METAMODEL_PACKAGE_ + "ListAttribute";
+ String MAP_ATTRIBUTE = METAMODEL_PACKAGE_ + "MapAttribute";
+ String SET_ATTRIBUTE = METAMODEL_PACKAGE_ + "SetAttribute";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java
new file mode 100644
index 0000000000..d8c9d2bc40
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.SimpleFilter;
+import org.eclipse.jpt.jpa.core.resource.java.AccessType;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * JPA 2.0 Java source code or binary persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface JavaResourcePersistentType2_0
+ extends JavaResourcePersistentType
+{
+
+ // ********** metamodel **********
+
+ /**
+ * Return the <code>javax.annotation.Generated</code> annotation.
+ */
+ GeneratedAnnotation getGeneratedAnnotation();
+
+ /**
+ * Return whether the type is a metamodel top-level type generated in the
+ * specified source folder.
+ */
+ boolean isGeneratedMetamodelTopLevelType(IPackageFragmentRoot sourceFolder);
+
+ /**
+ * Return whether the type is a generated metamodel top-level type.
+ * The type is generated and either it or one of its nested types is a
+ * metamodel type.
+ */
+ boolean isGeneratedMetamodelTopLevelType();
+
+ /**
+ * Return whether the type is a metamodel type.
+ */
+ boolean isMetamodel();
+
+ /**
+ * The value used to tag a generated type:
+ * <pre>
+ * &#64;javax.annotation.Generated(value="Dali", date="2009-11-23T13:56:06.171-0500")
+ * </pre>
+ */
+ String METAMODEL_GENERATED_ANNOTATION_VALUE = "Dali"; //$NON-NLS-1$
+
+
+ // ********** access type filters **********
+
+ Filter<JavaResourcePersistentAttribute> PROPERTY_ACCESS_TYPE_FILTER = new AccessTypeFilter(AccessType.PROPERTY);
+ Filter<JavaResourcePersistentAttribute> FIELD_ACCESS_TYPE_FILTER = new AccessTypeFilter(AccessType.FIELD);
+
+ class AccessTypeFilter
+ extends SimpleFilter<JavaResourcePersistentAttribute, AccessType>
+ {
+ AccessTypeFilter(AccessType accessType) {
+ super(accessType);
+ }
+ @Override
+ public boolean accept(JavaResourcePersistentAttribute resourceAttribute) {
+ return resourceAttribute.getSpecifiedAccess() == this.criterion;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/LockModeType_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/LockModeType_2_0.java
new file mode 100644
index 0000000000..e2afe0bfa8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/LockModeType_2_0.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+
+/**
+ * Corresponds to the JPA 2.0 enum
+ * javax.persistence.LockModeType
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public enum LockModeType_2_0 {
+
+ READ(JPA2_0.LOCK_MODE_TYPE__READ),
+ WRITE(JPA2_0.LOCK_MODE_TYPE__WRITE),
+ OPTIMISTIC(JPA2_0.LOCK_MODE_TYPE__OPTIMISTIC),
+ OPTIMISTIC_FORCE_INCREMENT(JPA2_0.LOCK_MODE_TYPE__OPTIMISTIC_FORCE_INCREMENT),
+ PESSIMISTIC_READ(JPA2_0.LOCK_MODE_TYPE__PESSIMISTIC_READ),
+ PESSIMISTIC_WRITE(JPA2_0.LOCK_MODE_TYPE__PESSIMISTIC_WRITE),
+ PESSIMISTIC_FORCE_INCREMENT(JPA2_0.LOCK_MODE_TYPE__PESSIMISTIC_FORCE_INCREMENT),
+ NONE(JPA2_0.LOCK_MODE_TYPE__NONE);
+
+
+ private String javaAnnotationValue;
+
+ LockModeType_2_0(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static LockModeType_2_0 fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static LockModeType_2_0 fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (LockModeType_2_0 lockModeType : LockModeType_2_0.values()) {
+ if (lockModeType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return lockModeType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(LockModeType_2_0 lockModeType) {
+ return (lockModeType == null) ? null : lockModeType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToMany2_0Annotation.java
new file mode 100644
index 0000000000..218f9ec1b2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToMany2_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+* Copyright (c) 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.ManyToMany</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ManyToMany2_0Annotation
+ extends ManyToManyAnnotation, RelationshipMapping2_0Annotation
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToOne2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToOne2_0Annotation.java
new file mode 100644
index 0000000000..93bfdb2a3f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToOne2_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+* Copyright (c) 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.ManyToOne</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ManyToOne2_0Annotation
+ extends ManyToOneAnnotation, RelationshipMapping2_0Annotation
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java
new file mode 100644
index 0000000000..376897d3be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.MapKeyClass
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapKeyClass2_0Annotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA2_0.MAP_KEY_CLASS;
+
+ /**
+ * Corresponds to the 'value' element of the MapKeyClass annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * &#64;MapKeyClass(value=Employee.class)
+ * </pre>
+ * will return "Employee"
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the MapKeyClass annotation.
+ * Set to null to remove the element.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the IdClass annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the fully-qualified class name as resolved by the AST's
+ * bindings.
+ * <pre>
+ * &#64;IdClass(Employee.class)
+ * </pre>
+ * will return <code>"model.Employee"</code> if there is an import for
+ * <code>model.Employee</code>.
+ */
+ String getFullyQualifiedClassName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyColumn2_0Annotation.java
new file mode 100644
index 0000000000..5ae12adc69
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyColumn2_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.MapKeyColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapKeyColumn2_0Annotation
+ extends CompleteColumnAnnotation
+{
+ String ANNOTATION_NAME = JPA2_0.MAP_KEY_COLUMN;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyEnumerated2_0Annotation.java
new file mode 100644
index 0000000000..d8b970ab5c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyEnumerated2_0Annotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.MapKeyEnumerated
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapKeyEnumerated2_0Annotation
+ extends EnumeratedAnnotation
+{
+ String ANNOTATION_NAME = JPA2_0.MAP_KEY_ENUMERATED;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumn2_0Annotation.java
new file mode 100644
index 0000000000..fdd2709343
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumn2_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.BaseJoinColumnAnnotation;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.MapKeyJoinColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapKeyJoinColumn2_0Annotation
+ extends BaseJoinColumnAnnotation
+{
+ String ANNOTATION_NAME = JPA2_0.MAP_KEY_JOIN_COLUMN;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java
new file mode 100644
index 0000000000..42cec5430d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.MapKeyJoinColumns
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapKeyJoinColumns2_0Annotation
+ extends ContainerAnnotation<NestableMapKeyJoinColumnAnnotation>
+{
+ String ANNOTATION_NAME = JPA2_0.MAP_KEY_JOIN_COLUMNS;
+
+ String MAP_KEY_JOIN_COLUMNS_LIST = "mapKeyJoinColumns"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyTemporal2_0Annotation.java
new file mode 100644
index 0000000000..89e7fb7e5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyTemporal2_0Annotation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.MapKeyTemporal
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapKeyTemporal2_0Annotation
+ extends TemporalAnnotation
+{
+ String ANNOTATION_NAME = JPA2_0.MAP_KEY_TEMPORAL;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java
new file mode 100644
index 0000000000..07696027f9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.MapsId</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface MapsId2_0Annotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA2_0.MAPS_ID;
+
+ /**
+ * Corresponds to the 'value' element of the MapsId annotation.
+ * Returns null if the element does not exist in Java.
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the MapsId annotation.
+ * Set to null to remove the element.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the MapsId annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'value' element.
+ * Return false if the element does not exist.
+ */
+ boolean valueTouches(int pos, CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NamedQuery2_0Annotation.java
new file mode 100644
index 0000000000..c7ed1cf176
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NamedQuery2_0Annotation.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.NamedQuery</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface NamedQuery2_0Annotation
+ extends NamedQueryAnnotation
+{
+ // ********** lock mode **********
+
+ /**
+ * Corresponds to the 'lockMode' element of the NamedQuery annotation.
+ * Return null if the element does not exist in Java.
+ */
+ LockModeType_2_0 getLockMode();
+ String LOCK_MODE_PROPERTY = "lockMode"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'lockMode' element of the NamedQuery annotation.
+ * Set to null to remove the element.
+ */
+ void setLockMode(LockModeType_2_0 lockMode);
+
+ /**
+ * Return the {@link TextRange} for the 'lockMode' element. If the element
+ * does not exist return the {@link TextRange} for the NamedQuery annotation.
+ */
+ TextRange getLockModeTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'lockMode' element.
+ * Return false if the element does not exist.
+ */
+ boolean lockModeTouches(int pos, CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java
new file mode 100644
index 0000000000..d3686f864a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.MapKeyJoinColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface NestableMapKeyJoinColumnAnnotation
+ extends MapKeyJoinColumn2_0Annotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToMany2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToMany2_0Annotation.java
new file mode 100644
index 0000000000..2fb6ea7910
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToMany2_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.OneToMany</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OneToMany2_0Annotation
+ extends OneToManyAnnotation, OwningRelationshipMapping2_0Annotation, RelationshipMapping2_0Annotation
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToOne2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToOne2_0Annotation.java
new file mode 100644
index 0000000000..e83be901a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToOne2_0Annotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.OneToOne</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OneToOne2_0Annotation
+ extends OneToOneAnnotation, OwningRelationshipMapping2_0Annotation, RelationshipMapping2_0Annotation
+{
+ // combine various interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OrderColumn2_0Annotation.java
new file mode 100644
index 0000000000..8b7a28ea16
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OrderColumn2_0Annotation.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.OrderColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OrderColumn2_0Annotation
+ extends NamedColumnAnnotation
+{
+ String ANNOTATION_NAME = JPA2_0.ORDER_COLUMN;
+
+
+ // ********** nullable **********
+
+ /**
+ * Corresponds to the 'nullable' element of the OrderColumn annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getNullable();
+ String NULLABLE_PROPERTY = "nullable"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'nullable' element of the OrderColumn annotation.
+ * Set to null to remove the element.
+ */
+ void setNullable(Boolean nullable);
+
+ /**
+ * Return the {@link TextRange} for the 'nullable' element. If the element
+ * does not exist return the {@link TextRange} for the OrderColumn annotation.
+ */
+ TextRange getNullableTextRange(CompilationUnit astRoot);
+
+
+ // ********** insertable **********
+
+ /**
+ * Corresponds to the 'insertable' element of the OrderColumn annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getInsertable();
+ String INSERTABLE_PROPERTY = "insertable"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'insertable' element of the OrderColumn annotation.
+ * Set to null to remove the element.
+ */
+ void setInsertable(Boolean insertable);
+
+ /**
+ * Return the {@link TextRange} for the 'insertable' element. If the element
+ * does not exist return the {@link TextRange} for the OrderColumn annotation.
+ */
+ TextRange getInsertableTextRange(CompilationUnit astRoot);
+
+
+ // ********** updatable **********
+
+ /**
+ * Corresponds to the 'updatable' element of the OrderColumn annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getUpdatable();
+ String UPDATABLE_PROPERTY = "updatable"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'updatable' element of the OrderColumn annotation.
+ * Set to null to remove the element.
+ */
+ void setUpdatable(Boolean updatable);
+
+ /**
+ * Return the {@link TextRange} for the 'updatable' element. If the element
+ * does not exist return the {@link TextRange} for the OrderColumn annotation.
+ */
+ TextRange getUpdatableTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OwningRelationshipMapping2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OwningRelationshipMapping2_0Annotation.java
new file mode 100644
index 0000000000..18e2cc6381
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OwningRelationshipMapping2_0Annotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Represents a relationship mapping annotation that may have the
+ * <code>orphanRemoval</code> element:<ul>
+ * <li><code>javax.persistence.OneToMany</code>
+ * <li><code>javax.persistence.OneToOne</code>
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface OwningRelationshipMapping2_0Annotation
+{
+ // ********** orphan removal **********
+ /**
+ * Corresponds to the orphanRemoval element of a OneToMany or OneToOne annotation.
+ * Returns null if the orphanRemoval element does not exist in java.
+ */
+ Boolean getOrphanRemoval();
+ String ORPHAN_REMOVAL_PROPERTY = "orphanRemoval"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the orphanRemoval element of a OneToMany or OneToOne annotation.
+ * Set to null to remove the orphanRemoval element.
+ */
+ void setOrphanRemoval(Boolean orphanRemoval);
+
+ /**
+ * Return the {@link TextRange} for the orphanRemoval element. If the orphanRemoval element
+ * does not exist return the {@link TextRange} for the OneToMany or OneToOne annotation.
+ */
+ TextRange getOrphanRemovalTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/RelationshipMapping2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/RelationshipMapping2_0Annotation.java
new file mode 100644
index 0000000000..073025162c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/RelationshipMapping2_0Annotation.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
+
+/**
+ * Common protocol among the following JPA 2.0 relationship mappings:<ul>
+ * <li><code>javax.persistence.ManyToOne</code>
+ * <li><code>javax.persistence.ManyToMany</code>
+ * <li><code>javax.persistence.OneToMany</code>
+ * <li><code>javax.persistence.OneToOne</code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface RelationshipMapping2_0Annotation
+ extends RelationshipMappingAnnotation
+{
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ boolean isCascadeDetach();
+ String CASCADE_DETACH_PROPERTY = "cascadeDetach"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ void setCascadeDetach(boolean detach);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/SequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/SequenceGenerator2_0Annotation.java
new file mode 100644
index 0000000000..4c3b3c902e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/SequenceGenerator2_0Annotation.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * javax.persistence.SequenceGenerator
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface SequenceGenerator2_0Annotation
+ extends SequenceGeneratorAnnotation
+{
+ // ********** catalog **********
+ /**
+ * Corresponds to the 'catalog' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getCatalog();
+ String CATALOG_PROPERTY = "catalog"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'catalog' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setCatalog(String catalog);
+
+ /**
+ * Return the {@link TextRange} for the 'catalog' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getCatalogTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'catalog' element.
+ * Return false if the element does not exist.
+ */
+ boolean catalogTouches(int pos, CompilationUnit astRoot);
+
+
+ // ********** schema **********
+
+ /**
+ * Corresponds to the 'schema' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getSchema();
+ String SCHEMA_PROPERTY = "schema"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'schema' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setSchema(String schema);
+
+ /**
+ * Return the {@link TextRange} for the 'schema' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getSchemaTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'schema' element.
+ * Return false if the element does not exist.
+ */
+ boolean schemaTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java
new file mode 100644
index 0000000000..97aecfd168
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpa2.resource.java;
+
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.metamodel.StaticMetamodel</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface StaticMetamodelAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA2_0.STATIC_METAMODEL;
+
+ /**
+ * Corresponds to the <code>value</code> element of the <code>StaticMetamodel</code> annotation.
+ * Return <code>null</code> if the element does not exist in Java.
+ * Return the portion of the value preceding <code>".class"</code>.
+ * <pre>
+ * &#64;StaticMetamodel(value=Employee.class)
+ * </pre>
+ * will return <code>"Employee"</code>.
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>value</code> element of the <code>StaticMetamodel</code> annotation.
+ * Set to <code>null</code> to remove the element.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the static metamodel's fully-qualified class name as resolved by
+ * the AST's bindings.
+ * <pre>
+ * &#64;StaticMetamodel(Employee.class)
+ * </pre>
+ * will return <code>"model.Employee"</code> if there is an import for
+ * <code>model.Employee</code>.
+ */
+ String getFullyQualifiedClassName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/libprov/JpaLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/libprov/JpaLibraryProviderInstallOperationConfig.java
new file mode 100644
index 0000000000..2607704330
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/libprov/JpaLibraryProviderInstallOperationConfig.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.libprov;
+
+import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+
+
+public interface JpaLibraryProviderInstallOperationConfig
+ extends JptLibraryProviderInstallOperationConfig {
+
+ public static final String PROP_JPA_PLATFORM = "JPA_PLATFORM"; //$NON-NLS-1$
+
+ JpaPlatformDescription getJpaPlatform();
+
+ void setJpaPlatform(JpaPlatformDescription jpaPlatform);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java
new file mode 100644
index 0000000000..35738d1dd8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.platform;
+
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+
+/**
+ * Constants pertaining to the Generic JPA platforms and their group.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public class GenericPlatform {
+
+ public static final JpaPlatformGroupDescription GROUP
+ = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatformGroup("generic"); //$NON-NLS-1$
+
+ public static final JpaPlatformDescription VERSION_1_0
+ = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("generic"); //$NON-NLS-1$
+
+ public static final JpaPlatformDescription VERSION_2_0
+ = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("generic2_0"); //$NON-NLS-1$
+
+ /**
+ * Not for instantiation
+ */
+ private GenericPlatform() {}
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java
new file mode 100644
index 0000000000..f695f5a549
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.platform;
+
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * Contains metadata that describes a JPA platform. Not intended to be implemented by clients.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JpaPlatformDescription {
+
+ public String getId();
+
+ public String getPluginId();
+
+ public String getLabel();
+
+ public String getFactoryClassName();
+
+ public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion);
+
+ public boolean isDefault();
+
+ public JpaPlatformGroupDescription getGroup();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java
new file mode 100644
index 0000000000..2da2975284
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.platform;
+
+/**
+ * Contains metadata that describes a JPA platform group. Not intended to be implemented by clients.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JpaPlatformGroupDescription {
+
+ public String getId();
+
+ public String getPluginId();
+
+ public String getLabel();
+
+ public Iterable<JpaPlatformDescription> getPlatforms();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java
new file mode 100644
index 0000000000..9e510e6295
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.platform;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * Entry point to the "jpaPlatforms" extension point
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JpaPlatformManager {
+
+ Iterable<JpaPlatformGroupDescription> getJpaPlatformGroups();
+
+ JpaPlatformGroupDescription getJpaPlatformGroup(String groupId);
+
+ Iterable<JpaPlatformDescription> getJpaPlatforms();
+
+ JpaPlatformDescription getJpaPlatform(String platformId);
+
+ /**
+ * Returns the first JPA platform registered as a default platform and which supports the given
+ * JPA facet version.
+ * Returns null if there are no such registered platforms.
+ */
+ JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion);
+
+ JpaPlatform buildJpaPlatformImplementation(IProject project);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java
new file mode 100644
index 0000000000..b6dd391075
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java
@@ -0,0 +1,386 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.jem.util.emf.workbench.EMFWorkbenchContextBase;
+import org.eclipse.jem.util.emf.workbench.FlexibleProjectResourceSet;
+import org.eclipse.jem.util.emf.workbench.IEMFContextContributor;
+import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.utility.internal.ListenerList;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateInputProvider;
+import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidator;
+import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorImpl;
+import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public abstract class AbstractXmlResourceProvider
+ implements JpaXmlResourceProvider, IEMFContextContributor, ResourceStateInputProvider, ResourceStateValidator
+{
+ protected IProject project;
+
+ protected URI fileUri;
+
+ protected JpaXmlResource resource;
+
+ protected IContentType contentType;
+
+ protected final ResourceAdapter resourceAdapter = new ResourceAdapter();
+
+ protected final ListenerList<JpaXmlResourceProviderListener> listenerList = new ListenerList<JpaXmlResourceProviderListener>(JpaXmlResourceProviderListener.class);
+
+ protected ResourceStateValidator stateValidator;
+
+
+ /**
+ * Create a new AbstractResourceModelProvider for the given project and
+ * resourcePath. The resourcePath may be either
+ * a) an absolute workspace-relative platform resource path (e.g. "/MyProject/src/META-INF/foobar.xml")
+ * or b) a relative runtime path (e.g. "META-INF/foobar.xml".)
+ * In either case, {@link #buildFileUri(IPath)} will attempt to build an absolutely pathed
+ * URI for the given path.
+ */
+ public AbstractXmlResourceProvider(IProject project, IPath resourcePath, IContentType contentType) {
+ super();
+ this.project = project;
+ this.fileUri = buildFileUri(resourcePath);
+ this.contentType = contentType;
+ }
+
+ protected URI buildFileUri(IPath resourcePath) {
+ URI resourceUri = null;
+
+ if (resourcePath.isAbsolute()) {
+ resourceUri = URI.createPlatformResourceURI(resourcePath.toString(), false);
+ }
+ else {
+ IPath absolutePath =
+ JptCommonCorePlugin.getResourceLocator(this.project).getResourcePath(this.project, resourcePath);
+ resourceUri = URI.createPlatformResourceURI(absolutePath.toString(), false);
+ }
+
+ URIConverter uriConverter = getResourceSet().getURIConverter();
+ return uriConverter.normalize(resourceUri);
+ }
+
+ /**
+ * Return the resource, if it exists. If no file exists for this resource,
+ * this will return a stub resource. You must call #createResource() to
+ * create the file on the file system.
+ */
+ public JpaXmlResource getXmlResource() {
+ if (this.resource == null) {
+ JpaXmlResource newResource = (JpaXmlResource) WorkbenchResourceHelper.getOrCreateResource(this.fileUri, getResourceSet());
+ //EMF caches resources based on URI. If the resource has changed content types (say the schema was changed
+ //from orm to eclipselink-orm), then the resource will be of the wrong type and we need to create a new one.
+ if (newResource.getContentType().equals(this.contentType)) {
+ this.resource = newResource;
+ }
+ else {
+ this.createResourceAndLoad();
+ }
+ }
+ return this.resource;
+ }
+
+ protected JpaXmlResource createResourceAndLoad() {
+ this.resource = createResource();
+ this.loadResource();
+ return this.resource;
+ }
+
+ protected JpaXmlResource createResource() {
+ Resource.Factory resourceFactory =
+ WTPResourceFactoryRegistry.INSTANCE.getFactory(this.fileUri, this.contentType.getDefaultDescription());
+ return (JpaXmlResource) getResourceSet().createResource(this.fileUri, resourceFactory);
+ }
+
+ protected void loadResource() {
+ try {
+ this.resource.load(((ProjectResourceSet) getResourceSet()).getLoadOptions());
+ }
+ catch (IOException e) {
+ JptJpaCorePlugin.log(e);
+ }
+ }
+
+ protected void createResourceAndUnderlyingFile(Object config) {
+ this.resource = createResource();
+ if (this.resource.fileExists()) { //always possible that the file already exists when the jpa facet is added
+ loadResource();
+ }
+ else {
+ populateRoot(config);
+ try {
+ this.resource.saveIfNecessary(); //this writes out the file
+ }
+ catch (Exception e) {
+ JptJpaCorePlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * This will actually create the underlying file and the JpaXmlResource that corresponds to it.
+ * It also populates the root of the file.
+ * @param config - A configuration object used to specify options for creation of the resource
+ */
+ public JpaXmlResource createFileAndResource(final Object config, IProgressMonitor monitor) throws CoreException {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) {
+ createResourceAndUnderlyingFile(config);
+ }
+ };
+ workspace.run(runnable, this.project, IWorkspace.AVOID_UPDATE, monitor);
+ return this.resource;
+ }
+
+ /**
+ * Used to optionally fill in the root information of a resource if it does not
+ * exist as a file
+ */
+ protected void populateRoot(Object config) {
+ //TODO potentially call resource.populateRoot() instead of the resourceProvider doing this
+ }
+
+
+ /**
+ * minimize the scope of the suppressed warnings
+ */
+ protected EList<EObject> getResourceContents() {
+ return this.resource.getContents();
+ }
+
+ public void addListener(JpaXmlResourceProviderListener listener) {
+ if (this.listenerList.isEmpty()) {
+ engageResource();
+ }
+ this.listenerList.add(listener);
+ }
+
+ public void removeListener(JpaXmlResourceProviderListener listener) {
+ this.listenerList.remove(listener);
+ if (this.listenerList.isEmpty()) {
+ disengageResource();
+ }
+ }
+
+ private void engageResource() {
+ if (this.resource != null) {
+ this.resource.eAdapters().add(this.resourceAdapter);
+ }
+ }
+
+ private void disengageResource() {
+ if (this.resource != null) {
+ this.resource.eAdapters().remove(this.resourceAdapter);
+ }
+ }
+
+ protected FlexibleProjectResourceSet getResourceSet() {
+ return (FlexibleProjectResourceSet) getEmfContext().getResourceSet();
+ }
+
+ protected EMFWorkbenchContextBase getEmfContext() {
+ return WorkbenchResourceHelper.createEMFContext(this.project, this);
+ }
+
+ public IProject getProject() {
+ return this.project;
+ }
+
+ protected void resourceIsLoadedChanged(Resource aResource, boolean oldValue, boolean newValue) {
+ if ( ! this.listenerList.isEmpty()) {
+ int eventType= newValue ? JpaXmlResourceProviderEvent.RESOURCE_LOADED : JpaXmlResourceProviderEvent.RESOURCE_UNLOADED;
+ JpaXmlResourceProviderEvent evt = new JpaXmlResourceProviderEvent(this, eventType);
+ notifyListeners(evt);
+ }
+ }
+
+ protected void notifyListeners(JpaXmlResourceProviderEvent event) {
+ NotifyRunner notifier = new NotifyRunner(event);
+ for (JpaXmlResourceProviderListener listener : this.listenerList.getListeners()) {
+ notifier.setListener(listener);
+ SafeRunner.run(notifier);
+ }
+ }
+
+ public IStatus validateEdit(Object context) {
+ IWorkspace work = ResourcesPlugin.getWorkspace();
+ IFile file = WorkbenchResourceHelper.getFile(this.resource);
+ if (file != null) {
+ IFile[] files = { file };
+ if (context == null) {
+ context = IWorkspace.VALIDATE_PROMPT;
+ }
+ return work.validateEdit(files, context);
+ }
+ return Status.OK_STATUS;
+ }
+
+
+ // **************** IEMFContextContributor impl ***************************
+
+ private boolean contributedToEmfContext = false;
+
+ public void primaryContributeToContext(EMFWorkbenchContextBase context) {
+ if (! this.contributedToEmfContext) {
+ context.getResourceSet().setResourceFactoryRegistry(WTPResourceFactoryRegistry.INSTANCE);
+ this.contributedToEmfContext = true;
+ }
+ }
+
+ public void secondaryContributeToContext(EMFWorkbenchContextBase aNature) {
+ // no op
+ }
+
+
+ // **************** ResourceStateValidator impl ****************************
+
+ public ResourceStateValidator getStateValidator() {
+ if (this.stateValidator == null) {
+ this.stateValidator = createStateValidator();
+ }
+ return this.stateValidator;
+ }
+
+ private ResourceStateValidator createStateValidator() {
+ return new ResourceStateValidatorImpl(this);
+ }
+
+ public void checkActivation(ResourceStateValidatorPresenter presenter) throws CoreException {
+ getStateValidator().checkActivation(presenter);
+ }
+
+ public void lostActivation(ResourceStateValidatorPresenter presenter) throws CoreException {
+ getStateValidator().lostActivation(presenter);
+ }
+
+ public IStatus validateState(ResourceStateValidatorPresenter presenter) throws CoreException {
+ if (presenter == null) {
+ return Status.OK_STATUS;
+ }
+ return getStateValidator().validateState(presenter);
+ }
+
+ public boolean checkSave(ResourceStateValidatorPresenter presenter) throws CoreException {
+ return getStateValidator().checkSave(presenter);
+ }
+
+ public boolean checkReadOnly() {
+ return getStateValidator().checkReadOnly();
+ }
+
+
+ // **************** ResourceStateInputProvider impl ************************
+
+ public boolean isDirty() {
+ return this.resource.isModified();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getNonResourceFiles() {
+ return Collections.emptyList();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getNonResourceInconsistentFiles() {
+ return Collections.emptyList();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getResources() {
+ return Collections.singletonList(getXmlResource());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void cacheNonResourceValidateState(List roNonResourceFiles) {
+ // do nothing
+ }
+
+
+ // **************** member classes *****************************************
+
+ protected class ResourceAdapter extends AdapterImpl {
+ @Override
+ public void notifyChanged(Notification notification) {
+ if ( notification.getEventType() == Notification.SET && notification.getFeatureID(null) == Resource.RESOURCE__IS_LOADED) {
+ resourceIsLoadedChanged((Resource) notification.getNotifier(), notification.getOldBooleanValue(), notification.getNewBooleanValue());
+ }
+ }
+ }
+
+
+ public static class NotifyRunner implements ISafeRunnable
+ {
+ private final JpaXmlResourceProviderEvent event;
+
+ private JpaXmlResourceProviderListener listener;
+
+
+ public NotifyRunner(JpaXmlResourceProviderEvent event) {
+ Assert.isNotNull(event);
+ this.event = event;
+ }
+
+
+ public void setListener(JpaXmlResourceProviderListener listener) {
+ this.listener = listener;
+ }
+
+ public void run() throws Exception {
+ if (listener != null) {
+ listener.modelChanged(event);
+ }
+ }
+
+ public void handleException(Throwable exception) {
+ JptJpaCorePlugin.log(exception);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java
new file mode 100644
index 0000000000..5862c01b9a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JpaXmlResourceProvider
+{
+ JpaXmlResource getXmlResource();
+
+ IStatus validateEdit(Object context);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderEvent.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderEvent.java
new file mode 100644
index 0000000000..611e153684
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderEvent.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public class JpaXmlResourceProviderEvent
+{
+ public final static int RESOURCE_LOADED = 0x1;
+
+ public final static int RESOURCE_UNLOADED = 0x2;
+
+
+ private JpaXmlResourceProvider modelProvider;
+
+ private int type;
+
+
+ public JpaXmlResourceProviderEvent(JpaXmlResourceProvider modelProvider, int eventType) {
+ super();
+ this.modelProvider = modelProvider;
+ this.type = eventType;
+ }
+
+
+ public JpaXmlResourceProvider getModelProvider() {
+ return modelProvider;
+ }
+
+ public int getType() {
+ return type;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderListener.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderListener.java
new file mode 100644
index 0000000000..44977f2105
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderListener.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource;
+
+import java.util.EventListener;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JpaXmlResourceProviderListener
+ extends EventListener
+{
+ public void modelChanged(JpaXmlResourceProviderEvent event);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AccessType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AccessType.java
new file mode 100644
index 0000000000..62b8e502dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AccessType.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+
+/**
+ * Corresponds to the JPA 2.0 enum
+ * javax.persistence.AccessType
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+// TODO move to jpa2 package? currently intertwined with 1.0 code...
+public enum AccessType {
+
+ FIELD(JPA2_0.ACCESS_TYPE__FIELD),
+ PROPERTY(JPA2_0.ACCESS_TYPE__PROPERTY);
+
+
+ private String javaAnnotationValue;
+
+ AccessType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static AccessType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static AccessType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (AccessType accessType : AccessType.values()) {
+ if (accessType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return accessType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(AccessType accessType) {
+ return (accessType == null) ? null : accessType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java
new file mode 100644
index 0000000000..dd56903ef3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.Map;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+/**
+ * Common Java resource annotation behavior
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface Annotation
+ extends JavaResourceNode
+{
+ /**
+ * Return the annotation's fully qualified name, as opposed to the value of
+ * the annotation's <code>name</code> element. For example:<pre>
+ * &#64;com.foo.Bar(name="Thomas")
+ * </pre>
+ * <code>#getAnnotationName()</code> will return <code>"com.foo.Bar"</code>.
+ * In typical subclasses, <code>#getName()</code> would return
+ * <code>"Thomas"</code>.
+ *
+ * @see JPA
+ */
+ String getAnnotationName();
+
+ /**
+ * Return the corresponding JDT DOM annotation from the specified
+ * AST compilation unit.
+ */
+ org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot);
+
+ /**
+ * Create and add the corresponding Java annotation to the JDT DOM.
+ */
+ void newAnnotation();
+
+ /**
+ * Remove the corresponding Java annotation from the JDT DOM.
+ */
+ void removeAnnotation();
+
+ /**
+ * Return whether all the annotation's member values are <code>null</code>;
+ * implying the annotation can be removed if it has no semantic value as a
+ * marker annotation.
+ */
+ boolean isUnset();
+
+ /**
+ * Store the annotation's state in the specified map, recursing into nested
+ * annotations. Once the state is stored, clear it.
+ * <p>
+ * This is used to save an annotation's state when it is converted from
+ * stand-alone to nested (and vice versa).
+ * During tests, and possibly at other times (albeit
+ * asynchronously), the annotation's state is cleared out when the new
+ * annotation is written to the Java source file; since this will trigger
+ * a Java change event and the annotation will be sync'ed with the, now
+ * empty, Java source code annotation.
+ *
+ * @see #restoreFrom(Map)
+ */
+ // TODO this can probably be removed if we move to "combination" annotation adapters...
+ void storeOn(Map<String, Object> map);
+
+ /**
+ * Restore the annotation's state from the specified map, recursing into nested
+ * annotations.
+ *
+ * @see #storeOn(Map)
+ */
+ // TODO this can probably be removed if we move to "combination" annotation adapters...
+ void restoreFrom(Map<String, Object> map);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java
new file mode 100644
index 0000000000..20f9997aae
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+/**
+ * Common behavior for all annotation "containers".
+ * This interface is used mainly in
+ * {@link org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools}.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface AnnotationContainer<T extends NestableAnnotation>
+{
+ /**
+ * Return the corresponding JDT DOM annotation from the specified
+ * AST compilation unit. Used as a starting point when traversing the AST.
+ */
+ org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot);
+
+ /**
+ * Return the name of the container annotation's element that is used
+ * to indicate the nested annotations (typically <code>"value"</code>).
+ * Used when traversing the AST.
+ */
+ String getElementName();
+
+ /**
+ * Return the name of the nested annotations held by the container.
+ * Used when traversing the AST.
+ */
+ String getNestedAnnotationName();
+
+ /**
+ * Return the nested annotations held by the container.
+ */
+ Iterable<T> getNestedAnnotations();
+
+ /**
+ * Return the number of nested annotations held by the container.
+ */
+ int getNestedAnnotationsSize();
+
+ /**
+ * Add a nested annotation to the container
+ * without firing change notification.
+ */
+ T addNestedAnnotation();
+
+ /**
+ * The specified JDT DOM annotation was added to the JDT DOM annotation
+ * corresponding to the container. Add a corresponding nested annotation
+ * to the container and notify interested parties.
+ */
+ void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation);
+
+ /**
+ * Move the nested annotation at the specified source index in the
+ * container to the specified target index without firing change notification.
+ * Return the moved nested annotation.
+ */
+ T moveNestedAnnotation(int targetIndex, int sourceIndex);
+
+ /**
+ * Remove the nested annotation at the specified index from the
+ * container without firing change notification.
+ */
+ T removeNestedAnnotation(int index);
+
+ /**
+ * The JDT DOM annotations starting at the specified index were removed
+ * from the JDT DOM annotations corresponding to the container.
+ * Remove the corresponding nested annotations from the
+ * container and notify interested parties.
+ */
+ void syncRemoveNestedAnnotations(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java
new file mode 100644
index 0000000000..d0f537bd47
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+
+/**
+ * Used to build annotations discovered in the Java source code.
+ * To provide new <code>AnnotationDefinition</code>s, create a new
+ * {@link org.eclipse.jpt.jpa.core.JpaPlatform}
+ * by implementing {@link org.eclipse.jpt.jpa.core.JpaPlatform JpaPlatform}
+ * and/or extending
+ * {@link org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform GenericJpaPlatform}.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see Annotation
+ * @see org.eclipse.jpt.jpa.core.JpaPlatform
+ * @see org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface AnnotationDefinition
+{
+ /**
+ * Return the name of the annotation the definition will build in the
+ * various #build...(...) methods.
+ */
+ String getAnnotationName();
+
+ /**
+ * Build and return an annotation for the specified annotated element.
+ */
+ Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement);
+
+ /**
+ * Build and return an annotation for the specified JDT annotation
+ * on the specified annotated element.
+ */
+ Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation);
+
+ /**
+ * Build and return a <em>null</em> annotation for the specified element.
+ * Only certain annotations are required to have <em>null</em> implementations;
+ * typically the annotations with reasonably complex default behavior.
+ * The <em>null</em> annotation is used by the corresponding default context model.
+ * The <em>null</em> annotation simplifies the context model code, allowing the
+ * context model to simply set various bits of state (e.g. <code>name</code>) and the
+ * <em>null</em> annotation will create a new <em>real</em> annotation and forward the
+ * new state to it. This reduces the number of <code>null</code> checks in the context
+ * model (hopefully).
+ */
+ Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java
new file mode 100644
index 0000000000..450dba4f8d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.AssociationOverride
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface AssociationOverrideAnnotation
+ extends OverrideAnnotation
+{
+ String ANNOTATION_NAME = JPA.ASSOCIATION_OVERRIDE;
+
+
+ /**
+ * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ ListIterator<JoinColumnAnnotation> joinColumns();
+ String JOIN_COLUMNS_LIST = "joinColumns"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
+ */
+ int joinColumnsSize();
+
+ /**
+ * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
+ */
+ JoinColumnAnnotation joinColumnAt(int index);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
+ */
+ int indexOfJoinColumn(JoinColumnAnnotation joinColumn);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
+ */
+ JoinColumnAnnotation addJoinColumn(int index);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
+ */
+ void moveJoinColumn(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
+ */
+ void removeJoinColumn(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java
new file mode 100644
index 0000000000..b110097462
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.AssociationOverrides
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface AssociationOverridesAnnotation
+ extends ContainerAnnotation<NestableAssociationOverrideAnnotation>
+{
+ String ANNOTATION_NAME = JPA.ASSOCIATION_OVERRIDES;
+
+ String ASSOCIATION_OVERRIDES_LIST = "associationOverides"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverrideAnnotation.java
new file mode 100644
index 0000000000..55a2bd46ab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverrideAnnotation.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.AttributeOverride
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface AttributeOverrideAnnotation
+ extends OverrideAnnotation
+{
+ String ANNOTATION_NAME = JPA.ATTRIBUTE_OVERRIDE;
+
+
+ /**
+ * Corresponds to the 'column' element of the AttributeOverride annotation.
+ * Return null if the element does not exist in Java.
+ */
+ ColumnAnnotation getColumn();
+ String COLUMN_PROPERTY = "column"; //$NON-NLS-1$
+
+ ColumnAnnotation getNonNullColumn();
+
+ /**
+ * Add the 'column' element to the AttributeOverride annotation.
+ */
+ ColumnAnnotation addColumn();
+
+ /**
+ * Remove the 'column' element from the AttributeOverride annotation.
+ */
+ void removeColumn();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java
new file mode 100644
index 0000000000..1fca1c4f46
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.AttributeOverrides
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface AttributeOverridesAnnotation
+ extends ContainerAnnotation<NestableAttributeOverrideAnnotation>
+{
+ String ANNOTATION_NAME = JPA.ATTRIBUTE_OVERRIDES;
+
+ String ATTRIBUTE_OVERRIDES_LIST = "attributeOverrides"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseColumnAnnotation.java
new file mode 100644
index 0000000000..7cee700993
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseColumnAnnotation.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotations:<ul>
+ * <li><code>javax.persistence.Column<code>
+ * <li><code>javax.persistence.MapKeyColumn<code>
+ * <li><code>javax.persistence.JoinColumn<code>
+ * <li><code>javax.persistence.MapKeyJoinColumn<code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface BaseColumnAnnotation
+ extends NamedColumnAnnotation
+{
+ // ********** unique **********
+
+ /**
+ * Corresponds to the 'unique' element of the *Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getUnique();
+ String UNIQUE_PROPERTY = "unique"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'unique' element of the *Column annotation.
+ * Set to null to remove the element.
+ */
+ void setUnique(Boolean unique);
+
+ /**
+ * Return the {@link TextRange} for the 'unique' element. If the element
+ * does not exist return the {@link TextRange} for the *Column annotation.
+ */
+ TextRange getUniqueTextRange(CompilationUnit astRoot);
+
+
+ // ********** nullable **********
+
+ /**
+ * Corresponds to the 'nullable' element of the *Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getNullable();
+ String NULLABLE_PROPERTY = "nullable"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'nullable' element of the *Column annotation.
+ * Set to null to remove the element.
+ */
+ void setNullable(Boolean nullable);
+
+ /**
+ * Return the {@link TextRange} for the 'nullable' element. If the element
+ * does not exist return the {@link TextRange} for the *Column annotation.
+ */
+ TextRange getNullableTextRange(CompilationUnit astRoot);
+
+
+ // ********** insertable **********
+
+ /**
+ * Corresponds to the 'insertable' element of the *Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getInsertable();
+ String INSERTABLE_PROPERTY = "insertable"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'insertable' element of the *Column annotation.
+ * Set to null to remove the element.
+ */
+ void setInsertable(Boolean insertable);
+
+ /**
+ * Return the {@link TextRange} for the 'insertable' element. If the element
+ * does not exist return the {@link TextRange} for the *Column annotation.
+ */
+ TextRange getInsertableTextRange(CompilationUnit astRoot);
+
+
+ // ********** updatable **********
+
+ /**
+ * Corresponds to the 'updatable' element of the *Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getUpdatable();
+ String UPDATABLE_PROPERTY = "updatable"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'updatable' element of the *Column annotation.
+ * Set to null to remove the element.
+ */
+ void setUpdatable(Boolean updatable);
+
+ /**
+ * Return the {@link TextRange} for the 'updatable' element. If the element
+ * does not exist return the {@link TextRange} for the *Column annotation.
+ */
+ TextRange getUpdatableTextRange(CompilationUnit astRoot);
+
+
+ // ********** table **********
+
+ /**
+ * Corresponds to the 'table' element of the *Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getTable();
+ String TABLE_PROPERTY = "table"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'table' element of the *Column annotation.
+ * Set to null to remove the element.
+ */
+ void setTable(String table);
+
+ /**
+ * Return the {@link TextRange} for the 'table' element. If the element
+ * does not exist return the {@link TextRange} for the *Column annotation.
+ */
+ TextRange getTableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'table' element.
+ * Return false if the element does not exist.
+ */
+ boolean tableTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java
new file mode 100644
index 0000000000..e0400e0a5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotations:<ul>
+ * <li><code>javax.persistence.JoinColumn<code>
+ * <li><code>javax.persistence.MapKeyJoinColumn<code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface BaseJoinColumnAnnotation
+ extends BaseColumnAnnotation
+{
+ // ********** referenced column name **********
+
+ /**
+ * Corresponds to the 'referencedColumnName' element of the JoinColumn annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getReferencedColumnName();
+ String REFERENCED_COLUMN_NAME_PROPERTY = "referencedColumnName"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'referencedColumnName' element of the JoinColumn annotation.
+ * Set to null to remove the element.
+ */
+ void setReferencedColumnName(String referencedColumnName);
+
+ /**
+ * Return the {@link TextRange} for the 'referencedColumnName' element. If element
+ * does not exist return the {@link TextRange} for the JoinColumn annotation.
+ */
+ TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'referencedColumnName' element.
+ * Return false if the element does not exist.
+ */
+ boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java
new file mode 100644
index 0000000000..f6e31583e4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotations:<ul>
+ * <li><code>javax.persistence.Table<code>
+ * <li><code>javax.persistence.JoinTable<code>
+ * <li><code>javax.persistence.SecondaryTable<code>
+ * <li><code>javax.persistence.CollectionTable<code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface BaseTableAnnotation
+ extends Annotation
+{
+ /**
+ * Return whether the annotation exists in Java.
+ */
+ boolean isSpecified();
+
+
+ // ********** name **********
+
+ /**
+ * Corresponds to the 'name' element of the *Table annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the *Table annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the *Table annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'name' element.
+ * Return false if the element does not exist.
+ */
+ boolean nameTouches(int pos, CompilationUnit astRoot);
+
+
+ // ********** schema **********
+
+ /**
+ * Corresponds to the 'schema' element of the *Table annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getSchema();
+ String SCHEMA_PROPERTY = "schema"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'schema' element of the *Table annotation.
+ * Set to null to remove the element.
+ */
+ void setSchema(String schema);
+
+ /**
+ * Return the {@link TextRange} for the 'schema' element. If the element
+ * does not exist return the {@link TextRange} for the *Table annotation.
+ */
+ TextRange getSchemaTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'schema' element.
+ * Return false if the element does not exist.
+ */
+ boolean schemaTouches(int pos, CompilationUnit astRoot);
+
+
+ // ********** catalog **********
+
+ /**
+ * Corresponds to the 'catalog' element of the *Table annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getCatalog();
+ String CATALOG_PROPERTY = "catalog"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'catalog' element of the *Table annotation.
+ * Set to null to remove the element.
+ */
+ void setCatalog(String catalog);
+
+ /**
+ * Return the {@link TextRange} for the 'catalog' element. If the element
+ * does not exist return the {@link TextRange} for the *Table annotation.
+ */
+ TextRange getCatalogTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'catalog' element.
+ * Return false if the element does not exist.
+ */
+ boolean catalogTouches(int pos, CompilationUnit astRoot);
+
+
+ // ********** unique constraints **********
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ ListIterator<UniqueConstraintAnnotation> uniqueConstraints();
+ String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
+ */
+ int uniqueConstraintsSize();
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
+ */
+ UniqueConstraintAnnotation uniqueConstraintAt(int index);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
+ */
+ int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
+ */
+ UniqueConstraintAnnotation addUniqueConstraint(int index);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
+ */
+ void moveUniqueConstraint(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
+ */
+ void removeUniqueConstraint(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java
new file mode 100644
index 0000000000..aa060986e5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Basic
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface BasicAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.BASIC;
+
+ /**
+ * Corresponds to the 'fetch' element of the Basic annotation.
+ * Return null if the element does not exist in Java.
+ */
+ FetchType getFetch();
+ String FETCH_PROPERTY = "fetch"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'fetch' element of the Basic annotation.
+ * Set to null to remove the element.
+ */
+ void setFetch(FetchType fetch);
+
+ /**
+ * Return the {@link TextRange} for the 'fetch' element. If the element
+ * does not exist return the {@link TextRange} for the Basic annotation.
+ */
+ TextRange getFetchTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'optional' element of the Basic annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Boolean getOptional();
+ String OPTIONAL_PROPERTY = "optional"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'optional' element of the Basic annotation.
+ * Set to null to remove the element.
+ */
+ void setOptional(Boolean optional);
+
+ /**
+ * Return the {@link TextRange} for the 'optional' element. If the element
+ * does not exist return the {@link TextRange} for the Basic annotation.
+ */
+ TextRange getOptionalTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CascadeType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CascadeType.java
new file mode 100644
index 0000000000..3ced144c62
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CascadeType.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+
+/**
+ * Corresponds to the JPA 1.0/2.0 enum
+ * javax.persistence.CascadeType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+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),
+ DETACH(JPA2_0.CASCADE_TYPE__DETACH); //added in JPA 2.0
+
+
+ private String javaAnnotationValue;
+
+ CascadeType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static CascadeType[] fromJavaAnnotationValues(Object[] javaAnnotationValues) {
+ if (javaAnnotationValues == null) {
+ return EMPTY_CASCADE_TYPE_ARRAY;
+ }
+ if (javaAnnotationValues.length == 0) {
+ return EMPTY_CASCADE_TYPE_ARRAY;
+ }
+ //nulls will exist if there is a typo in one of the enums
+ javaAnnotationValues = ArrayTools.removeAllOccurrences(javaAnnotationValues, null);
+ int len = javaAnnotationValues.length;
+ CascadeType[] cascadeTypes = new CascadeType[len];
+ for (int i = 0; i < len; i++) {
+ cascadeTypes[i] = fromJavaAnnotationValue(javaAnnotationValues[i]);
+ }
+ return cascadeTypes;
+ }
+ private static final CascadeType[] EMPTY_CASCADE_TYPE_ARRAY = new CascadeType[0];
+
+ public static CascadeType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static CascadeType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (CascadeType cascadeType : CascadeType.values()) {
+ if (cascadeType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return cascadeType;
+ }
+ }
+ return null;
+ }
+
+ public static String[] toJavaAnnotationValues(CascadeType[] cascadeTypes) {
+ if (cascadeTypes == null) {
+ return StringTools.EMPTY_STRING_ARRAY;
+ }
+ int len = cascadeTypes.length;
+ if (len == 0) {
+ return StringTools.EMPTY_STRING_ARRAY;
+ }
+
+ String[] javaAnnotationValues = new String[len];
+ for (int i = 0; i < len; i++) {
+ javaAnnotationValues[i] = toJavaAnnotationValue(cascadeTypes[i]);
+ }
+ return javaAnnotationValues;
+ }
+
+ public static String toJavaAnnotationValue(CascadeType cascadeType) {
+ return (cascadeType == null) ? null : cascadeType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ColumnAnnotation.java
new file mode 100644
index 0000000000..59efaa1fea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ColumnAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.Column</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface ColumnAnnotation
+ extends CompleteColumnAnnotation
+{
+ String ANNOTATION_NAME = JPA.COLUMN;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CompleteColumnAnnotation.java
new file mode 100644
index 0000000000..15bfa6091a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CompleteColumnAnnotation.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotations:<ul>
+ * <li><code>javax.persistence.Column<code>
+ * <li><code>javax.persistence.MapKeyColumn<code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface CompleteColumnAnnotation
+ extends BaseColumnAnnotation
+{
+ // ********** length **********
+
+ /**
+ * Corresponds to the 'length' element of the Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getLength();
+ String LENGTH_PROPERTY = "length"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'length' element of the Column annotation.
+ * Set to null to remove the element.
+ */
+ void setLength(Integer length);
+
+ /**
+ * Return the {@link TextRange} for the 'length' element. If element
+ * does not exist return the {@link TextRange} for the Column annotation.
+ */
+ TextRange getLengthTextRange(CompilationUnit astRoot);
+
+
+ // ********** precision **********
+
+ /**
+ * Corresponds to the 'precision' element of the Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getPrecision();
+ String PRECISION_PROPERTY = "precision"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'precision' element of the Column annotation.
+ * Set to null to remove the element.
+ */
+ void setPrecision(Integer precision);
+
+ /**
+ * Return the {@link TextRange} for the 'precision' element. If element
+ * does not exist return the {@link TextRange} for the Column annotation.
+ */
+ TextRange getPrecisionTextRange(CompilationUnit astRoot);
+
+
+ // ********** scale **********
+
+ /**
+ * Corresponds to the 'scale' element of the Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getScale();
+ String SCALE_PROPERTY = "scale"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'scale' element of the Column annotation.
+ * Set to null to remove the element.
+ */
+ void setScale(Integer scale);
+
+ /**
+ * Return the {@link TextRange} for the 'scale' element. If element
+ * does not exist return the {@link TextRange} for the Column annotation.
+ */
+ TextRange getScaleTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java
new file mode 100644
index 0000000000..f74f802290
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Common behavior for all "container" annotations.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface ContainerAnnotation<T extends NestableAnnotation>
+ extends Annotation, AnnotationContainer<T>
+{
+ /**
+ * Convert the specified stand-alone annotation to an annotation nested
+ * within the container without firing change notification.
+ */
+ void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation);
+
+ /**
+ * In preparation for a just-nested annotation being written to the source
+ * file, add the just-nested annotation to the container annotation at the
+ * specified index without firing change notification.
+ *
+ * @see #nestStandAloneAnnotation(NestableAnnotation)
+ */
+ void addNestedAnnotation(int index, NestableAnnotation annotation);
+
+ /**
+ * Convert the container's last nested annotation to a stand-alone
+ * annotation without firing change notification.
+ */
+ void convertLastNestedAnnotationToStandAlone();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorColumnAnnotation.java
new file mode 100644
index 0000000000..20255c2e75
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorColumnAnnotation.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.DiscriminatorColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface DiscriminatorColumnAnnotation
+ extends NamedColumnAnnotation
+{
+ String ANNOTATION_NAME = JPA.DISCRIMINATOR_COLUMN;
+
+
+ // ********** discriminator type **********
+
+ /**
+ * Corresponds to the 'discriminatorType' element of the DiscriminatorColumn annotation.
+ * Return null if the element does not exist in Java.
+ */
+ DiscriminatorType getDiscriminatorType();
+ String DISCRIMINATOR_TYPE_PROPERTY = "discriminatorType"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'discriminatorType' element of the DiscriminatorColumn annotation.
+ * Set the to null to remove the element.
+ */
+ void setDiscriminatorType(DiscriminatorType discriminatorType);
+
+
+ // ********** length **********
+
+ /**
+ * Corresponds to the 'length' element of the DiscriminatorColumn annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getLength();
+ String LENGTH_PROPERTY = "length"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'length' element of the DiscriminatorColumn annotation.
+ * Set the to null to remove the element.
+ */
+ void setLength(Integer length);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorType.java
new file mode 100644
index 0000000000..df81a30d64
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorType.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA enum
+ * javax.persistence.DiscriminatorType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum DiscriminatorType {
+
+ STRING(JPA.DISCRIMINATOR_TYPE__STRING),
+ CHAR(JPA.DISCRIMINATOR_TYPE__CHAR),
+ INTEGER(JPA.DISCRIMINATOR_TYPE__INTEGER);
+
+
+ private String javaAnnotationValue;
+
+ DiscriminatorType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static DiscriminatorType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static DiscriminatorType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (DiscriminatorType discriminatorType : DiscriminatorType.values()) {
+ if (discriminatorType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return discriminatorType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(DiscriminatorType discriminatorType) {
+ return (discriminatorType == null) ? null : discriminatorType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java
new file mode 100644
index 0000000000..bdba78284f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.DiscriminatorValue
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface DiscriminatorValueAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.DISCRIMINATOR_VALUE;
+
+ /**
+ * Corresponds to the 'value' element of the DiscriminatorValue annotation.
+ * Return null if the element does not exist in the annotation.
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the DiscriminatorValue annotation.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the DiscriminatorValue annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java
new file mode 100644
index 0000000000..05c131b9d6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Embeddable
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface EmbeddableAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.EMBEDDABLE;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java
new file mode 100644
index 0000000000..dcf5b2a165
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Embedded
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface EmbeddedAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.EMBEDDED;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java
new file mode 100644
index 0000000000..9244f3e79c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.EmbeddedId
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface EmbeddedIdAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.EMBEDDED_ID;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java
new file mode 100644
index 0000000000..7b59692e40
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Entity
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface EntityAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.ENTITY;
+
+ /**
+ * Corresponds to the 'name' element of the Entity annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the Entity annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the Entity annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumType.java
new file mode 100644
index 0000000000..6c0d134d4b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumType.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA enum
+ * javax.persistence.EnumType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum EnumType {
+
+ ORDINAL(JPA.ENUM_TYPE__ORDINAL),
+ STRING(JPA.ENUM_TYPE__STRING);
+
+
+ private String javaAnnotationValue;
+
+ EnumType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static EnumType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static EnumType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (EnumType enumType : EnumType.values()) {
+ if (enumType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return enumType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(EnumType enumType) {
+ return (enumType == null) ? null : enumType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java
new file mode 100644
index 0000000000..3485e76bc3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Enumerated
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface EnumeratedAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.ENUMERATED;
+
+ /**
+ * Corresponds to the 'value' element of the Enumerated annotation.
+ * Return null if the element does not exist in Java.
+ */
+ EnumType getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the Enumerated annotation.
+ * Set to null to remove the element.
+ */
+ void setValue(EnumType value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the Enumerated annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/FetchType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/FetchType.java
new file mode 100644
index 0000000000..7856834151
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/FetchType.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA enum
+ * javax.persistence.FetchType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum FetchType {
+
+ EAGER(JPA.FETCH_TYPE__EAGER),
+ LAZY(JPA.FETCH_TYPE__LAZY);
+
+
+ private String javaAnnotationValue;
+
+ FetchType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static FetchType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static FetchType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (FetchType fetchType : FetchType.values()) {
+ if (fetchType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return fetchType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(FetchType fetchType) {
+ return (fetchType == null) ? null : fetchType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java
new file mode 100644
index 0000000000..ff3ff6e3b2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.GeneratedValue
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface GeneratedValueAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.GENERATED_VALUE;
+
+ /**
+ * Corresponds to the 'strategy' element of the GeneratedValue annotation.
+ * Return null if the element does not exist in Java.
+ */
+ GenerationType getStrategy();
+ String STRATEGY_PROPERTY = "strategy"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'strategy' element of the GeneratedValue annotation.
+ * Set to null to remove the element.
+ */
+ void setStrategy(GenerationType strategy);
+
+ /**
+ * Return the {@link TextRange} for the 'strategy' element. If the element
+ * does not exist return the {@link TextRange} for the GeneratedValue annotation.
+ */
+ TextRange getStrategyTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'generator' element of the GeneratedValue annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getGenerator();
+ String GENERATOR_PROPERTY = "generator"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'generator' element of the GeneratedValue annotation.
+ * Set to null to remove the element.
+ */
+ void setGenerator(String generator);
+
+ /**
+ * Return the {@link TextRange} for the 'generator' element. If the element
+ * does not exist return the {@link TextRange} for the GeneratedValue annotation.
+ */
+ TextRange getGeneratorTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'generator' element.
+ * Return false if the element does not exist.
+ */
+ boolean generatorTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GenerationType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GenerationType.java
new file mode 100644
index 0000000000..7907a03b27
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GenerationType.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA enum
+ * javax.persistence.GenerationType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum GenerationType {
+
+ TABLE(JPA.GENERATION_TYPE__TABLE),
+ SEQUENCE(JPA.GENERATION_TYPE__SEQUENCE),
+ IDENTITY(JPA.GENERATION_TYPE__IDENTITY),
+ AUTO(JPA.GENERATION_TYPE__AUTO);
+
+
+ private String javaAnnotationValue;
+
+ GenerationType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static GenerationType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static GenerationType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (GenerationType generationType : GenerationType.values()) {
+ if (generationType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return generationType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(GenerationType generationType) {
+ return (generationType == null) ? null : generationType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
new file mode 100644
index 0000000000..793fbb5d07
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Common protocol among
+ * javax.persistence.SequenceGenerator
+ * javax.persistence.TableGenerator
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface GeneratorAnnotation
+ extends Annotation
+{
+ /**
+ * Corresponds to the 'name' element of the *Generator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the *Generator annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the *Generator annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'initialValue' element of the *Generator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getInitialValue();
+ String INITIAL_VALUE_PROPERTY = "initialValue"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'initialValue' element of the *Generator annotation.
+ * Set to null to remove the element.
+ */
+ void setInitialValue(Integer initialValue);
+
+ /**
+ * Return the {@link TextRange} for the 'initialValue' element. If the element
+ * does not exist return the {@link TextRange} for the *Generator annotation.
+ */
+ TextRange getInitialValueTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'allocationSize' element of the *Generator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ Integer getAllocationSize();
+ String ALLOCATION_SIZE_PROPERTY = "allocationSize"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'allocationSize' element of the *Generator annotation.
+ * Set to null to remove the element.
+ */
+ void setAllocationSize(Integer allocationSize);
+
+ /**
+ * Return the {@link TextRange} for the 'allocationSize' element. If the element
+ * does not exist return the {@link TextRange} for the *Generator annotation.
+ */
+ TextRange getAllocationSizeTextRange(CompilationUnit astRoot);
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java
new file mode 100644
index 0000000000..219293cc58
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Id
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface IdAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.ID;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java
new file mode 100644
index 0000000000..330dd7d2f5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * This interface corresponds to the JPA annotation
+ * javax.persistence.IdClass
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface IdClassAnnotation
+ extends Annotation
+{
+ final String ANNOTATION_NAME = JPA.ID_CLASS;
+
+ /**
+ * Corresponds to the 'value' element of the IdClass annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * &#64;IdClass(value=Employee.class)
+ * </pre>
+ * will return "Employee"
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the IdClass annotation.
+ * Set to null to remove the element.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the IdClass annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the fully-qualified ID class name as resolved by the
+ * AST's bindings.
+ * <pre>
+ * &#64;IdClass(Employee.class)
+ * </pre>
+ * will return <code>"model.Employee"</code> if there is an import for
+ * <code>model.Employee</code>.
+ */
+ String getFullyQualifiedClassName();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java
new file mode 100644
index 0000000000..25ddb14146
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Inheritance
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface InheritanceAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.INHERITANCE;
+
+ /**
+ * Corresponds to the 'strategy' element of the Inheritance annotation.
+ * Return null if the element does not exist in Java.
+ */
+ InheritanceType getStrategy();
+ String STRATEGY_PROPERTY = "strategy"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'strategy' element of the Inheritance annotation.
+ * Set to null to remove the element.
+ */
+ void setStrategy(InheritanceType strategy);
+
+ /**
+ * Return the {@link TextRange} for the 'strategy' element. If the element
+ * does not exist return the {@link TextRange} for the Inheritance annotation.
+ */
+ TextRange getStrategyTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceType.java
new file mode 100644
index 0000000000..3560579937
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceType.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA enum
+ * javax.persistence.InheritanceType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum InheritanceType {
+
+ SINGLE_TABLE(JPA.INHERITANCE_TYPE__SINGLE_TABLE),
+ JOINED(JPA.INHERITANCE_TYPE__JOINED),
+ TABLE_PER_CLASS(JPA.INHERITANCE_TYPE__TABLE_PER_CLASS);
+
+
+ private String javaAnnotationValue;
+
+ InheritanceType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static InheritanceType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static InheritanceType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (InheritanceType inheritanceType : InheritanceType.values()) {
+ if (inheritanceType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return inheritanceType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(InheritanceType inheritanceType) {
+ return (inheritanceType == null) ? null : inheritanceType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JPA.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JPA.java
new file mode 100644
index 0000000000..f1c2ce017d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JPA.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * JPA Java-related stuff (annotations etc.)
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public interface JPA {
+
+ // JPA package
+ String PACKAGE = "javax.persistence";
+ String PACKAGE_ = PACKAGE + '.';
+
+
+ // ********** API **********
+
+ // JPA annotations
+ String ASSOCIATION_OVERRIDE = PACKAGE_ + "AssociationOverride";
+ String ASSOCIATION_OVERRIDE__NAME = "name";
+ String ASSOCIATION_OVERRIDE__JOIN_COLUMNS = "joinColumns";
+ String ASSOCIATION_OVERRIDES = PACKAGE_ + "AssociationOverrides";
+ String ASSOCIATION_OVERRIDES__VALUE = "value";
+ String ATTRIBUTE_OVERRIDE = PACKAGE_ + "AttributeOverride";
+ String ATTRIBUTE_OVERRIDE__NAME = "name";
+ String ATTRIBUTE_OVERRIDE__COLUMN = "column";
+ String ATTRIBUTE_OVERRIDES = PACKAGE_ + "AttributeOverrides";
+ String ATTRIBUTE_OVERRIDES__VALUE = "value";
+ String BASIC = PACKAGE_ + "Basic";
+ String BASIC__FETCH = "fetch";
+ String BASIC__OPTIONAL = "optional";
+ String COLUMN = PACKAGE_ + "Column";
+ String COLUMN__NAME = "name";
+ String COLUMN__UNIQUE = "unique";
+ String COLUMN__NULLABLE = "nullable";
+ String COLUMN__INSERTABLE = "insertable";
+ String COLUMN__UPDATABLE = "updatable";
+ String COLUMN__COLUMN_DEFINITION = "columnDefinition";
+ String COLUMN__TABLE = "table";
+ String COLUMN__LENGTH = "length";
+ String COLUMN__PRECISION = "precision";
+ String COLUMN__SCALE = "scale";
+ String COLUMN_RESULT = PACKAGE_ + "ColumnResult";
+ String COLUMN_RESULT__NAME = "name";
+ String DISCRIMINATOR_COLUMN = PACKAGE_ + "DiscriminatorColumn";
+ String DISCRIMINATOR_COLUMN__NAME = "name";
+ String DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = "discriminatorType";
+ String DISCRIMINATOR_COLUMN__COLUMN_DEFINITION = "columnDefinition";
+ String DISCRIMINATOR_COLUMN__LENGTH = "length";
+ String DISCRIMINATOR_VALUE = PACKAGE_ + "DiscriminatorValue";
+ String DISCRIMINATOR_VALUE__VALUE = "value";
+ String EMBEDDABLE = PACKAGE_ + "Embeddable";
+ String EMBEDDED = PACKAGE_ + "Embedded";
+ String EMBEDDED_ID = PACKAGE_ + "EmbeddedId";
+ String ENTITY = PACKAGE_ + "Entity";
+ String ENTITY__NAME = "name";
+ String ENTITY_LISTENERS = PACKAGE_ + "EntityListeners";
+ String ENTITY_LISTENERS__VALUE = "value";
+ String ENTITY_RESULT = PACKAGE_ + "EntityResult";
+ String ENTITY_RESULT__ENTITY_CLASS = "entityClass";
+ String ENTITY_RESULT__FIELDS = "fields";
+ String ENTITY_RESULT__DISCRIMINATOR_COLUMN = "discriminatorColumn";
+ String ENUMERATED = PACKAGE_ + "Enumerated";
+ String ENUMERATED__VALUE = "value";
+ String EXCLUDE_DEFAULT_LISTENERS = PACKAGE_ + "ExcludeDefaultListeners";
+ String EXCLUDE_SUPERCLASS_LISTENERS = PACKAGE_ + "ExcludeSuperclassListeners";
+ String FIELD_RESULT = PACKAGE_ + "FieldResult";
+ String FIELD_RESULT__NAME = "name";
+ String FIELD_RESULT__COLUMN = "column";
+ String FLUSH_MODE = PACKAGE_ + "FlushMode";
+ String FLUSH_MODE__VALUE = "value";
+ String GENERATED_VALUE = PACKAGE_ + "GeneratedValue";
+ String GENERATED_VALUE__STRATEGY = "strategy";
+ String GENERATED_VALUE__GENERATOR = "generator";
+ String ID = PACKAGE_ + "Id";
+ String ID_CLASS = PACKAGE_ + "IdClass";
+ String ID_CLASS__VALUE = "value";
+ String INHERITANCE = PACKAGE_ + "Inheritance";
+ String INHERITANCE__STRATEGY = "strategy";
+ String JOIN_COLUMN = PACKAGE_ + "JoinColumn";
+ String JOIN_COLUMN__NAME = "name";
+ String JOIN_COLUMN__REFERENCED_COLUMN_NAME = "referencedColumnName";
+ String JOIN_COLUMN__UNIQUE = "unique";
+ String JOIN_COLUMN__NULLABLE = "nullable";
+ String JOIN_COLUMN__INSERTABLE = "insertable";
+ String JOIN_COLUMN__UPDATABLE = "updatable";
+ String JOIN_COLUMN__COLUMN_DEFINITION = "columnDefinition";
+ String JOIN_COLUMN__TABLE = "table";
+ String JOIN_COLUMNS = PACKAGE_ + "JoinColumns";
+ String JOIN_COLUMNS__VALUE = "value";
+ String JOIN_TABLE = PACKAGE_ + "JoinTable";
+ String JOIN_TABLE__NAME = "name";
+ String JOIN_TABLE__CATALOG = "catalog";
+ String JOIN_TABLE__SCHEMA = "schema";
+ String JOIN_TABLE__JOIN_COLUMNS = "joinColumns";
+ String JOIN_TABLE__INVERSE_JOIN_COLUMNS = "inverseJoinColumns";
+ String JOIN_TABLE__UNIQUE_CONSTRAINTS = "uniqueConstraints";
+ String LOB = PACKAGE_ + "Lob";
+ String MANY_TO_MANY = PACKAGE_ + "ManyToMany";
+ String MANY_TO_MANY__TARGET_ENTITY = "targetEntity";
+ String MANY_TO_MANY__CASCADE = "cascade";
+ String MANY_TO_MANY__FETCH = "fetch";
+ String MANY_TO_MANY__MAPPED_BY = "mappedBy";
+ String MANY_TO_ONE = PACKAGE_ + "ManyToOne";
+ String MANY_TO_ONE__TARGET_ENTITY = "targetEntity";
+ String MANY_TO_ONE__CASCADE = "cascade";
+ String MANY_TO_ONE__FETCH = "fetch";
+ String MANY_TO_ONE__OPTIONAL = "optional";
+ String MAP_KEY = PACKAGE_ + "MapKey";
+ String MAP_KEY__NAME = "name";
+ String MAPPED_SUPERCLASS = PACKAGE_ + "MappedSuperclass";
+ String NAMED_NATIVE_QUERIES = PACKAGE_ + "NamedNativeQueries";
+ String NAMED_NATIVE_QUERIES__VALUE = "value";
+ String NAMED_NATIVE_QUERY = PACKAGE_ + "NamedNativeQuery";
+ String NAMED_NATIVE_QUERY__NAME = "name";
+ String NAMED_NATIVE_QUERY__QUERY = "query";
+ String NAMED_NATIVE_QUERY__HINTS = "hints";
+ String NAMED_NATIVE_QUERY__RESULT_CLASS = "resultClass";
+ String NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = "resultSetMapping";
+ String NAMED_QUERIES = PACKAGE_ + "NamedQueries";
+ String NAMED_QUERIES__VALUE = "value";
+ String NAMED_QUERY = PACKAGE_ + "NamedQuery";
+ String NAMED_QUERY__NAME = "name";
+ String NAMED_QUERY__QUERY = "query";
+ String NAMED_QUERY__HINTS = "hints";
+ String ONE_TO_MANY = PACKAGE_ + "OneToMany";
+ String ONE_TO_MANY__TARGET_ENTITY = "targetEntity";
+ String ONE_TO_MANY__CASCADE = "cascade";
+ String ONE_TO_MANY__FETCH = "fetch";
+ String ONE_TO_MANY__MAPPED_BY = "mappedBy";
+ String ONE_TO_ONE = PACKAGE_ + "OneToOne";
+ String ONE_TO_ONE__TARGET_ENTITY = "targetEntity";
+ String ONE_TO_ONE__CASCADE = "cascade";
+ String ONE_TO_ONE__FETCH = "fetch";
+ String ONE_TO_ONE__OPTIONAL = "optional";
+ String ONE_TO_ONE__MAPPED_BY = "mappedBy";
+ String ORDER_BY = PACKAGE_ + "OrderBy";
+ String ORDER_BY__VALUE = "value";
+ String PERSISTENCE_CONTEXT = PACKAGE_ + "PersistenceContext";
+ String PERSISTENCE_CONTEXT__NAME = "name";
+ String PERSISTENCE_CONTEXT__UNIT_NAME = "unitName";
+ String PERSISTENCE_CONTEXT__TYPE = "type";
+ String PERSISTENCE_CONTEXTS = PACKAGE_ + "PersistenceContexts";
+ String PERSISTENCE_CONTEXTS__VALUE = "value";
+ String PERSISTENCE_UNIT = PACKAGE_ + "XmlPersistenceUnit";
+ String PERSISTENCE_UNIT__NAME = "name";
+ String PERSISTENCE_UNIT__UNIT_NAME = "unitName";
+ String PERSISTENCE_UNITS = PACKAGE_ + "PersistenceUnits";
+ String PERSISTENCE_UNITS__VALUE = "value";
+ String POST_LOAD = PACKAGE_ + "PostLoad";
+ String POST_PERSIST = PACKAGE_ + "PostPersist";
+ String POST_REMOVE = PACKAGE_ + "PostRemove";
+ String POST_UPDATE = PACKAGE_ + "PostUpdate";
+ String PRE_PERSIST = PACKAGE_ + "PrePersist";
+ String PRE_REMOVE = PACKAGE_ + "PreRemove";
+ String PRE_UPDATE = PACKAGE_ + "PreUpdate";
+ String PRIMARY_KEY_JOIN_COLUMN = PACKAGE_ + "PrimaryKeyJoinColumn";
+ String PRIMARY_KEY_JOIN_COLUMN__NAME = "name";
+ String PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = "referencedColumnName";
+ String PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = "columnDefinition";
+ String PRIMARY_KEY_JOIN_COLUMNS = PACKAGE_ + "PrimaryKeyJoinColumns";
+ String PRIMARY_KEY_JOIN_COLUMNS__VALUE = "value";
+ String QUERY_HINT = PACKAGE_ + "QueryHint";
+ String QUERY_HINT__NAME = "name";
+ String QUERY_HINT__VALUE = "value";
+ String SECONDARY_TABLE = PACKAGE_ + "SecondaryTable";
+ String SECONDARY_TABLE__NAME = "name";
+ String SECONDARY_TABLE__CATALOG = "catalog";
+ String SECONDARY_TABLE__SCHEMA = "schema";
+ String SECONDARY_TABLE__PK_JOIN_COLUMNS = "pkJoinColumns";
+ String SECONDARY_TABLE__UNIQUE_CONSTRAINTS = "uniqueConstraints";
+ String SECONDARY_TABLES = PACKAGE_ + "SecondaryTables";
+ String SECONDARY_TABLES__VALUE = "value";
+ String SEQUENCE_GENERATOR = PACKAGE_ + "SequenceGenerator";
+ String SEQUENCE_GENERATOR__NAME = "name";
+ String SEQUENCE_GENERATOR__SEQUENCE_NAME = "sequenceName";
+ String SEQUENCE_GENERATOR__INITIAL_VALUE = "initialValue";
+ String SEQUENCE_GENERATOR__ALLOCATION_SIZE = "allocationSize";
+ String SQL_RESULT_SET_MAPPING = PACKAGE_ + "SqlResultSetMapping";
+ String SQL_RESULT_SET_MAPPING__NAME = "name";
+ String SQL_RESULT_SET_MAPPING__ENTITIES = "entities";
+ String SQL_RESULT_SET_MAPPING__COLUMNS = "columns";
+ String TABLE = PACKAGE_ + "Table";
+ String TABLE__NAME = "name";
+ String TABLE__CATALOG = "catalog";
+ String TABLE__SCHEMA = "schema";
+ String TABLE__UNIQUE_CONSTRAINTS = "uniqueConstraints";
+ String TABLE_GENERATOR = PACKAGE_ + "TableGenerator";
+ String TABLE_GENERATOR__NAME = "name";
+ String TABLE_GENERATOR__TABLE = "table";
+ String TABLE_GENERATOR__CATALOG = "catalog";
+ String TABLE_GENERATOR__SCHEMA = "schema";
+ String TABLE_GENERATOR__PK_COLUMN_NAME = "pkColumnName";
+ String TABLE_GENERATOR__VALUE_COLUMN_NAME = "valueColumnName";
+ String TABLE_GENERATOR__PK_COLUMN_VALUE = "pkColumnValue";
+ String TABLE_GENERATOR__INITIAL_VALUE = "initialValue";
+ String TABLE_GENERATOR__ALLOCATION_SIZE = "allocationSize";
+ String TABLE_GENERATOR__UNIQUE_CONSTRAINTS = "uniqueConstraints";
+ String TEMPORAL = PACKAGE_ + "Temporal";
+ String TEMPORAL__VALUE = "value";
+ String TRANSIENT = PACKAGE_ + "Transient";
+ String UNIQUE_CONSTRAINT = PACKAGE_ + "UniqueConstraint";
+ String UNIQUE_CONSTRAINT__COLUMN_NAMES = "columnNames";
+ String VERSION = PACKAGE_ + "Version";
+
+ // JPA enums
+ String CASCADE_TYPE = PACKAGE_ + "CascadeType";
+ String CASCADE_TYPE_ = CASCADE_TYPE + '.';
+ String CASCADE_TYPE__ALL = CASCADE_TYPE_ + "ALL";
+ String CASCADE_TYPE__MERGE = CASCADE_TYPE_ + "MERGE";
+ String CASCADE_TYPE__PERSIST = CASCADE_TYPE_ + "PERSIST";
+ String CASCADE_TYPE__REFRESH = CASCADE_TYPE_ + "REFRESH";
+ String CASCADE_TYPE__REMOVE = CASCADE_TYPE_ + "REMOVE";
+
+ String DISCRIMINATOR_TYPE = PACKAGE_ + "DiscriminatorType";
+ String DISCRIMINATOR_TYPE_ = DISCRIMINATOR_TYPE + '.';
+ String DISCRIMINATOR_TYPE__CHAR = DISCRIMINATOR_TYPE_ + "CHAR";
+ String DISCRIMINATOR_TYPE__INTEGER = DISCRIMINATOR_TYPE_ + "INTEGER";
+ String DISCRIMINATOR_TYPE__STRING = DISCRIMINATOR_TYPE_ + "STRING";
+
+ String ENUM_TYPE = PACKAGE_ + "EnumType";
+ String ENUM_TYPE_ = ENUM_TYPE + '.';
+ String ENUM_TYPE__ORDINAL = ENUM_TYPE_ + "ORDINAL";
+ String ENUM_TYPE__STRING = ENUM_TYPE_ + "STRING";
+
+ String FETCH_TYPE = PACKAGE_ + "FetchType";
+ String FETCH_TYPE_ = FETCH_TYPE + '.';
+ String FETCH_TYPE__EAGER = FETCH_TYPE_ + "EAGER";
+ String FETCH_TYPE__LAZY = FETCH_TYPE_ + "LAZY";
+
+ String FLUSH_MODE_TYPE = PACKAGE_ + "FlushModeType";
+ String FLUSH_MODE_TYPE_ = FLUSH_MODE_TYPE + '.';
+ String FLUSH_MODE_TYPE__AUTO = FLUSH_MODE_TYPE_ + "AUTO";
+ String FLUSH_MODE_TYPE__COMMIT = FLUSH_MODE_TYPE_ + "COMMIT";
+
+ String GENERATION_TYPE = PACKAGE_ + "GenerationType";
+ String GENERATION_TYPE_ = GENERATION_TYPE + '.';
+ String GENERATION_TYPE__AUTO = GENERATION_TYPE_ + "AUTO";
+ String GENERATION_TYPE__IDENTITY = GENERATION_TYPE_ + "IDENTITY";
+ String GENERATION_TYPE__SEQUENCE = GENERATION_TYPE_ + "SEQUENCE";
+ String GENERATION_TYPE__TABLE = GENERATION_TYPE_ + "TABLE";
+
+ String INHERITANCE_TYPE = PACKAGE_ + "InheritanceType";
+ String INHERITANCE_TYPE_ = INHERITANCE_TYPE + '.';
+ String INHERITANCE_TYPE__JOINED = INHERITANCE_TYPE_ + "JOINED";
+ String INHERITANCE_TYPE__SINGLE_TABLE = INHERITANCE_TYPE_ + "SINGLE_TABLE";
+ String INHERITANCE_TYPE__TABLE_PER_CLASS = INHERITANCE_TYPE_ + "TABLE_PER_CLASS";
+
+ String PERSISTENCE_CONTEXT_TYPE = PACKAGE_ + "PersistenceContextType";
+ String PERSISTENCE_CONTEXT_TYPE_ = PERSISTENCE_CONTEXT_TYPE + '.';
+ String PERSISTENCE_CONTEXT_TYPE__EXTENDED = PERSISTENCE_CONTEXT_TYPE_ + "EXTENDED";
+ String PERSISTENCE_CONTEXT_TYPE__TRANSACTION = PERSISTENCE_CONTEXT_TYPE_ + "TRANSACTION";
+
+ String TEMPORAL_TYPE = PACKAGE_ + "TemporalType";
+ String TEMPORAL_TYPE_ = TEMPORAL_TYPE + '.';
+ String TEMPORAL_TYPE__DATE = TEMPORAL_TYPE_ + "DATE";
+ String TEMPORAL_TYPE__TIME = TEMPORAL_TYPE_ + "TIME";
+ String TEMPORAL_TYPE__TIMESTAMP = TEMPORAL_TYPE_ + "TIMESTAMP";
+
+ // JPA interfaces
+ String ENTITY_MANAGER = PACKAGE_ + "EntityManager";
+ String ENTITY_MANAGER_FACTORY = PACKAGE_ + "EntityManagerFactory";
+ String ENTITY_TRANSACTION = PACKAGE_ + "EntityTransaction";
+ String INSTRUMENTABLE_CLASS_LOADER = PACKAGE_ + "InstrumentableClassLoader";
+ String QUERY = PACKAGE_ + "Query";
+
+ // JPA classes
+ String PERSISTENCE = PACKAGE_ + "XmlPersistence";
+
+ // JPA exceptions
+ String NON_UNIQUE_RESULT_EXCEPTION = PACKAGE_ + "NonUniqueResultException";
+ String OBJECT_NOT_FOUND_EXCEPTION = PACKAGE_ + "ObjectNotFoundException";
+ String PERSISTENCE_EXCEPTION = PACKAGE_ + "PersistenceException";
+
+
+ // ********** SPI **********
+
+ // JPA SPI package
+ String SPI_PACKAGE = PACKAGE_ + "spi";
+ String SPI_PACKAGE_ = SPI_PACKAGE + '.';
+
+ // JPA SPI interfaces
+ String ENTITY_MANAGER_FACTORY_PROVIDER = SPI_PACKAGE_ + "EntityManagerFactoryProvider";
+ String PERSISTENCE_INFO = SPI_PACKAGE_ + "PersistenceInfo";
+ String PERSISTENCE_PROVIDER = SPI_PACKAGE_ + "PersistenceProvider";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java
new file mode 100644
index 0000000000..ee86728e7a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Java source code or binary annotated element.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JavaResourceAnnotatedElement
+ extends JavaResourceNode
+{
+ // ********** annotations **********
+
+ /**
+ * String associated with changes to the "annotations" collection
+ */
+ String ANNOTATIONS_COLLECTION = "annotations"; //$NON-NLS-1$
+
+ /**
+ * Return the member's annotations in the order they appear.
+ * Do not return duplicate annotations as this error is handled by the Java
+ * compiler.
+ */
+ Iterator<Annotation> annotations();
+
+ /**
+ * Return the number of annotations.
+ */
+ int annotationsSize();
+
+ /**
+ * Return the annotation with the specified name.
+ * Return the first if there are duplicates in the source code.
+ * Return <code>null</code> if the member does not have an annotation
+ * with the specified name.
+ */
+ Annotation getAnnotation(String annotationName);
+
+ /**
+ * Return the annotation with the specified name.
+ * Return the first if there are duplicates in the source code.
+ * Do not return <code>null</code>; instead, return but a <em>null</em>
+ * annotation (i.e. an implementation that provides only default behavior)
+ * if the member does not have an annotation with the specified name.
+ */
+ Annotation getNonNullAnnotation(String annotationName);
+
+ /**
+ * Return the nestable annotations with the specified name in the order
+ * they appear.
+ * If nestable and container annotations are both specified on the
+ * member directly, return only the nestable annotations specified within
+ * the container annotation.
+ */
+ // TODO tie the singular and plural annotations together so we can generate
+ // a validation error when both are specified
+ Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName);
+
+ /**
+ * Add an annotation with the specified name.
+ * Return the newly-created annotation.
+ */
+ Annotation addAnnotation(String annotationName);
+
+ /**
+ * Add a new nestable annotation with the specified name.
+ * Create a new container annotation if necessary and add the nestable
+ * annotation to it.
+ * If both the nestable annotation and the container annotation already
+ * exist, then add to the container annotation, leaving the existing
+ * nestable annotation alone.
+ * If only the nestable annotation exists, then create the new container
+ * annotation and move the existing nestable annotation to it along with
+ * the new one. If neither annotation exists, then create a new nestable
+ * annotation.
+ */
+ NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
+
+ /**
+ * Move the nestable annotation found in the specified container
+ * annotation at the specified source index to the specified target index.
+ */
+ void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName);
+
+ /**
+ * Remove the specified annotation.
+ */
+ void removeAnnotation(String annotationName);
+
+ /**
+ * Remove the specified nestable annotation from the container annotation at the specified
+ * index.
+ * If there is no container, assume the index is zero and this does the same as
+ * {@link #removeAnnotation(String)}
+ */
+ void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
+
+ /**
+ * In preparation for a just-unnested annotation being written to the source
+ * file, add the just-unnested annotation to the member without firing
+ * change notification.
+ */
+ void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation);
+
+
+ // ********** queries **********
+
+ /**
+ * Return whether the underlying JDT member is currently annotated with any recognized
+ * annotations.
+ */
+ boolean isAnnotated();
+
+ /**
+ * Return the text range for the member's name.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java
new file mode 100644
index 0000000000..b5d051e51a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+
+/**
+ * Java class file
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaResourceClassFile
+ extends JavaResourceNode
+{
+ /**
+ * Return the class file's persistent type.
+ */
+ JavaResourcePersistentType getPersistentType();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java
new file mode 100644
index 0000000000..278ee38b5a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
+import org.eclipse.jpt.common.utility.CommandExecutor;
+
+/**
+ * Dali resource for JDT compilation unit.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JavaResourceCompilationUnit
+ extends JavaResourceNode.Root
+{
+ /**
+ * Return the corresponding JDT compilation unit.
+ */
+ ICompilationUnit getCompilationUnit();
+
+ /**
+ * Return the JPA project's annotation formatter. This is used to make any
+ * manipulated annotations reasonably readable after being written to the
+ * Java source file.
+ */
+ AnnotationEditFormatter getAnnotationEditFormatter();
+
+ /**
+ * This allows the resource model to modify the Java source code on the
+ * UI thread when it is executing on another thread.
+ */
+ CommandExecutor getModifySharedDocumentCommandExecutor();
+
+ /**
+ * Resolve type information that could be dependent on other files being
+ * added/removed.
+ */
+ void resolveTypes();
+
+ /**
+ * Something in Java has changed (typically either the compilation unit's
+ * source code or the Java classpath); synchronize the compilation unit's
+ * state with the Java source code etc.
+ */
+ void synchronizeWithJavaSource();
+
+ /**
+ * Build an AST for the compilation unit with its bindings resolved.
+ */
+ CompilationUnit buildASTRoot();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java
new file mode 100644
index 0000000000..eb54e73762
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.model.Model;
+import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
+
+/**
+ * Common interface for Java resource nodes (source code or binary).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JavaResourceNode
+ extends Model
+{
+ /**
+ * Return the node's parent node.
+ */
+ JavaResourceNode getParent();
+
+ /**
+ * Return the Eclipse file that contains the Java resource node
+ * (typically either a Java source code file or a JAR).
+ */
+ IFile getFile();
+
+ /**
+ * Return the root of the Java resource containment hierarchy
+ * (typically either a compilation unit or a package fragment root).
+ */
+ Root getRoot();
+
+ /**
+ * Return the [source] node's root (the compilation unit).
+ */
+ // TODO get rid of this method...?
+ JavaResourceCompilationUnit getJavaResourceCompilationUnit();
+
+ /**
+ * Return the [source] node's text range in the compilation unit's file.
+ */
+ TextRange getTextRange(CompilationUnit astRoot);
+
+ /**
+ * Initialize the [source] node from the specified AST.
+ */
+ void initialize(CompilationUnit astRoot);
+
+ /**
+ * Synchronize the [source] node with the specified AST.
+ */
+ void synchronizeWith(CompilationUnit astRoot);
+
+
+ /**
+ * Root of Java resource model containment hierarchy.
+ */
+ interface Root extends JavaResourceNode, JptResourceModel {
+
+ /**
+ * Return the root's Java resource persistent types.
+ */
+ Iterator<JavaResourcePersistentType> persistentTypes();
+ String PERSISTENT_TYPES_COLLECTION = "persistentTypes"; //$NON-NLS-1$
+
+ /**
+ * Called (via a hook in change notification) whenever anything in the
+ * Java resource model changes. Forwarded to listeners.
+ */
+ void resourceModelChanged();
+
+ /**
+ * Return the annotation provider that supplies the annotations found
+ * in the Java resource model.
+ */
+ JpaAnnotationProvider getAnnotationProvider();
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java
new file mode 100644
index 0000000000..a7946d5070
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ * Java source code of package-info
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface JavaResourcePackage
+ extends
+ JavaResourceAnnotatedElement
+{
+
+ /**
+ * The Java resource persistent package's name.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java
new file mode 100644
index 0000000000..36caa9f0cf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.Iterator;
+
+/**
+ * Java package fragment
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaResourcePackageFragment
+ extends JavaResourceNode
+{
+ /**
+ * Return the package fragment's class files that contain "persistable" types.
+ */
+ Iterator<JavaResourceClassFile> classFiles();
+ String CLASS_FILES_COLLECTION = "classFiles"; //$NON-NLS-1$
+
+ /**
+ * Return the size of the package fragment's class files.
+ */
+ int classFilesSize();
+
+ /**
+ * Return the package fragment's Java persistent types.
+ * Return only the files that are annotated with JPA annotations.
+ */
+ Iterator<JavaResourcePersistentType> persistedTypes();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java
new file mode 100644
index 0000000000..efb95c0fd0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.Iterator;
+
+/**
+ * Java package fragement root
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface JavaResourcePackageFragmentRoot
+ extends JavaResourceNode.Root
+{
+ /**
+ * Return the package fragment root's package fragments.
+ */
+ Iterator<JavaResourcePackageFragment> packageFragments();
+ String PACKAGE_FRAGMENTS_COLLECTION = "packageFragments"; //$NON-NLS-1$
+
+ /**
+ * Return the size of the package fragment root's package fragments.
+ */
+ int packageFragmentsSize();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java
new file mode 100644
index 0000000000..678b31759c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Dali resource for JDT compilation unit named package-info.java.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JavaResourcePackageInfoCompilationUnit
+ extends JavaResourceCompilationUnit
+{
+ JavaResourcePackage getPackage();
+ String PACKAGE = "package"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java
new file mode 100644
index 0000000000..653d7df204
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.MethodSignature;
+
+/**
+ * Java source code or binary persistent attribute (field or property)
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+//TODO handle:
+// @Basic
+// private String foo, bar;
+public interface JavaResourcePersistentAttribute
+ extends JavaResourcePersistentMember
+{
+
+ JavaResourcePersistentType getParent();
+
+ JavaResourcePersistentType getResourcePersistentType();
+
+ /**
+ * The Java resource persistent attribute's name does not change.
+ */
+ String getName();
+
+ /**
+ * Return a <em>null</em> annotation for the specified annotation name.
+ * Return <code>null</code> if the specified annotation name is
+ * <code>null</code>.
+ * The corresponding annotation definition must implement
+ * {@link AnnotationDefinition#buildNullAnnotation(JavaResourcePersistentMember)
+ * buildNullAnnotation()}.
+ */
+ Annotation buildNullAnnotation(String annotationName);
+
+ /**
+ * Whether the Java resource persistent attribute is a field does not change.
+ */
+ boolean isField();
+
+ /**
+ * Whether the Java resource persistent attribute is a property does not change.
+ */
+ boolean isProperty();
+
+ /**
+ * Return the access type explicitly specified by the javax.persistence.Access annotation.
+ * Return null if the Access annotation is not present.
+ * For JPA 1.0 this is always going to return null; Access annotation is not supported in 1.0.
+ */
+ AccessType getSpecifiedAccess();
+
+ /**
+ * Return whether the attribute's type implements or extends the specified
+ * type.
+ */
+ boolean typeIsSubTypeOf(String typeName);
+
+ /**
+ * Return whether the attribute's type is a "variable" primitive type
+ * (i.e. any primitive type except 'void').
+ */
+ boolean typeIsVariablePrimitive();
+
+ /**
+ * Return whether the Java resource persistent attribute is for the specified
+ * method.
+ */
+ boolean isFor(MethodSignature methodSignature, int occurrence);
+
+ /**
+ * @see java.lang.reflect.Modifier
+ */
+ int getModifiers();
+ String MODIFIERS_PROPERTY = "modifiers"; //$NON-NLS-1$
+
+ /**
+ * Return the resolved, qualified name of the attribute's type
+ * (e.g. "java.util.Collection" or "byte[]").
+ * If the type is an array, this name will include the appropriate number
+ * of bracket pairs.
+ * This name will not include the type's generic type arguments
+ * (e.g. "java.util.Collection<java.lang.String>" will only return
+ * "java.util.Collection").
+ * @see #typeTypeArgumentNames()
+ */
+ String getTypeName();
+ String TYPE_NAME_PROPERTY = "typeName"; //$NON-NLS-1$
+
+ /**
+ * Return whether the attribute type is an interface.
+ */
+ boolean typeIsInterface();
+ String TYPE_IS_INTERFACE_PROPERTY = "typeIsInterface"; //$NON-NLS-1$
+
+ /**
+ * Return whether the attribute type is an enum.
+ */
+ boolean typeIsEnum();
+ String TYPE_IS_ENUM_PROPERTY = "typeIsEnum"; //$NON-NLS-1$
+
+ /**
+ * Return the names of the attribute type's superclasses.
+ */
+ ListIterator<String> typeSuperclassNames();
+ String TYPE_SUPERCLASS_NAMES_LIST = "typeSuperclassNames"; //$NON-NLS-1$
+
+ /**
+ * Return the names of the attribute type's interfaces.
+ */
+ Iterator<String> typeInterfaceNames();
+ String TYPE_INTERFACE_NAMES_COLLECTION = "typeInterfaceNames"; //$NON-NLS-1$
+
+ /**
+ * Return the names of the attribute type's type arguments.
+ * The name for any argument that is an array will contain the appropriate
+ * number of bracket pairs.
+ * The names will not include any further generic type arguments.
+ */
+ ListIterator<String> typeTypeArgumentNames();
+ String TYPE_TYPE_ARGUMENT_NAMES_LIST = "typeTypeArgumentNames"; //$NON-NLS-1$
+
+ int typeTypeArgumentNamesSize();
+
+ String getTypeTypeArgumentName(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java
new file mode 100644
index 0000000000..81cd09bcee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.utility.Filter;
+
+/**
+ * Java source code or binary persistent member.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface JavaResourcePersistentMember
+ extends JavaResourceAnnotatedElement
+{
+
+ // ********** annotations **********
+
+ /**
+ * Set the specified primary annotation as the first annotation and remove
+ * all known persistence annotations (i.e. do not remove non-persistence
+ * annotations) not included in the specified list of supporting annotations.
+ * The specified primary annotation name can be <code>null</code> and, if
+ * the list of supporting annotations is empty, <em>all</em> the persistence
+ * annotations will be removed.
+ */
+ Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames);
+
+
+ // ********** queries **********
+
+ /**
+ * Return whether the underlying JDT member is persistable according to
+ * the JPA spec.
+ */
+ boolean isPersistable();
+ String PERSISTABLE_PROPERTY = "persistable"; //$NON-NLS-1$
+
+ /**
+ * Return whether the type is final.
+ */
+ boolean isFinal();
+ String FINAL_PROPERTY = "final"; //$NON-NLS-1$
+
+ /**
+ * Return whether the Java resource persistent member is for the specified
+ * member.
+ */
+ boolean isFor(String memberName, int occurrence);
+
+
+ // ********** behavior **********
+
+ /**
+ * Resolve type information that could be dependent on changes elsewhere
+ * in the workspace.
+ */
+ void resolveTypes(CompilationUnit astRoot);
+
+
+ // ********** persistable member filter **********
+
+ Filter<JavaResourcePersistentMember> PERSISTABLE_MEMBER_FILTER =
+ new Filter<JavaResourcePersistentMember>() {
+ public boolean accept(JavaResourcePersistentMember member) {
+ return member.isPersistable();
+ }
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java
new file mode 100644
index 0000000000..c1b91a4a90
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IPackageFragment;
+
+/**
+ * Java source code or binary persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.0
+ */
+public interface JavaResourcePersistentType
+ extends JavaResourcePersistentMember
+{
+ /**
+ * Return the unqualified (short) type name.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Return the fully qualified type name.
+ */
+ String getQualifiedName();
+ String QUALIFIED_NAME_PROPERTY = "qualifiedName"; //$NON-NLS-1$
+
+ /**
+ * Return the package name.
+ */
+ String getPackageName();
+ String PACKAGE_NAME_PROPERTY = "packageName"; //$NON-NLS-1$
+
+ /**
+ * Return the fully qualified name of the type's superclass.
+ */
+ String getSuperclassQualifiedName();
+ String SUPERCLASS_QUALIFIED_NAME_PROPERTY = "superclassQualifiedName"; //$NON-NLS-1$
+
+ /**
+ * Return the name of the type's "declaring type".
+ * Return <code>null</code> if the type is a top-level type.
+ */
+ String getDeclaringTypeName();
+ String DECLARING_TYPE_NAME_PROPERTY = "declaringTypeName"; //$NON-NLS-1$
+
+ /**
+ * Return whether the type is abstract.
+ */
+ boolean isAbstract();
+ String ABSTRACT_PROPERTY = "abstract"; //$NON-NLS-1$
+
+ /**
+ * Return whether the type is a member type.
+ */
+ boolean isMemberType();
+ String MEMBER_TYPE_PROPERTY = "memberType"; //$NON-NLS-1$
+
+ /**
+ * Return whether the type is static.
+ */
+ boolean isStatic();
+ String STATIC_PROPERTY = "static"; //$NON-NLS-1$
+
+ /**
+ * Return whether the type has a no-arg constructor (private, protected, or public)
+ */
+ boolean hasNoArgConstructor();
+ String NO_ARG_CONSTRUCTOR_PROPERTY = "noArgConstructor"; //$NON-NLS-1$
+
+ /**
+ * Return whether the type has a private no-arg constructor
+ */
+ boolean hasPrivateNoArgConstructor();
+ String PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY = "privateNoArgConstructor"; //$NON-NLS-1$
+
+ /**
+ * Return whether the type is annotated with any annotations that determine whether and
+ * how the type is persisted
+ */
+ boolean isMapped();
+
+ /**
+ * Return whether the type has any attributes that have JPA annotations
+ * on them (which can be used to infer the type's access type).
+ */
+ boolean hasAnyAnnotatedAttributes();
+
+ boolean isIn(IPackageFragment packageFragment);
+
+
+ // ********** types **********
+
+ /**
+ * Return the immediately nested types (children).
+ */
+ Iterator<JavaResourcePersistentType> types();
+ String TYPES_COLLECTION = "types"; //$NON-NLS-1$
+
+ /**
+ * Return all the types; the type itself, its children, its grandchildren,
+ * etc.
+ */
+ Iterator<JavaResourcePersistentType> allTypes();
+
+ /**
+ * Return the immediately nested persistable types.
+ */
+ Iterator<JavaResourcePersistentType> persistableTypes();
+
+
+ // ********** fields **********
+
+ /**
+ * Return the type's fields.
+ */
+ Iterator<JavaResourcePersistentAttribute> fields();
+ String FIELDS_COLLECTION = "fields"; //$NON-NLS-1$
+
+ /**
+ * Return the type's persistable fields.
+ */
+ Iterator<JavaResourcePersistentAttribute> persistableFields();
+
+ /**
+ * A convenience method that returns the persistableFields that also
+ * have the Access annotation with a value of FIELD
+ */
+ Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess();
+
+
+ // ********** methods **********
+
+ /**
+ * Return the type's methods. This returns *all* methods from the JDT Type
+ */
+ Iterator<JavaResourcePersistentAttribute> methods();
+ String METHODS_COLLECTION = "methods"; //$NON-NLS-1$
+
+ /**
+ * Return the type's persistable properties. This returns only the getter methods
+ * that match the JavaBeans criteria for JPA, hence the name properties instead of methods
+ */
+ Iterator<JavaResourcePersistentAttribute> persistableProperties();
+
+ /**
+ * A convenience method that returns the persistableProperties that also
+ * have the Access annotation with a value of PROPERTY
+ */
+ Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess();
+
+
+ // ********** attributes **********
+
+ /**
+ * Return the type's persistable fields and properties.
+ */
+ Iterator<JavaResourcePersistentAttribute> persistableAttributes();
+
+ /**
+ * Return the persistable properties and/or fields given the non-null specified access type
+ */
+ Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess);
+
+ class Tools {
+ // ********** Access type **********
+
+ /**
+ * Return the access type currently implied by the specified Java source
+ * code or class file:<ul>
+ * <li>if any fields are annotated =>
+ * {@link AccessType#FIELD FIELD}
+ * <li>if only properties are annotated =>
+ * {@link AccessType#PROPERTY PROPERTY}
+ * <li>if neither are annotated =>
+ * <code>null</code>
+ *
+ * </ul>
+ */
+ public static AccessType buildAccess(JavaResourcePersistentType jrpType) {
+ for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableFields(); stream.hasNext(); ) {
+ if (stream.next().isAnnotated()) {
+ // any field is annotated => FIELD
+ return AccessType.FIELD;
+ }
+ }
+
+ for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableProperties(); stream.hasNext(); ) {
+ if (stream.next().isAnnotated()) {
+ // none of the fields are annotated and a getter is annotated => PROPERTY
+ return AccessType.PROPERTY;
+ }
+ }
+
+ // nothing is annotated
+ return null;
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java
new file mode 100644
index 0000000000..59a36848df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.IType;
+
+/**
+ * Java persistent type cache - used to hold "external" types
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface JavaResourcePersistentTypeCache
+ extends JavaResourceNode.Root
+{
+
+ /**
+ * Return the size of the cache's persistent types.
+ */
+ int persistentTypesSize();
+
+ /**
+ * Add a Java resource persistent type for the specified JDT type to the
+ * cache. Return the new type.
+ */
+ JavaResourcePersistentType addPersistentType(IType jdtType);
+
+ /**
+ * Remove all the persistent types associated with the specified JAR file.
+ * Return whether any persistent types were removed.
+ */
+ boolean removePersistentTypes(IFile jarFile);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnAnnotation.java
new file mode 100644
index 0000000000..045c92700d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.JoinColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JoinColumnAnnotation
+ extends BaseJoinColumnAnnotation
+{
+ String ANNOTATION_NAME = JPA.JOIN_COLUMN;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java
new file mode 100644
index 0000000000..ae98014d95
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.JoinColumns
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface JoinColumnsAnnotation
+ extends ContainerAnnotation<NestableJoinColumnAnnotation>
+{
+ String ANNOTATION_NAME = JPA.JOIN_COLUMNS;
+
+ String JOIN_COLUMNS_LIST = "joinColumns"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java
new file mode 100644
index 0000000000..f977fb2fb7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.JoinTable</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface JoinTableAnnotation
+ extends ReferenceTableAnnotation
+{
+ String ANNOTATION_NAME = JPA.JOIN_TABLE;
+
+
+ // ********** inverse join columns **********
+
+ /**
+ * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ ListIterator<JoinColumnAnnotation> inverseJoinColumns();
+ String INVERSE_JOIN_COLUMNS_LIST = "inverseJoinColumns"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
+ */
+ int inverseJoinColumnsSize();
+
+ /**
+ * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
+ */
+ JoinColumnAnnotation inverseJoinColumnAt(int index);
+
+ /**
+ * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
+ */
+ int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn);
+
+ /**
+ * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
+ */
+ JoinColumnAnnotation addInverseJoinColumn(int index);
+
+ /**
+ * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
+ */
+ void moveInverseJoinColumn(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
+ */
+ void removeInverseJoinColumn(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java
new file mode 100644
index 0000000000..48ea23da02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Lob
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface LobAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.LOB;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToManyAnnotation.java
new file mode 100644
index 0000000000..f3495256ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToManyAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.ManyToMany</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface ManyToManyAnnotation
+ extends OwnableRelationshipMappingAnnotation
+{
+ String ANNOTATION_NAME = JPA.MANY_TO_MANY;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToOneAnnotation.java
new file mode 100644
index 0000000000..3890b40ac2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToOneAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.ManyToOne</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface ManyToOneAnnotation
+ extends SingleRelationshipMappingAnnotation
+{
+ String ANNOTATION_NAME = JPA.MANY_TO_ONE;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java
new file mode 100644
index 0000000000..66786e77a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.MapKey
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface MapKeyAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.MAP_KEY;
+
+ /**
+ * Corresponds to the 'name' element of the MapKey annotation.
+ * Returns null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the MapKey annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the MapKey annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'name' element.
+ * Return false if the element does not exist.
+ */
+ boolean nameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java
new file mode 100644
index 0000000000..5b291ecf7c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.MappedSuperclass
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface MappedSuperclassAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.MAPPED_SUPERCLASS;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java
new file mode 100644
index 0000000000..f6701fe0e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotations:<ul>
+ * <li><code>javax.persistence.Column<code>
+ * <li><code>javax.persistence.MapKeyColumn<code>
+ * <li><code>javax.persistence.JoinColumn<code>
+ * <li><code>javax.persistence.MapKeyJoinColumn<code>
+ * <li><code>javax.persistence.DiscriminatorColumn<code>
+ * <li><code>javax.persistence.OrderColumn<code>
+ * <li><code>javax.persistence.PrimaryKeyJoinColumn<code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface NamedColumnAnnotation
+ extends Annotation
+{
+ /**
+ * Return whether the annotation exists in Java.
+ */
+ boolean isSpecified();
+
+
+ // ********** name **********
+
+ /**
+ * Corresponds to the 'name' element of the *Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the *Column annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the *Column annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'name' element.
+ * Return false if the element does not exist.
+ */
+ boolean nameTouches(int pos, CompilationUnit astRoot);
+
+
+ // ********** column definition **********
+
+ /**
+ * Corresponds to the 'columnDefinition' element of the *Column annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getColumnDefinition();
+ String COLUMN_DEFINITION_PROPERTY = "columnDefinition"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'columnDefinition' element of the *Column annotation.
+ * Set to null to remove the element.
+ */
+ void setColumnDefinition(String columnDefinition);
+
+ /**
+ * Return the {@link TextRange} for the 'columnDefinition' element. If the
+ * element does not exist return the {@link TextRange} for the *Column annotation.
+ */
+ TextRange getColumnDefinitionTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java
new file mode 100644
index 0000000000..fb1b298840
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.NamedNativeQueries
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface NamedNativeQueriesAnnotation
+ extends ContainerAnnotation<NestableNamedNativeQueryAnnotation>
+{
+ String ANNOTATION_NAME = JPA.NAMED_NATIVE_QUERIES;
+
+ String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueries"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueryAnnotation.java
new file mode 100644
index 0000000000..9f29a33134
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueryAnnotation.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.NamedNativeQuery</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface NamedNativeQueryAnnotation
+ extends QueryAnnotation
+{
+ String ANNOTATION_NAME = JPA.NAMED_NATIVE_QUERY;
+
+
+ // ********** result class **********
+
+ /**
+ * Corresponds to the 'resultClass' element of the NamedNativeQuery annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getResultClass();
+ String RESULT_CLASS_PROPERTY = "resultClass"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'resultClass' element of the NamedNativeQuery annotation.
+ * Set to null to remove the element.
+ */
+ void setResultClass(String resultClass);
+
+ /**
+ * Return the {@link TextRange} for the 'resultClass' element. If element
+ * does not exist return the {@link TextRange} for the NamedNativeQuery annotation.
+ */
+ TextRange getResultClassTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the named native query's fully-qualified result class name as
+ * resolved by the AST's bindings.
+ * <pre>
+ * &#64;NamedNativeQuery(resultClass=Employee.class)
+ * </pre>
+ * will return <code>"model.Employee"</code> if there is an import for
+ * <code>model.Employee</code>.
+ */
+ String getFullyQualifiedResultClassName();
+
+
+ // ********** result set mapping **********
+
+ /**
+ * Corresponds to the 'resultSetMapping' element of the NamedNativeQuery annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getResultSetMapping();
+ String RESULT_SET_MAPPING_PROPERTY = "resultSetMapping"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'resultSetMapping' element of the NamedNativeQuery annotation.
+ * Set to null to remove the element.
+ */
+ void setResultSetMapping(String resultSetMapping);
+
+ /**
+ * Return the {@link TextRange} for the 'resultSetMapping' element. If element
+ * does not exist return the {@link TextRange} for the NamedNativeQuery annotation.
+ */
+ TextRange getResultSetMappingTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java
new file mode 100644
index 0000000000..327077e7d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.NamedQueries
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface NamedQueriesAnnotation
+ extends ContainerAnnotation<NestableNamedQueryAnnotation>
+{
+ String ANNOTATION_NAME = JPA.NAMED_QUERIES;
+
+ String NAMED_QUERIES_LIST = "namedQueries"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueryAnnotation.java
new file mode 100644
index 0000000000..e0c098e2b8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueryAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.NamedQuery</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
+ */
+public interface NamedQueryAnnotation
+ extends QueryAnnotation
+{
+ String ANNOTATION_NAME = JPA.NAMED_QUERY;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java
new file mode 100644
index 0000000000..a0f2c81cdb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+
+/**
+ * Interface for dealing with annotations that can be "nested" within arrays.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface NestableAnnotation
+ extends Annotation
+{
+ /**
+ * Move the annotation to the specified index within its container array.
+ * This should only be called when the annotation is actually nested
+ * (as opposed to stand-alone).
+ */
+ void moveAnnotation(int index);
+
+ /**
+ * Convert the annotation from "stand-alone" to "nested" within the "container"
+ * annotation adapted by the specified adapter at the specified index.
+ * The index may have a value of only <code>0</code> or <code>1</code>.
+ * <p>
+ * This is used to convert an annotation that is part of the "combination"
+ * pattern where a list containing elements of the annotation
+ * (e.g. {@link JoinColumnAnnotation}) can be represented by either the
+ * annotation itself (when there is only a single element in the collection)
+ * or a "container" annotation (e.g. {@link JoinColumnsAnnotation}) that
+ * holds only a single <code>value</code> element that is the array of
+ * "nested" annnotations.
+ *
+ * @see #convertToStandAlone()
+ */
+ void convertToNested(ContainerAnnotation<? extends NestableAnnotation> containerAnnotation, DeclarationAnnotationAdapter containerAnnotationAdapter, int index);
+
+ /**
+ * Convert the annotation from "nested" within the "container" annotation
+ * to "stand-alone".
+ *
+ * @see #convertToNested(ContainerAnnotation, DeclarationAnnotationAdapter, int)
+ */
+ void convertToStandAlone();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java
new file mode 100644
index 0000000000..8953f5e497
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.AssociationOverride</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestableAssociationOverrideAnnotation
+ extends AssociationOverrideAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java
new file mode 100644
index 0000000000..99ab9db7da
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.AttributeOverride</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestableAttributeOverrideAnnotation
+ extends AttributeOverrideAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java
new file mode 100644
index 0000000000..b762d90617
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.JoinColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestableJoinColumnAnnotation
+ extends JoinColumnAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java
new file mode 100644
index 0000000000..24696971f2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.NamedNativeQuery</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestableNamedNativeQueryAnnotation
+ extends NamedNativeQueryAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java
new file mode 100644
index 0000000000..c8ae307462
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.NamedQuery</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public interface NestableNamedQueryAnnotation
+ extends NamedQueryAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java
new file mode 100644
index 0000000000..4a10acae05
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.PrimaryKeyJoinColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestablePrimaryKeyJoinColumnAnnotation
+ extends PrimaryKeyJoinColumnAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java
new file mode 100644
index 0000000000..100876f9bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.QueryHint</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestableQueryHintAnnotation
+ extends QueryHintAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java
new file mode 100644
index 0000000000..f9aeee0cd7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.SecondaryTable</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestableSecondaryTableAnnotation
+ extends SecondaryTableAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java
new file mode 100644
index 0000000000..d0dd044468
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.UniqueConstraint</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface NestableUniqueConstraintAnnotation
+ extends UniqueConstraintAnnotation, NestableAnnotation
+{
+ // combine interfaces
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToManyAnnotation.java
new file mode 100644
index 0000000000..9b57b0cf6c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToManyAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.OneToMany</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OneToManyAnnotation
+ extends OwnableRelationshipMappingAnnotation
+{
+ String ANNOTATION_NAME = JPA.ONE_TO_MANY;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToOneAnnotation.java
new file mode 100644
index 0000000000..185ffb304f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToOneAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.OneToOne</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OneToOneAnnotation
+ extends SingleRelationshipMappingAnnotation, OwnableRelationshipMappingAnnotation
+{
+ String ANNOTATION_NAME = JPA.ONE_TO_ONE;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java
new file mode 100644
index 0000000000..b74f454fb8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.OrderBy
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OrderByAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.ORDER_BY;
+
+ /**
+ * Corresponds to the 'value' element of the OrderBy annotation.
+ * Return null if the element does not exist in the annotation.
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the OrderBy annotation.
+ * Setting the element to null will not remove the OrderBy annotation.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the OrderBy annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java
new file mode 100644
index 0000000000..8ca90b80e4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Common protocol for
+ * javax.persistence.AttributeOverride
+ * javax.persistence.AssociationOverride
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface OverrideAnnotation
+ extends Annotation
+{
+
+ /**
+ * Corresponds to the 'name' element of the override annotations.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the override annotations.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If element
+ * does not exist return the {@link TextRange} for the override annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'name' element.
+ * Return false if the element does not exist in Java.
+ */
+ boolean nameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OwnableRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OwnableRelationshipMappingAnnotation.java
new file mode 100644
index 0000000000..6e7a441534
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OwnableRelationshipMappingAnnotation.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Represents a relationship mapping annotation that may have the
+ * <code>mappedBy</code> element:<ul>
+ * <li><code>javax.persistence.ManyToMany</code>
+ * <li><code>javax.persistence.OneToMany</code>
+ * <li><code>javax.persistence.OneToOne</code>
+ * </ul>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface OwnableRelationshipMappingAnnotation
+ extends RelationshipMappingAnnotation
+{
+// TODO bjv rename to MappedByRelationshipMappingAnnotation
+ /**
+ * Corresponds to the 'mappedBy' element of the annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getMappedBy();
+ String MAPPED_BY_PROPERTY = "mappedBy"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'mappedBy' element of the annotation.
+ * Set to null to remove the element.
+ */
+ void setMappedBy(String mappedBy);
+
+ /**
+ * Return the {@link TextRange} for the 'mappedBy' element. If the element
+ * does not exist return the {@link TextRange} for the annotation.
+ */
+ TextRange getMappedByTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'mappedBy' element.
+ * Return false if the element does not exist.
+ */
+ boolean mappedByTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java
new file mode 100644
index 0000000000..1400ca6969
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.PrimaryKeyJoinColumn</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface PrimaryKeyJoinColumnAnnotation
+ extends NamedColumnAnnotation
+{
+ String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMN;
+
+
+ // ********** referenced column name **********
+
+ /**
+ * Corresponds to the 'referencedColumnName' element of the PrimaryKeyJoinColumn annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getReferencedColumnName();
+ String REFERENCED_COLUMN_NAME_PROPERTY = "referencedColumnName"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'referencedColumnName' element of the PrimaryKeyJoinColumn annotation.
+ * Set the to null to remove the element.
+ */
+ void setReferencedColumnName(String referencedColumnName);
+
+ /**
+ * Return the {@link TextRange} for the 'referencedColumnName' element.
+ * If the element does not exist return the {@link TextRange} for the PrimaryKeyJoinColumn annotation.
+ */
+ TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'referencedColumnName' element.
+ * Return false if the element does not exist.
+ */
+ boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java
new file mode 100644
index 0000000000..5cda025f8c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.PrimaryKeyJoinColumns
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface PrimaryKeyJoinColumnsAnnotation
+ extends ContainerAnnotation<NestablePrimaryKeyJoinColumnAnnotation>
+{
+ String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMNS;
+
+ String PK_JOIN_COLUMNS_LIST = "pkJoinColumns"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java
new file mode 100644
index 0000000000..c888f0eeb6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Common protocol among:<ul>
+ * <li><code>javax.persistence.NamedQuery</code>
+ * <li><code>javax.persistence.NamedNativeQuery</code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.2
+ */
+public interface QueryAnnotation
+ extends Annotation
+{
+ // ********** name **********
+
+ /**
+ * Corresponds to the 'name' element of the *Query annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the *Query annotation.
+ * Set to null to remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If element
+ * does not exist return the {@link TextRange} for the *Query annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+
+ // ********** query **********
+
+ /**
+ * Corresponds to the 'query' element of the *Query annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getQuery();
+ String QUERY_PROPERTY = "query"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'query' element of the *Query annotation.
+ * Set to null to remove the element.
+ */
+ void setQuery(String query);
+
+ /**
+ * Return the {@link TextRange} for the 'query' element. If element
+ * does not exist return the {@link TextRange} for the *Query annotation.
+ */
+ TextRange getQueryTextRange(CompilationUnit astRoot);
+
+
+ // ********** hints **********
+
+ /**
+ * Corresponds to the 'hints' element of the *Query annotation.
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ ListIterator<QueryHintAnnotation> hints();
+ String HINTS_LIST = "hints"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'hints' element of the *Query annotation.
+ */
+ int hintsSize();
+
+ /**
+ * Corresponds to the 'hints' element of the *Query annotation.
+ */
+ QueryHintAnnotation hintAt(int index);
+
+ /**
+ * Corresponds to the 'hints' element of the *Query annotation.
+ */
+ int indexOfHint(QueryHintAnnotation hint);
+
+ /**
+ * Corresponds to the 'hints' element of the *Query annotation.
+ */
+ QueryHintAnnotation addHint(int index);
+
+ /**
+ * Corresponds to the 'hints' element of the *Query annotation.
+ */
+ void moveHint(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'hints' element of the *Query annotation.
+ */
+ void removeHint(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java
new file mode 100644
index 0000000000..41c13bee65
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.QueryHint
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface QueryHintAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.QUERY_HINT;
+
+ /**
+ * Corresponds to the 'name' element of the QueryHint annotation.
+ * Return null if the element does not exist in the annotation
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the QueryHint annotation.
+ * Setting to null will remove the element.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the QueryHint annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'value' element of the QueryHint annotation.
+ * Return null if the element does not exist in the annotation
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the QueryHint annotation.
+ * Setting to null will remove the element.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the QueryHint annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java
new file mode 100644
index 0000000000..eef04b7335
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+
+/**
+ * Corresponds to the JPA annotations:<ul>
+ * <li><code>javax.persistence.JoinTable</code>
+ * <li><code>javax.persistence.CollectionTable</code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public interface ReferenceTableAnnotation
+ extends BaseTableAnnotation
+{
+ // ********** join columns **********
+
+ /**
+ * Corresponds to the 'joinColumns' element of the JoinTable annotation.
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ ListIterator<JoinColumnAnnotation> joinColumns();
+ String JOIN_COLUMNS_LIST = "joinColumns"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'joinColumns' element of the JoinTable annotation.
+ */
+ int joinColumnsSize();
+
+ /**
+ * Corresponds to the 'joinColumns' element of the JoinTable annotation.
+ */
+ JoinColumnAnnotation joinColumnAt(int index);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the JoinTable annotation.
+ */
+ int indexOfJoinColumn(JoinColumnAnnotation joinColumn);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the JoinTable annotation.
+ */
+ JoinColumnAnnotation addJoinColumn(int index);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the JoinTable annotation.
+ */
+ void moveJoinColumn(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'joinColumns' element of the JoinTable annotation.
+ */
+ void removeJoinColumn(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java
new file mode 100644
index 0000000000..9e33759d42
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Common protocol among the following relationship mappings:<ul>
+ * <li><code>javax.persistence.ManyToOne</code>
+ * <li><code>javax.persistence.ManyToMany</code>
+ * <li><code>javax.persistence.OneToMany</code>
+ * <li><code>javax.persistence.OneToOne</code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface RelationshipMappingAnnotation
+ extends Annotation
+{
+ /**
+ * Corresponds to the 'targetEntity' element of the relationship mapping
+ * annotations.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * &#64;ManyToMany(targetEntity=Employee.class)
+ * </pre>
+ * will return "Employee"
+ */
+ String getTargetEntity();
+ String TARGET_ENTITY_PROPERTY = "targetEntity"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'targetEntity' element of the relationship mapping
+ * annotations.
+ * Set to null to remove the element.
+ */
+ void setTargetEntity(String targetEntity);
+
+ /**
+ * Return the {@link TextRange} for the 'targetEntity' element. If the element
+ * does not exist return the {@link TextRange} for the relationship mapping annotation.
+ */
+ TextRange getTargetEntityTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the fully-qualified target entity class name as resolved by the
+ * AST's bindings.
+ * <pre>
+ * &#64;ManyToMany(targetEntity=Employee.class)
+ * </pre>
+ * will return <code>"model.Employee"</code> if there is an import for
+ * <code>model.Employee</code>.
+ */
+ String getFullyQualifiedTargetEntityClassName();
+
+
+ /**
+ * Corresponds to the 'fetch' element of the relationship mapping annotations.
+ * Return null if the element does not exist in Java.
+ */
+ FetchType getFetch();
+ String FETCH_PROPERTY = "fetch"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'fetch' element of the relationship annotations.
+ * Set to null to remove the element.
+ */
+ void setFetch(FetchType fetch);
+
+ /**
+ * Return the {@link TextRange} for the 'fetch' element. If the element
+ * does not exist return the {@link TextRange} for the relationship mapping annotation.
+ */
+ TextRange getFetchTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ boolean isCascadeAll();
+ String CASCADE_ALL_PROPERTY = "cascadeAll"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ void setCascadeAll(boolean all);
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ boolean isCascadeMerge();
+ String CASCADE_MERGE_PROPERTY = "cascadeMerge"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ void setCascadeMerge(boolean merge);
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ boolean isCascadePersist();
+ String CASCADE_PERSIST_PROPERTY = "cascadePersist"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ void setCascadePersist(boolean persist);
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ boolean isCascadeRefresh();
+ String CASCADE_REFRESH_PROPERTY = "cascadeRefresh"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ void setCascadeRefresh(boolean refresh);
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ boolean isCascadeRemove();
+ String CASCADE_REMOVE_PROPERTY = "cascadeRemove"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'cascade' element of the relationship annotations.
+ */
+ void setCascadeRemove(boolean remove);
+
+ /**
+ * Return the {@link TextRange} for the 'cascade' element. If the element
+ * does not exist return the {@link TextRange} for the relationship mapping annotation.
+ */
+ TextRange getCascadeTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java
new file mode 100644
index 0000000000..ffef75571b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.SecondaryTable</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface SecondaryTableAnnotation
+ extends BaseTableAnnotation
+{
+ String ANNOTATION_NAME = JPA.SECONDARY_TABLE;
+
+
+ // ********** primary key join columns **********
+
+ /**
+ * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns();
+ String PK_JOIN_COLUMNS_LIST = "pkJoinColumns"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
+ */
+ int pkJoinColumnsSize();
+
+ /**
+ * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
+ */
+ PrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index);
+
+ /**
+ * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
+ */
+ int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumn);
+
+ /**
+ * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
+ */
+ PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index);
+
+ /**
+ * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
+ */
+ void removePkJoinColumn(int index);
+
+ /**
+ * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
+ */
+ void movePkJoinColumn(int targetIndex, int sourceIndex);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java
new file mode 100644
index 0000000000..841a3b9fe0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.SecondaryTables
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface SecondaryTablesAnnotation
+ extends ContainerAnnotation<NestableSecondaryTableAnnotation>
+{
+ String ANNOTATION_NAME = JPA.SECONDARY_TABLES;
+
+ String SECONDARY_TABLES_LIST = "secondaryTables"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java
new file mode 100644
index 0000000000..fee538feb7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.SequenceGenerator
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface SequenceGeneratorAnnotation
+ extends GeneratorAnnotation
+{
+ String ANNOTATION_NAME = JPA.SEQUENCE_GENERATOR;
+
+ /**
+ * Corresponds to the 'sequenceName' element of the *Generator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getSequenceName();
+ String SEQUENCE_NAME_PROPERTY = "sequenceName"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'sequenceName' element of the *Generator annotation.
+ * Set to null to remove the element.
+ */
+ void setSequenceName(String sequenceName);
+
+ /**
+ * Return the {@link TextRange} for the 'sequenceName' element. If the element
+ * does not exist return the {@link TextRange} for the SequenceGenerator annotation.
+ */
+ TextRange getSequenceNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'sequenceName' element.
+ * Return false if the element does not exist.
+ */
+ boolean sequenceNameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SingleRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SingleRelationshipMappingAnnotation.java
new file mode 100644
index 0000000000..7506b06d1d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SingleRelationshipMappingAnnotation.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Common protocol among the following relationship mappings:<ul>
+ * <li><code>javax.persistence.ManyToOne</code>
+ * <li><code>javax.persistence.OneToOne</code>
+ * </ul>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface SingleRelationshipMappingAnnotation
+ extends RelationshipMappingAnnotation
+{
+ /**
+ * Corresponds to the optional element of a single relationship annotation.
+ * Returns null if the optional element does not exist in java.
+ */
+ Boolean getOptional();
+
+ /**
+ * Corresponds to the optional element of a single relationship annotation.
+ * Set to null to remove the optional element.
+ */
+ void setOptional(Boolean optional);
+ String OPTIONAL_PROPERTY = "optional"; //$NON-NLS-1$
+
+ /**
+ * Return the {@link TextRange} for the optional element. If the optional element
+ * does not exist return the {@link TextRange} for the ManyToOne annotation.
+ */
+ TextRange getOptionalTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableAnnotation.java
new file mode 100644
index 0000000000..88cc9cde36
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * <code>javax.persistence.Table</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface TableAnnotation
+ extends BaseTableAnnotation
+{
+ String ANNOTATION_NAME = JPA.TABLE;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
new file mode 100644
index 0000000000..5e77cc046b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.TableGenerator
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.1
+ * @since 2.0
+ */
+public interface TableGeneratorAnnotation
+ extends GeneratorAnnotation
+{
+ String ANNOTATION_NAME = JPA.TABLE_GENERATOR;
+
+ /**
+ * Corresponds to the 'table' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getTable();
+ String TABLE_PROPERTY = "table"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'table' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setTable(String table);
+
+ /**
+ * Return the {@link TextRange} for the 'table' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getTableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'table' element.
+ * Return false if the element does not exist.
+ */
+ boolean tableTouches(int pos, CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'schema' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getSchema();
+ String SCHEMA_PROPERTY = "schema"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'schema' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setSchema(String schema);
+
+ /**
+ * Return the {@link TextRange} for the 'schema' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getSchemaTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'schema' element.
+ * Return false if the element does not exist.
+ */
+ boolean schemaTouches(int pos, CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'catalog' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getCatalog();
+ String CATALOG_PROPERTY = "catalog"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'catalog' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setCatalog(String catalog);
+
+ /**
+ * Return the {@link TextRange} for the 'catalog' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getCatalogTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'catalog' element.
+ * Return false if the element does not exist.
+ */
+ boolean catalogTouches(int pos, CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'pkColumnName' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getPkColumnName();
+ String PK_COLUMN_NAME_PROPERTY = "pkColumnName"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'pkColumnName' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setPkColumnName(String pkColumnName);
+
+ /**
+ * Return the {@link TextRange} for the 'pkColumnName' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getPkColumnNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'pkColumnName' element.
+ * Return false if the element does not exist.
+ */
+ boolean pkColumnNameTouches(int pos, CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'valueColumnName' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getValueColumnName();
+ String VALUE_COLUMN_NAME_PROPERTY = "valueColumnName"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'valueColumnName' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setValueColumnName(String valueColumnName);
+
+ /**
+ * Return the {@link TextRange} for the 'valueColumnName' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getValueColumnNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'valueColumnName' element.
+ * Return false if the element does not exist.
+ */
+ boolean valueColumnNameTouches(int pos, CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'pkColumnValue' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getPkColumnValue();
+ String PK_COLUMN_VALUE_PROPERTY = "pkColumnValue"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'pkColumnValue' element of the TableGenerator annotation.
+ * Set to null to remove the element.
+ */
+ void setPkColumnValue(String pkColumnValue);
+
+ /**
+ * Return the {@link TextRange} for the 'pkColumnValue' element. If the element
+ * does not exist return the {@link TextRange} for the TableGenerator annotation.
+ */
+ TextRange getPkColumnValueTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified position touches the 'pkColumnValue' element.
+ * Return false if the element does not exist.
+ */
+ boolean pkColumnValueTouches(int pos, CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
+ * Return null if the element does not exist in Java.
+ */
+ ListIterator<UniqueConstraintAnnotation> uniqueConstraints();
+ String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
+ */
+ int uniqueConstraintsSize();
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
+ */
+ UniqueConstraintAnnotation uniqueConstraintAt(int index);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
+ */
+ int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
+ */
+ UniqueConstraintAnnotation addUniqueConstraint(int index);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
+ */
+ void moveUniqueConstraint(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
+ */
+ void removeUniqueConstraint(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java
new file mode 100644
index 0000000000..102a8933f3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Temporal
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface TemporalAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.TEMPORAL;
+
+ /**
+ * Corresponds to the 'value' element of the Temporal annotation.
+ * Return null if the element does not exist in Java.
+ */
+ TemporalType getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'value' element of the Temporal annotation.
+ * Set to null to remove the element.
+ */
+ void setValue(TemporalType value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the Temporal annotation.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalType.java
new file mode 100644
index 0000000000..f81fa26b2b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalType.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA enum
+ * javax.persistence.TemporalType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public enum TemporalType {
+
+ DATE(JPA.TEMPORAL_TYPE__DATE),
+ TIME(JPA.TEMPORAL_TYPE__TIME),
+ TIMESTAMP(JPA.TEMPORAL_TYPE__TIMESTAMP);
+
+
+ private String javaAnnotationValue;
+
+ TemporalType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static TemporalType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static TemporalType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (TemporalType temporalType : TemporalType.values()) {
+ if (temporalType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return temporalType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(TemporalType temporalType) {
+ return (temporalType == null) ? null : temporalType.getJavaAnnotationValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java
new file mode 100644
index 0000000000..527b6c8185
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Transient
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface TransientAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.TRANSIENT;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java
new file mode 100644
index 0000000000..39a4c86cd4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.UniqueConstraint
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface UniqueConstraintAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.UNIQUE_CONSTRAINT;
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ * Return null if the element does not exist in the annotation.
+ */
+ ListIterator<String> columnNames();
+ String COLUMN_NAMES_LIST = "columnNames"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ */
+ int columnNamesSize();
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ */
+ void addColumnName(String columnName);
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ */
+ void addColumnName(int index, String columnName);
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ */
+ void moveColumnName(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ */
+ void removeColumnName(String columnName);
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ */
+ void removeColumnName(int index);
+
+ /**
+ * Return whether the specified position touches the 'columnNames' element.
+ * Return false if the element does not exist.
+ */
+ boolean columnNamesTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java
new file mode 100644
index 0000000000..d2f470e5b6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.java;
+
+/**
+ * Corresponds to the JPA annotation
+ * javax.persistence.Version
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.2
+ * @since 2.0
+ */
+public interface VersionAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA.VERSION;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlAttributeMapping.java
new file mode 100644
index 0000000000..87340360aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlAttributeMapping.java
@@ -0,0 +1,280 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Xml Attribute Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlAttributeMapping()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlAttributeMapping
+ extends AbstractJpaEObject
+ implements XmlAttributeMapping
+{
+ /**
+ * 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 #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 AbstractXmlAttributeMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_ATTRIBUTE_MAPPING;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder_Access()
+ * @model
+ * @generated
+ */
+ public AccessType getAccess()
+ {
+ return access;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlAttributeMapping#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.jpa.core.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.ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS, oldAccess, access));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlAttributeMapping_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.jpa.core.resource.orm.AbstractXmlAttributeMapping#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.ABSTRACT_XML_ATTRIBUTE_MAPPING__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS:
+ return getAccess();
+ case OrmPackage.ABSTRACT_XML_ATTRIBUTE_MAPPING__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.ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS:
+ setAccess((AccessType)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_ATTRIBUTE_MAPPING__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.ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS:
+ setAccess(ACCESS_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_ATTRIBUTE_MAPPING__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.ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS:
+ return access != ACCESS_EDEFAULT;
+ case OrmPackage.ABSTRACT_XML_ATTRIBUTE_MAPPING__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(" (access: ");
+ result.append(access);
+ result.append(", name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** validation ***********
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+ // ********** translators **********
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlAttributeMapping_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildAccessTranslator() {
+ return new Translator(JPA.ACCESS, OrmPackage.eINSTANCE.getXmlAccessHolder_Access(), Translator.DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlColumn.java
new file mode 100644
index 0000000000..639d59f224
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlColumn.java
@@ -0,0 +1,500 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.common.core.internal.utility.translators.BooleanTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Xml Abstract Column</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getInsertable <em>Insertable</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getNullable <em>Nullable</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getTable <em>Table</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getUnique <em>Unique</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getUpdatable <em>Updatable</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlColumn extends AbstractXmlNamedColumn
+{
+ /**
+ * 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractXmlColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_COLUMN;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn_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.jpa.core.resource.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 #getInsertable()
+ * @generated
+ */
+ public void setInsertable(Boolean newInsertable)
+ {
+ Boolean oldInsertable = insertable;
+ insertable = newInsertable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__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.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn_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.jpa.core.resource.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 #getNullable()
+ * @generated
+ */
+ public void setNullable(Boolean newNullable)
+ {
+ Boolean oldNullable = nullable;
+ nullable = newNullable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__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.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn_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.jpa.core.resource.orm.AbstractXmlColumn#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.ABSTRACT_XML_COLUMN__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.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn_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.jpa.core.resource.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 #getUnique()
+ * @generated
+ */
+ public void setUnique(Boolean newUnique)
+ {
+ Boolean oldUnique = unique;
+ unique = newUnique;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__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.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn_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.jpa.core.resource.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 #getUpdatable()
+ * @generated
+ */
+ public void setUpdatable(Boolean newUpdatable)
+ {
+ Boolean oldUpdatable = updatable;
+ updatable = newUpdatable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE, oldUpdatable, updatable));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE:
+ return getInsertable();
+ case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE:
+ return getNullable();
+ case OrmPackage.ABSTRACT_XML_COLUMN__TABLE:
+ return getTable();
+ case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE:
+ return getUnique();
+ case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE:
+ return getUpdatable();
+ }
+ 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__INSERTABLE:
+ setInsertable((Boolean)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE:
+ setNullable((Boolean)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__TABLE:
+ setTable((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE:
+ setUnique((Boolean)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE:
+ setUpdatable((Boolean)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__INSERTABLE:
+ setInsertable(INSERTABLE_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE:
+ setNullable(NULLABLE_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__TABLE:
+ setTable(TABLE_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE:
+ setUnique(UNIQUE_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE:
+ setUpdatable(UPDATABLE_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__INSERTABLE:
+ return INSERTABLE_EDEFAULT == null ? insertable != null : !INSERTABLE_EDEFAULT.equals(insertable);
+ case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE:
+ return NULLABLE_EDEFAULT == null ? nullable != null : !NULLABLE_EDEFAULT.equals(nullable);
+ case OrmPackage.ABSTRACT_XML_COLUMN__TABLE:
+ return TABLE_EDEFAULT == null ? table != null : !TABLE_EDEFAULT.equals(table);
+ case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE:
+ return UNIQUE_EDEFAULT == null ? unique != null : !UNIQUE_EDEFAULT.equals(unique);
+ case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE:
+ return UPDATABLE_EDEFAULT == null ? updatable != null : !UPDATABLE_EDEFAULT.equals(updatable);
+ }
+ 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(" (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(')');
+ return result.toString();
+ }
+
+ public TextRange getTableTextRange() {
+ return getAttributeTextRange(JPA.TABLE);
+ }
+
+ // ********** translators **********
+
+ protected static Translator buildUniqueTranslator() {
+ return new BooleanTranslator(JPA.UNIQUE, OrmPackage.eINSTANCE.getAbstractXmlColumn_Unique(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildNullableTranslator() {
+ return new BooleanTranslator(JPA.NULLABLE, OrmPackage.eINSTANCE.getAbstractXmlColumn_Nullable(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildInsertableTranslator() {
+ return new BooleanTranslator(JPA.INSERTABLE, OrmPackage.eINSTANCE.getAbstractXmlColumn_Insertable(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildUpdatableTranslator() {
+ return new BooleanTranslator(JPA.UPDATABLE, OrmPackage.eINSTANCE.getAbstractXmlColumn_Updatable(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildTableTranslator() {
+ return new Translator(JPA.TABLE, OrmPackage.eINSTANCE.getAbstractXmlColumn_Table(), Translator.DOM_ATTRIBUTE);
+ }
+
+} // AbstractXmlAbstractColumn
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlEmbedded.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlEmbedded.java
new file mode 100644
index 0000000000..f464f8f385
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlEmbedded.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Base Xml Embedded</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlEmbedded()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlEmbedded extends AbstractXmlAttributeMapping implements XmlAttributeOverrideContainer
+{
+ /**
+ * 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<XmlAttributeOverride> attributeOverrides;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractXmlEmbedded()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_EMBEDDED;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAttributeOverride> getAttributeOverrides() {
+ if (attributeOverrides == null)
+ {
+ attributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.ABSTRACT_XML_EMBEDDED__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.ABSTRACT_XML_EMBEDDED__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.ABSTRACT_XML_EMBEDDED__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.ABSTRACT_XML_EMBEDDED__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ getAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)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_EMBEDDED__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.ABSTRACT_XML_EMBEDDED__ATTRIBUTE_OVERRIDES:
+ return attributeOverrides != null && !attributeOverrides.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlAttributeOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_EMBEDDED__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__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 == XmlAttributeOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES: return OrmPackage.ABSTRACT_XML_EMBEDDED__ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+
+ // ********** translators **********
+
+ protected static Translator buildAttributeOverrideTranslator() {
+ return XmlAttributeOverride.buildTranslator(JPA.ATTRIBUTE_OVERRIDE, OrmPackage.eINSTANCE.getXmlAttributeOverrideContainer_AttributeOverrides());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java
new file mode 100644
index 0000000000..28c06421ef
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java
@@ -0,0 +1,1100 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Multi Relationship Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#getMapKey <em>Map Key</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlMultiRelationshipMapping()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRelationshipMapping implements XmlMappedByMapping, XmlJoinTableContainer, XmlOrderable, XmlMultiRelationshipMapping_2_0
+{
+ /**
+ * 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 #getJoinTable() <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinTable()
+ * @generated
+ * @ordered
+ */
+ protected XmlJoinTable joinTable;
+ /**
+ * The cached value of the '{@link #getOrderColumn() <em>Order Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrderColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlOrderColumn orderColumn;
+ /**
+ * 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 #getMapKeyAttributeOverrides() <em>Map Key Attribute Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyAttributeOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlAttributeOverride> mapKeyAttributeOverrides;
+ /**
+ * The cached value of the '{@link #getMapKeyClass() <em>Map Key Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyClass()
+ * @generated
+ * @ordered
+ */
+ protected XmlClassReference mapKeyClass;
+ /**
+ * 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 MAP_KEY_TEMPORAL_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getMapKeyTemporal() <em>Map Key Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyTemporal()
+ * @generated
+ * @ordered
+ */
+ protected TemporalType mapKeyTemporal = MAP_KEY_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 MAP_KEY_ENUMERATED_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getMapKeyEnumerated() <em>Map Key Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyEnumerated()
+ * @generated
+ * @ordered
+ */
+ protected EnumType mapKeyEnumerated = MAP_KEY_ENUMERATED_EDEFAULT;
+ /**
+ * The cached value of the '{@link #getMapKeyColumn() <em>Map Key Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlColumn mapKeyColumn;
+ /**
+ * The cached value of the '{@link #getMapKeyJoinColumns() <em>Map Key Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlJoinColumn> mapKeyJoinColumns;
+ /**
+ * 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 AbstractXmlMultiRelationshipMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_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.jpa.core.resource.orm.OrmPackage#getXmlMappedByMapping_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.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#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.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY, oldMappedBy, mappedBy));
+ }
+
+ /**
+ * 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(XmlJoinTable)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTableContainer_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlJoinTable getJoinTable()
+ {
+ return joinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetJoinTable(XmlJoinTable newJoinTable, NotificationChain msgs)
+ {
+ XmlJoinTable oldJoinTable = joinTable;
+ joinTable = newJoinTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE, oldJoinTable, newJoinTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#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(XmlJoinTable newJoinTable)
+ {
+ if (newJoinTable != joinTable)
+ {
+ NotificationChain msgs = null;
+ if (joinTable != null)
+ msgs = ((InternalEObject)joinTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE, null, msgs);
+ if (newJoinTable != null)
+ msgs = ((InternalEObject)newJoinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE, null, msgs);
+ msgs = basicSetJoinTable(newJoinTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE, newJoinTable, newJoinTable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order 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>Order Column</em>' containment reference.
+ * @see #setOrderColumn(XmlOrderColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderable_2_0_OrderColumn()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlOrderColumn getOrderColumn()
+ {
+ return orderColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetOrderColumn(XmlOrderColumn newOrderColumn, NotificationChain msgs)
+ {
+ XmlOrderColumn oldOrderColumn = orderColumn;
+ orderColumn = newOrderColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN, oldOrderColumn, newOrderColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#getOrderColumn <em>Order Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Order Column</em>' containment reference.
+ * @see #getOrderColumn()
+ * @generated
+ */
+ public void setOrderColumn(XmlOrderColumn newOrderColumn)
+ {
+ if (newOrderColumn != orderColumn)
+ {
+ NotificationChain msgs = null;
+ if (orderColumn != null)
+ msgs = ((InternalEObject)orderColumn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN, null, msgs);
+ if (newOrderColumn != null)
+ msgs = ((InternalEObject)newOrderColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN, null, msgs);
+ msgs = basicSetOrderColumn(newOrderColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN, newOrderColumn, newOrderColumn));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOrderable_OrderBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getOrderBy() {
+ return orderBy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#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.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY, oldOrderBy, orderBy));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAttributeOverride> getMapKeyAttributeOverrides()
+ {
+ if (mapKeyAttributeOverrides == null)
+ {
+ mapKeyAttributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES);
+ }
+ return mapKeyAttributeOverrides;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Class</em>' containment reference.
+ * @see #setMapKeyClass(XmlClassReference)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMultiRelationshipMapping_2_0_MapKeyClass()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlClassReference getMapKeyClass()
+ {
+ return mapKeyClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetMapKeyClass(XmlClassReference newMapKeyClass, NotificationChain msgs)
+ {
+ XmlClassReference oldMapKeyClass = mapKeyClass;
+ mapKeyClass = newMapKeyClass;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS, oldMapKeyClass, newMapKeyClass);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#getMapKeyClass <em>Map Key Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Class</em>' containment reference.
+ * @see #getMapKeyClass()
+ * @generated
+ */
+ public void setMapKeyClass(XmlClassReference newMapKeyClass)
+ {
+ if (newMapKeyClass != mapKeyClass)
+ {
+ NotificationChain msgs = null;
+ if (mapKeyClass != null)
+ msgs = ((InternalEObject)mapKeyClass).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS, null, msgs);
+ if (newMapKeyClass != null)
+ msgs = ((InternalEObject)newMapKeyClass).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS, null, msgs);
+ msgs = basicSetMapKeyClass(newMapKeyClass, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS, newMapKeyClass, newMapKeyClass));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #setMapKeyTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMultiRelationshipMapping_2_0_MapKeyTemporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getMapKeyTemporal()
+ {
+ return mapKeyTemporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#getMapKeyTemporal <em>Map Key Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #getMapKeyTemporal()
+ * @generated
+ */
+ public void setMapKeyTemporal(TemporalType newMapKeyTemporal)
+ {
+ TemporalType oldMapKeyTemporal = mapKeyTemporal;
+ mapKeyTemporal = newMapKeyTemporal == null ? MAP_KEY_TEMPORAL_EDEFAULT : newMapKeyTemporal;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL, oldMapKeyTemporal, mapKeyTemporal));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #setMapKeyEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getMapKeyEnumerated()
+ {
+ return mapKeyEnumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#getMapKeyEnumerated <em>Map Key Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #getMapKeyEnumerated()
+ * @generated
+ */
+ public void setMapKeyEnumerated(EnumType newMapKeyEnumerated)
+ {
+ EnumType oldMapKeyEnumerated = mapKeyEnumerated;
+ mapKeyEnumerated = newMapKeyEnumerated == null ? MAP_KEY_ENUMERATED_EDEFAULT : newMapKeyEnumerated;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED, oldMapKeyEnumerated, mapKeyEnumerated));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Column</em>' containment reference.
+ * @see #setMapKeyColumn(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMultiRelationshipMapping_2_0_MapKeyColumn()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlColumn getMapKeyColumn()
+ {
+ return mapKeyColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetMapKeyColumn(XmlColumn newMapKeyColumn, NotificationChain msgs)
+ {
+ XmlColumn oldMapKeyColumn = mapKeyColumn;
+ mapKeyColumn = newMapKeyColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN, oldMapKeyColumn, newMapKeyColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#getMapKeyColumn <em>Map Key Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Column</em>' containment reference.
+ * @see #getMapKeyColumn()
+ * @generated
+ */
+ public void setMapKeyColumn(XmlColumn newMapKeyColumn)
+ {
+ if (newMapKeyColumn != mapKeyColumn)
+ {
+ NotificationChain msgs = null;
+ if (mapKeyColumn != null)
+ msgs = ((InternalEObject)mapKeyColumn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN, null, msgs);
+ if (newMapKeyColumn != null)
+ msgs = ((InternalEObject)newMapKeyColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN, null, msgs);
+ msgs = basicSetMapKeyColumn(newMapKeyColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN, newMapKeyColumn, newMapKeyColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map 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>Map Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJoinColumn> getMapKeyJoinColumns()
+ {
+ if (mapKeyJoinColumns == null)
+ {
+ mapKeyJoinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS);
+ }
+ return mapKeyJoinColumns;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getAbstractXmlMultiRelationshipMapping_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.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY, oldMapKey, newMapKey);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#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.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY, null, msgs);
+ if (newMapKey != null)
+ msgs = ((InternalEObject)newMapKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY, null, msgs);
+ msgs = basicSetMapKey(newMapKey, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY, newMapKey, newMapKey));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ return basicSetJoinTable(null, msgs);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN:
+ return basicSetOrderColumn(null, msgs);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getMapKeyAttributeOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS:
+ return basicSetMapKeyClass(null, msgs);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN:
+ return basicSetMapKeyColumn(null, msgs);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS:
+ return ((InternalEList<?>)getMapKeyJoinColumns()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__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.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY:
+ return getMappedBy();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ return getJoinTable();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN:
+ return getOrderColumn();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY:
+ return getOrderBy();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ return getMapKeyAttributeOverrides();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS:
+ return getMapKeyClass();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL:
+ return getMapKeyTemporal();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED:
+ return getMapKeyEnumerated();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN:
+ return getMapKeyColumn();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS:
+ return getMapKeyJoinColumns();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY:
+ return getMapKey();
+ }
+ 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_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY:
+ setMappedBy((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ setJoinTable((XmlJoinTable)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN:
+ setOrderColumn((XmlOrderColumn)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY:
+ setOrderBy((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ getMapKeyAttributeOverrides().clear();
+ getMapKeyAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS:
+ setMapKeyClass((XmlClassReference)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL:
+ setMapKeyTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED:
+ setMapKeyEnumerated((EnumType)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN:
+ setMapKeyColumn((XmlColumn)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS:
+ getMapKeyJoinColumns().clear();
+ getMapKeyJoinColumns().addAll((Collection<? extends XmlJoinColumn>)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__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.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY:
+ setMappedBy(MAPPED_BY_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ setJoinTable((XmlJoinTable)null);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN:
+ setOrderColumn((XmlOrderColumn)null);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY:
+ setOrderBy(ORDER_BY_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ getMapKeyAttributeOverrides().clear();
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS:
+ setMapKeyClass((XmlClassReference)null);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL:
+ setMapKeyTemporal(MAP_KEY_TEMPORAL_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED:
+ setMapKeyEnumerated(MAP_KEY_ENUMERATED_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN:
+ setMapKeyColumn((XmlColumn)null);
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS:
+ getMapKeyJoinColumns().clear();
+ return;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__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.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY:
+ return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ return joinTable != null;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN:
+ return orderColumn != null;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY:
+ return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy);
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ return mapKeyAttributeOverrides != null && !mapKeyAttributeOverrides.isEmpty();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS:
+ return mapKeyClass != null;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL:
+ return mapKeyTemporal != MAP_KEY_TEMPORAL_EDEFAULT;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED:
+ return mapKeyEnumerated != MAP_KEY_ENUMERATED_EDEFAULT;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN:
+ return mapKeyColumn != null;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS:
+ return mapKeyJoinColumns != null && !mapKeyJoinColumns.isEmpty();
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY:
+ return mapKey != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlMappedByMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY: return OrmPackage.XML_MAPPED_BY_MAPPING__MAPPED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlJoinTableContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE: return OrmPackage.XML_JOIN_TABLE_CONTAINER__JOIN_TABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN: return OrmV2_0Package.XML_ORDERABLE_20__ORDER_COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY: return OrmPackage.XML_ORDERABLE__ORDER_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMapKeyAttributeOverrideContainer_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES: return OrmV2_0Package.XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMultiRelationshipMapping_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN;
+ case OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS: return OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_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 == XmlMappedByMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_MAPPED_BY_MAPPING__MAPPED_BY: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlJoinTableContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_JOIN_TABLE_CONTAINER__JOIN_TABLE: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ORDERABLE_20__ORDER_COLUMN: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ORDERABLE__ORDER_BY: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMapKeyAttributeOverrideContainer_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMultiRelationshipMapping_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS;
+ case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL;
+ case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED;
+ case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN;
+ case OrmV2_0Package.XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS: return OrmPackage.ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS;
+ 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(", mapKeyTemporal: ");
+ result.append(mapKeyTemporal);
+ result.append(", mapKeyEnumerated: ");
+ result.append(mapKeyEnumerated);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getMappedByTextRange() {
+ return getAttributeTextRange(JPA.MAPPED_BY);
+ }
+
+
+ // ********** refactoring **********
+
+ public ReplaceEdit createRenameMapKeyClassEdit(IType originalType, String newName) {
+ return getMapKeyClass().createRenameEdit(originalType, newName);
+ }
+
+ public ReplaceEdit createRenameMapKeyClassPackageEdit(String newName) {
+ return getMapKeyClass().createRenamePackageEdit(newName);
+ }
+
+
+ // ********** translators **********
+
+ protected static Translator buildOrderByTranslator() {
+ return new Translator(JPA.ORDER_BY, OrmPackage.eINSTANCE.getXmlOrderable_OrderBy());
+ }
+
+ protected static Translator buildMapKeyTranslator() {
+ return MapKey.buildTranslator(JPA.MAP_KEY, OrmPackage.eINSTANCE.getAbstractXmlMultiRelationshipMapping_MapKey());
+ }
+
+ protected static Translator buildMapKeyTemporalTranslator() {
+ return new Translator(JPA2_0.MAP_KEY_TEMPORAL, OrmV2_0Package.eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyTemporal());
+ }
+
+ protected static Translator buildMapKeyEnumeratedTranslator() {
+ return new Translator(JPA2_0.MAP_KEY_ENUMERATED, OrmV2_0Package.eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated());
+ }
+
+ protected static Translator buildMapKeyClassTranslator() {
+ return XmlClassReference.buildTranslator(JPA2_0.MAP_KEY_CLASS, OrmV2_0Package.eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyClass());
+ }
+
+ protected static Translator buildMapKeyColumnTranslator() {
+ return XmlColumn.buildTranslator(JPA2_0.MAP_KEY_COLUMN, OrmV2_0Package.eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyColumn());
+ }
+
+ protected static Translator buildMapKeyJoinColumnTranslator() {
+ return XmlJoinColumn.buildTranslator(JPA2_0.MAP_KEY_JOIN_COLUMN, OrmV2_0Package.eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns());
+ }
+
+ protected static Translator buildMappedByTranslator() {
+ return new Translator(JPA.MAPPED_BY, OrmPackage.eINSTANCE.getXmlMappedByMapping_MappedBy(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildMapKeyAttributeOverrideTranslator() {
+ return XmlAttributeOverride.buildTranslator(JPA2_0.MAP_KEY_ATTRIBUTE_OVERRIDE, OrmV2_0Package.eINSTANCE.getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides());
+ }
+
+ protected static Translator buildJoinTableTranslator() {
+ return XmlJoinTable.buildTranslator(JPA.JOIN_TABLE, OrmPackage.eINSTANCE.getXmlJoinTableContainer_JoinTable());
+ }
+
+ protected static Translator buildOrderColumnTranslator() {
+ return XmlOrderColumn.buildTranslator(JPA2_0.ORDER_COLUMN, OrmV2_0Package.eINSTANCE.getXmlOrderable_2_0_OrderColumn());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlNamedColumn.java
new file mode 100644
index 0000000000..425eafa79b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlNamedColumn.java
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Xml Named Column</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn#getColumnDefinition <em>Column Definition</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlNamedColumn()
+ * @model kind="class" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public abstract class AbstractXmlNamedColumn extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractXmlNamedColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_NAMED_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.jpa.core.resource.orm.OrmPackage#getAbstractXmlNamedColumn_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.jpa.core.resource.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 setColumnDefinition(String newColumnDefinition)
+ {
+ String oldColumnDefinition = columnDefinition;
+ columnDefinition = newColumnDefinition;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_NAMED_COLUMN__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.jpa.core.resource.orm.OrmPackage#getAbstractXmlNamedColumn_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.jpa.core.resource.orm.AbstractXmlNamedColumn#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.ABSTRACT_XML_NAMED_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.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION:
+ return getColumnDefinition();
+ case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__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.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION:
+ setColumnDefinition((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__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.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION:
+ setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__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.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION:
+ return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
+ case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__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(" (columnDefinition: ");
+ result.append(columnDefinition);
+ result.append(", name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+ // ********** translators **********
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getAbstractXmlNamedColumn_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildColumnDefinitionTranslator() {
+ return new Translator(JPA.COLUMN_DEFINITION, OrmPackage.eINSTANCE.getAbstractXmlNamedColumn_ColumnDefinition(), Translator.DOM_ATTRIBUTE);
+ }
+
+} // AbstractXmlNamedColumn
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlReferenceTable.java
new file mode 100644
index 0000000000..a79e9d9222
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlReferenceTable.java
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Xml Reference Table</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlReferenceTable()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlReferenceTable extends AbstractXmlTable implements XmlReferenceTable
+{
+ /**
+ * 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<XmlJoinColumn> joinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractXmlReferenceTable()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_REFERENCE_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.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlReferenceTable_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.ABSTRACT_XML_REFERENCE_TABLE__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ABSTRACT_XML_REFERENCE_TABLE__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.ABSTRACT_XML_REFERENCE_TABLE__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.ABSTRACT_XML_REFERENCE_TABLE__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends XmlJoinColumn>)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_REFERENCE_TABLE__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.ABSTRACT_XML_REFERENCE_TABLE__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlReferenceTable.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_REFERENCE_TABLE__JOIN_COLUMNS: return OrmPackage.XML_REFERENCE_TABLE__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 == XmlReferenceTable.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_REFERENCE_TABLE__JOIN_COLUMNS: return OrmPackage.ABSTRACT_XML_REFERENCE_TABLE__JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+
+ // ********** translators **********
+
+ protected static Translator buildJoinColumnTranslator() {
+ return XmlJoinColumn.buildTranslator(JPA.JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlReferenceTable_JoinColumns());
+ }
+
+} // AbstractXmlReferenceTable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java
new file mode 100644
index 0000000000..df317ff85f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java
@@ -0,0 +1,400 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Relationship Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#getTargetEntity <em>Target Entity</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#getFetch <em>Fetch</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#getCascade <em>Cascade</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlRelationshipMapping()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlRelationshipMapping extends AbstractXmlAttributeMapping
+{
+ /**
+ * 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 #getCascade() <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCascade()
+ * @generated
+ * @ordered
+ */
+ protected CascadeType cascade;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractXmlRelationshipMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_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 #setTargetEntity(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlRelationshipMapping_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.jpa.core.resource.orm.AbstractXmlRelationshipMapping#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.ABSTRACT_XML_RELATIONSHIP_MAPPING__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.jpa.core.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.jpa.core.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlRelationshipMapping_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ public FetchType getFetch() {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#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.jpa.core.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.ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH, oldFetch, fetch));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getAbstractXmlRelationshipMapping_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.ABSTRACT_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.jpa.core.resource.orm.AbstractXmlRelationshipMapping#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.ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE, null, msgs);
+ if (newCascade != null)
+ msgs = ((InternalEObject)newCascade).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_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.ABSTRACT_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.ABSTRACT_XML_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 OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__TARGET_ENTITY:
+ return getTargetEntity();
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH:
+ return getFetch();
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE:
+ return getCascade();
+ }
+ 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_RELATIONSHIP_MAPPING__TARGET_ENTITY:
+ setTargetEntity((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE:
+ setCascade((CascadeType)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_RELATIONSHIP_MAPPING__TARGET_ENTITY:
+ setTargetEntity(TARGET_ENTITY_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE:
+ setCascade((CascadeType)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__TARGET_ENTITY:
+ return TARGET_ENTITY_EDEFAULT == null ? targetEntity != null : !TARGET_ENTITY_EDEFAULT.equals(targetEntity);
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE:
+ return cascade != 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(" (targetEntity: ");
+ result.append(targetEntity);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(')');
+ return result.toString();
+ }
+
+ /**
+ * Return the {@link TextRange} for the target-entity attribute.
+ */
+
+ public TextRange getTargetEntityTextRange() {
+ return getAttributeTextRange(JPA.TARGET_ENTITY);
+ }
+
+
+ // ********** translators **********
+
+ protected static Translator buildTargetEntityTranslator() {
+ return new Translator(JPA.TARGET_ENTITY, OrmPackage.eINSTANCE.getAbstractXmlRelationshipMapping_TargetEntity(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildFetchTranslator() {
+ return new Translator(JPA.FETCH, OrmPackage.eINSTANCE.getAbstractXmlRelationshipMapping_Fetch(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildCascadeTranslator() {
+ return CascadeType.buildTranslator(JPA.CASCADE, OrmPackage.eINSTANCE.getAbstractXmlRelationshipMapping_Cascade());
+ }
+
+
+ // ********** refactoring **********
+
+ public ReplaceEdit createRenameTargetEntityEdit(IType originalType, String newName) {
+ String originalName = originalType.getElementName();
+ int nameIndex = this.targetEntity.lastIndexOf(originalName);
+ int offset = getAttributeNode(JPA.TARGET_ENTITY).getValueRegionStartOffset() + 1;
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createRenameTargetEntityPackageEdit(String newName) {
+ int packageLength = this.targetEntity.lastIndexOf('.');
+ int offset = getAttributeNode(JPA.TARGET_ENTITY).getValueRegionStartOffset() + 1; // +1 = opening double quote
+ return new ReplaceEdit(offset, packageLength, newName);
+ }
+
+} // RelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlSingleRelationshipMapping.java
new file mode 100644
index 0000000000..6ddc04736a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlSingleRelationshipMapping.java
@@ -0,0 +1,614 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Single Relationship Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping#getOptional <em>Optional</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlSingleRelationshipMapping()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlSingleRelationshipMapping extends AbstractXmlRelationshipMapping implements XmlJoinTableContainer, XmlJoinColumnContainer, XmlSingleRelationshipMapping_2_0
+{
+ /**
+ * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinTable()
+ * @generated
+ * @ordered
+ */
+ protected XmlJoinTable joinTable;
+ /**
+ * 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<XmlJoinColumn> joinColumns;
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean ID_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected Boolean id = ID_EDEFAULT;
+ /**
+ * The default value of the '{@link #getMapsId() <em>Maps Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapsId()
+ * @generated
+ * @ordered
+ */
+ protected static final String MAPS_ID_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getMapsId() <em>Maps Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapsId()
+ * @generated
+ * @ordered
+ */
+ protected String mapsId = MAPS_ID_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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractXmlSingleRelationshipMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING;
+ }
+
+ /**
+ * 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(XmlJoinTable)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTableContainer_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlJoinTable getJoinTable()
+ {
+ return joinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetJoinTable(XmlJoinTable newJoinTable, NotificationChain msgs)
+ {
+ XmlJoinTable oldJoinTable = joinTable;
+ joinTable = newJoinTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE, oldJoinTable, newJoinTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping#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(XmlJoinTable newJoinTable)
+ {
+ if (newJoinTable != joinTable)
+ {
+ NotificationChain msgs = null;
+ if (joinTable != null)
+ msgs = ((InternalEObject)joinTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE, null, msgs);
+ if (newJoinTable != null)
+ msgs = ((InternalEObject)newJoinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE, null, msgs);
+ msgs = basicSetJoinTable(newJoinTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__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.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlJoinColumnContainer_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>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>Id</em>' attribute.
+ * @see #setId(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlDerivedId_2_0_Id()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getId()
+ {
+ return id;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping#getId <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ public void setId(Boolean newId)
+ {
+ Boolean oldId = id;
+ id = newId;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID, oldId, id));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Maps 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>Maps Id</em>' attribute.
+ * @see #setMapsId(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMapsId_2_0_MapsId()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getMapsId()
+ {
+ return mapsId;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping#getMapsId <em>Maps Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Maps Id</em>' attribute.
+ * @see #getMapsId()
+ * @generated
+ */
+ public void setMapsId(String newMapsId)
+ {
+ String oldMapsId = mapsId;
+ mapsId = newMapsId;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID, oldMapsId, mapsId));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getAbstractXmlSingleRelationshipMapping_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.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping#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.ABSTRACT_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.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ return basicSetJoinTable(null, msgs);
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__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.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ return getJoinTable();
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS:
+ return getJoinColumns();
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID:
+ return getId();
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID:
+ return getMapsId();
+ case OrmPackage.ABSTRACT_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.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ setJoinTable((XmlJoinTable)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends XmlJoinColumn>)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID:
+ setId((Boolean)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID:
+ setMapsId((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL:
+ setOptional((Boolean)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_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ setJoinTable((XmlJoinTable)null);
+ return;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID:
+ setId(ID_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID:
+ setMapsId(MAPS_ID_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_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.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE:
+ return joinTable != null;
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID:
+ return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID:
+ return MAPS_ID_EDEFAULT == null ? mapsId != null : !MAPS_ID_EDEFAULT.equals(mapsId);
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL:
+ return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlJoinTableContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE: return OrmPackage.XML_JOIN_TABLE_CONTAINER__JOIN_TABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlJoinColumnContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS: return OrmPackage.XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlDerivedId_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID: return OrmV2_0Package.XML_DERIVED_ID_20__ID;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMapsId_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID: return OrmV2_0Package.XML_MAPS_ID_20__MAPS_ID;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlSingleRelationshipMapping_2_0.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 == XmlJoinTableContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_JOIN_TABLE_CONTAINER__JOIN_TABLE: return OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlJoinColumnContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS: return OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlDerivedId_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_DERIVED_ID_20__ID: return OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMapsId_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_MAPS_ID_20__MAPS_ID: return OrmPackage.ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlSingleRelationshipMapping_2_0.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(" (id: ");
+ result.append(id);
+ result.append(", mapsId: ");
+ result.append(mapsId);
+ result.append(", optional: ");
+ result.append(optional);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** validation ***********
+
+ public TextRange getMapsIdTextRange() {
+ return getAttributeTextRange(JPA2_0.MAPS_ID);
+ }
+
+ public TextRange getIdTextRange() {
+ return getAttributeTextRange(JPA2_0.ID);
+ }
+
+
+ // ********** translators **********
+
+ protected static Translator buildOptionalTranslator() {
+ return new Translator(JPA.OPTIONAL, OrmPackage.eINSTANCE.getAbstractXmlSingleRelationshipMapping_Optional(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildMapsIdTranslator() {
+ return new Translator(JPA2_0.MAPS_ID, OrmV2_0Package.eINSTANCE.getXmlMapsId_2_0_MapsId(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildIdTranslator() {
+ return new Translator(JPA2_0.ID, OrmV2_0Package.eINSTANCE.getXmlDerivedId_2_0_Id(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildJoinColumnTranslator() {
+ return XmlJoinColumn.buildTranslator(JPA.JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlJoinColumnContainer_JoinColumns());
+ }
+
+ protected static Translator buildJoinTableTranslator() {
+ return XmlJoinTable.buildTranslator(JPA.JOIN_TABLE, OrmPackage.eINSTANCE.getXmlJoinTableContainer_JoinTable());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTable.java
new file mode 100644
index 0000000000..7169745166
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTable.java
@@ -0,0 +1,439 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Xml Base Table</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getUniqueConstraints <em>Unique Constraints</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlTable()
+ * @model kind="class" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public abstract class AbstractXmlTable extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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<XmlUniqueConstraint> uniqueConstraints;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractXmlTable()
+ {
+ super();
+ }
+
+ /**
+ * <!-- 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 #setName(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlTable_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.jpa.core.resource.orm.AbstractXmlTable#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.ABSTRACT_XML_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.jpa.core.resource.orm.OrmPackage#getAbstractXmlTable_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.jpa.core.resource.orm.AbstractXmlTable#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.ABSTRACT_XML_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.jpa.core.resource.orm.OrmPackage#getAbstractXmlTable_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.jpa.core.resource.orm.AbstractXmlTable#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.ABSTRACT_XML_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.jpa.core.resource.orm.XmlUniqueConstraint}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAbstractXmlTable_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlUniqueConstraint> getUniqueConstraints()
+ {
+ if (uniqueConstraints == null)
+ {
+ uniqueConstraints = new EObjectContainmentEList<XmlUniqueConstraint>(XmlUniqueConstraint.class, this, OrmPackage.ABSTRACT_XML_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.ABSTRACT_XML_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.ABSTRACT_XML_TABLE__NAME:
+ return getName();
+ case OrmPackage.ABSTRACT_XML_TABLE__CATALOG:
+ return getCatalog();
+ case OrmPackage.ABSTRACT_XML_TABLE__SCHEMA:
+ return getSchema();
+ case OrmPackage.ABSTRACT_XML_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.ABSTRACT_XML_TABLE__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_TABLE__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_TABLE__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ getUniqueConstraints().addAll((Collection<? extends XmlUniqueConstraint>)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__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_TABLE__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_TABLE__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_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.ABSTRACT_XML_TABLE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.ABSTRACT_XML_TABLE__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.ABSTRACT_XML_TABLE__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.ABSTRACT_XML_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();
+ }
+
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+ public TextRange getCatalogTextRange() {
+ return getAttributeTextRange(JPA.CATALOG);
+ }
+
+ public TextRange getSchemaTextRange() {
+ return getAttributeTextRange(JPA.SCHEMA);
+ }
+
+ // ********** translators **********
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getAbstractXmlTable_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildCatalogTranslator() {
+ return new Translator(JPA.CATALOG, OrmPackage.eINSTANCE.getAbstractXmlTable_Catalog(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildSchemaTranslator() {
+ return new Translator(JPA.SCHEMA, OrmPackage.eINSTANCE.getAbstractXmlTable_Schema(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildUniqueConstraintTranslator() {
+ return XmlUniqueConstraint.buildTranslator(JPA.UNIQUE_CONSTRAINT, OrmPackage.eINSTANCE.getAbstractXmlTable_UniqueConstraints());
+ }
+
+} // AbstractXmlBaseTable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTypeMapping.java
new file mode 100644
index 0000000000..1c5643dbdb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTypeMapping.java
@@ -0,0 +1,547 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Type Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlTypeMapping()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractXmlTypeMapping extends AbstractJpaEObject implements XmlTypeMapping
+{
+ /**
+ * 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 #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 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 AbstractXmlTypeMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ABSTRACT_XML_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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_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.jpa.core.resource.orm.AbstractXmlTypeMapping#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.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME, oldClassName, className));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder_Access()
+ * @model
+ * @generated
+ */
+ public AccessType getAccess()
+ {
+ return access;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTypeMapping#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.jpa.core.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.ABSTRACT_XML_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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_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.jpa.core.resource.orm.AbstractXmlTypeMapping#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.ABSTRACT_XML_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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_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.jpa.core.resource.orm.AbstractXmlTypeMapping#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.ABSTRACT_XML_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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_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.ABSTRACT_XML_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.jpa.core.resource.orm.AbstractXmlTypeMapping#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.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES, null, msgs);
+ if (newAttributes != null)
+ msgs = ((InternalEObject)newAttributes).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES, null, msgs);
+ msgs = basicSetAttributes(newAttributes, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_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.ABSTRACT_XML_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.ABSTRACT_XML_TYPE_MAPPING__ACCESS:
+ return getAccess();
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME:
+ return getClassName();
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE:
+ return getMetadataComplete();
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.ABSTRACT_XML_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.ABSTRACT_XML_TYPE_MAPPING__ACCESS:
+ setAccess((AccessType)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME:
+ setClassName((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE:
+ setMetadataComplete((Boolean)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.ABSTRACT_XML_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.ABSTRACT_XML_TYPE_MAPPING__ACCESS:
+ setAccess(ACCESS_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME:
+ setClassName(CLASS_NAME_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE:
+ setMetadataComplete(METADATA_COMPLETE_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.ABSTRACT_XML_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.ABSTRACT_XML_TYPE_MAPPING__ACCESS:
+ return access != ACCESS_EDEFAULT;
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME:
+ return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className);
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE:
+ return METADATA_COMPLETE_EDEFAULT == null ? metadataComplete != null : !METADATA_COMPLETE_EDEFAULT.equals(metadataComplete);
+ case OrmPackage.ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.ABSTRACT_XML_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(" (access: ");
+ result.append(access);
+ result.append(", className: ");
+ result.append(className);
+ result.append(", metadataComplete: ");
+ result.append(metadataComplete);
+ result.append(", description: ");
+ result.append(description);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ public TextRange getClassTextRange() {
+ return getAttributeTextRange(JPA.CLASS);
+ }
+
+ public TextRange getAttributesTextRange() {
+ return getAttributeTextRange(JPA.ATTRIBUTES);
+ }
+
+ public TextRange getNameTextRange(){
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+ // ********** translators **********
+
+ protected static Translator buildClassTranslator() {
+ return new Translator(JPA.CLASS, OrmPackage.eINSTANCE.getXmlTypeMapping_ClassName(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildMetadataCompleteTranslator() {
+ return new Translator(JPA.METADATA_COMPLETE, OrmPackage.eINSTANCE.getXmlTypeMapping_MetadataComplete(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmPackage.eINSTANCE.getXmlTypeMapping_Description());
+ }
+
+ protected static Translator buildAttributesTranslator() {
+ return Attributes.buildTranslator();
+ }
+
+
+ // ********** refactoring **********
+
+ public ReplaceEdit createRenameTypeEdit(IType originalType, String newName) {
+ String originalName = originalType.getTypeQualifiedName();
+ int nameIndex = this.className.lastIndexOf(originalName);
+ int offset = getAttributeNode(JPA.CLASS).getValueRegionStartOffset() + 1; // +1 = opening double quote
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createRenamePackageEdit(String newName) {
+ int packageLength = this.className.lastIndexOf('.');
+ if (packageLength == -1) {
+ packageLength = 0;
+ newName = newName + '.';
+ }
+ int offset = getAttributeNode(JPA.CLASS).getValueRegionStartOffset() + 1; // +1 = opening double quote
+ return new ReplaceEdit(offset, packageLength, newName);
+ }
+
+} // TypeMapping
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AccessType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AccessType.java
new file mode 100644
index 0000000000..12f6b21e11
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AccessType.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * 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.jpa.core.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>Access Type</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAccessType()
+ * @model
+ * @generated
+ */
+public enum AccessType implements Enumerator
+{
+ /**
+ * The '<em><b>PROPERTY</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #PROPERTY_VALUE
+ * @generated
+ * @ordered
+ */
+ PROPERTY(0, "PROPERTY", "PROPERTY"),
+
+ /**
+ * The '<em><b>FIELD</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #FIELD_VALUE
+ * @generated
+ * @ordered
+ */
+ FIELD(1, "FIELD", "FIELD");
+
+ /**
+ * The '<em><b>PROPERTY</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>PROPERTY</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #PROPERTY
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int PROPERTY_VALUE = 0;
+
+ /**
+ * The '<em><b>FIELD</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>FIELD</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #FIELD
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int FIELD_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>Access Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<AccessType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Access Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Access Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Access Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static AccessType get(int value)
+ {
+ switch (value)
+ {
+ case PROPERTY_VALUE: return PROPERTY;
+ case FIELD_VALUE: return FIELD;
+ }
+ 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 AccessType(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;
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Attributes.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Attributes.java
new file mode 100644
index 0000000000..865b71b343
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Attributes.java
@@ -0,0 +1,792 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import java.util.ArrayList;
+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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Attributes</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getIds <em>Ids</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getEmbeddedIds <em>Embedded Ids</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getBasics <em>Basics</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getVersions <em>Versions</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getManyToOnes <em>Many To Ones</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getOneToManys <em>One To Manys</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getOneToOnes <em>One To Ones</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getManyToManys <em>Many To Manys</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getEmbeddeds <em>Embeddeds</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes#getTransients <em>Transients</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAttributes()
+ * @model kind="class"
+ * @generated
+ */
+public class Attributes extends AbstractJpaEObject implements XmlAttributes_2_0
+{
+ /**
+ * 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 #getElementCollections() <em>Element Collections</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getElementCollections()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlElementCollection> elementCollections;
+
+ /**
+ * 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<XmlId> 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<XmlEmbeddedId> 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<XmlBasic> 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<XmlVersion> 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<XmlManyToOne> 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<XmlOneToMany> 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<XmlOneToOne> 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<XmlManyToMany> 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<XmlEmbedded> 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<XmlTransient> 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>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.jpa.core.resource.orm.OrmPackage#getXmlAttributes_2_0_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.jpa.core.resource.orm.Attributes#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.ATTRIBUTES__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Element Collections</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Element Collections</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>Element Collections</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributes_2_0_ElementCollections()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlElementCollection> getElementCollections()
+ {
+ if (elementCollections == null)
+ {
+ elementCollections = new EObjectContainmentEList<XmlElementCollection>(XmlElementCollection.class, this, OrmPackage.ATTRIBUTES__ELEMENT_COLLECTIONS);
+ }
+ return elementCollections;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Ids</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlId}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_Ids()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlId> getIds()
+ {
+ if (ids == null)
+ {
+ ids = new EObjectContainmentEList<XmlId>(XmlId.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.jpa.core.resource.orm.XmlEmbeddedId}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_EmbeddedIds()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlEmbeddedId> getEmbeddedIds()
+ {
+ if (embeddedIds == null)
+ {
+ embeddedIds = new EObjectContainmentEList<XmlEmbeddedId>(XmlEmbeddedId.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.jpa.core.resource.orm.XmlBasic}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_Basics()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlBasic> getBasics()
+ {
+ if (basics == null)
+ {
+ basics = new EObjectContainmentEList<XmlBasic>(XmlBasic.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.jpa.core.resource.orm.XmlVersion}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_Versions()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlVersion> getVersions()
+ {
+ if (versions == null)
+ {
+ versions = new EObjectContainmentEList<XmlVersion>(XmlVersion.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.jpa.core.resource.orm.XmlManyToOne}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_ManyToOnes()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlManyToOne> getManyToOnes()
+ {
+ if (manyToOnes == null)
+ {
+ manyToOnes = new EObjectContainmentEList<XmlManyToOne>(XmlManyToOne.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.jpa.core.resource.orm.XmlOneToMany}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_OneToManys()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlOneToMany> getOneToManys()
+ {
+ if (oneToManys == null)
+ {
+ oneToManys = new EObjectContainmentEList<XmlOneToMany>(XmlOneToMany.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.jpa.core.resource.orm.XmlOneToOne}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_OneToOnes()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlOneToOne> getOneToOnes()
+ {
+ if (oneToOnes == null)
+ {
+ oneToOnes = new EObjectContainmentEList<XmlOneToOne>(XmlOneToOne.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.jpa.core.resource.orm.XmlManyToMany}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_ManyToManys()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlManyToMany> getManyToManys()
+ {
+ if (manyToManys == null)
+ {
+ manyToManys = new EObjectContainmentEList<XmlManyToMany>(XmlManyToMany.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.jpa.core.resource.orm.XmlEmbedded}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_Embeddeds()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlEmbedded> getEmbeddeds()
+ {
+ if (embeddeds == null)
+ {
+ embeddeds = new EObjectContainmentEList<XmlEmbedded>(XmlEmbedded.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.jpa.core.resource.orm.XmlTransient}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getAttributes_Transients()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlTransient> getTransients()
+ {
+ if (transients == null)
+ {
+ transients = new EObjectContainmentEList<XmlTransient>(XmlTransient.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__ELEMENT_COLLECTIONS:
+ return ((InternalEList<?>)getElementCollections()).basicRemove(otherEnd, msgs);
+ 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__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.ATTRIBUTES__ELEMENT_COLLECTIONS:
+ return getElementCollections();
+ 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__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__ELEMENT_COLLECTIONS:
+ getElementCollections().clear();
+ getElementCollections().addAll((Collection<? extends XmlElementCollection>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__IDS:
+ getIds().clear();
+ getIds().addAll((Collection<? extends XmlId>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__EMBEDDED_IDS:
+ getEmbeddedIds().clear();
+ getEmbeddedIds().addAll((Collection<? extends XmlEmbeddedId>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__BASICS:
+ getBasics().clear();
+ getBasics().addAll((Collection<? extends XmlBasic>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__VERSIONS:
+ getVersions().clear();
+ getVersions().addAll((Collection<? extends XmlVersion>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__MANY_TO_ONES:
+ getManyToOnes().clear();
+ getManyToOnes().addAll((Collection<? extends XmlManyToOne>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__ONE_TO_MANYS:
+ getOneToManys().clear();
+ getOneToManys().addAll((Collection<? extends XmlOneToMany>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__ONE_TO_ONES:
+ getOneToOnes().clear();
+ getOneToOnes().addAll((Collection<? extends XmlOneToOne>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__MANY_TO_MANYS:
+ getManyToManys().clear();
+ getManyToManys().addAll((Collection<? extends XmlManyToMany>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__EMBEDDEDS:
+ getEmbeddeds().clear();
+ getEmbeddeds().addAll((Collection<? extends XmlEmbedded>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__TRANSIENTS:
+ getTransients().clear();
+ getTransients().addAll((Collection<? extends XmlTransient>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTES__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.ATTRIBUTES__ELEMENT_COLLECTIONS:
+ getElementCollections().clear();
+ return;
+ 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__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.ATTRIBUTES__ELEMENT_COLLECTIONS:
+ return elementCollections != null && !elementCollections.isEmpty();
+ 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);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (description: ");
+ result.append(description);
+ result.append(')');
+ return result.toString();
+ }
+
+ public List<XmlAttributeMapping> getAttributeMappings() {
+ // convert lists to arrays to avoid ConcurrentModificationException while adding to result list
+ ArrayList<XmlAttributeMapping> attributeMappings = new ArrayList<XmlAttributeMapping>();
+ CollectionTools.addAll(attributeMappings, this.getIds().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getEmbeddedIds().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getBasics().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getVersions().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getManyToOnes().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getOneToManys().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getOneToOnes().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getManyToManys().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getElementCollections().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getEmbeddeds().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ CollectionTools.addAll(attributeMappings, this.getTransients().toArray(EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY));
+ return attributeMappings;
+ }
+
+ private static final XmlAttributeMapping[] EMPTY_XML_ATTRIBUTE_MAPPING_ARRAY = new XmlAttributeMapping[0];
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.ATTRIBUTES,
+ OrmPackage.eINSTANCE.getXmlTypeMapping_Attributes());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ XmlId.buildTranslator(JPA.ID, OrmPackage.eINSTANCE.getAttributes_Ids()),
+ XmlEmbeddedId.buildTranslator(JPA.EMBEDDED_ID, OrmPackage.eINSTANCE.getAttributes_EmbeddedIds()),
+ XmlBasic.buildTranslator(JPA.BASIC, OrmPackage.eINSTANCE.getAttributes_Basics()),
+ XmlVersion.buildTranslator(JPA.VERSION, OrmPackage.eINSTANCE.getAttributes_Versions()),
+ XmlManyToOne.buildTranslator(JPA.MANY_TO_ONE, OrmPackage.eINSTANCE.getAttributes_ManyToOnes()),
+ XmlOneToMany.buildTranslator(JPA.ONE_TO_MANY, OrmPackage.eINSTANCE.getAttributes_OneToManys()),
+ XmlOneToOne.buildTranslator(JPA.ONE_TO_ONE, OrmPackage.eINSTANCE.getAttributes_OneToOnes()),
+ XmlManyToMany.buildTranslator(JPA.MANY_TO_MANY, OrmPackage.eINSTANCE.getAttributes_ManyToManys()),
+ XmlElementCollection.buildTranslator(JPA2_0.ELEMENT_COLLECTION, OrmV2_0Package.eINSTANCE.getXmlAttributes_2_0_ElementCollections()),
+ XmlEmbedded.buildTranslator(JPA.EMBEDDED, OrmPackage.eINSTANCE.getAttributes_Embeddeds()),
+ XmlTransient.buildTranslator(JPA.TRANSIENT, OrmPackage.eINSTANCE.getAttributes_Transients()),
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/CascadeType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/CascadeType.java
new file mode 100644
index 0000000000..9ac4f35697
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/CascadeType.java
@@ -0,0 +1,586 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.EmptyTagBooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Cascade Type</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType#isCascadeAll <em>Cascade All</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType#isCascadePersist <em>Cascade Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType#isCascadeMerge <em>Cascade Merge</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType#isCascadeRemove <em>Cascade Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType#isCascadeRefresh <em>Cascade Refresh</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getCascadeType()
+ * @model kind="class"
+ * @generated
+ */
+public class CascadeType extends AbstractJpaEObject implements XmlCascadeType_2_0
+{
+ /**
+ * The default value of the '{@link #isCascadeDetach() <em>Cascade Detach</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeDetach()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CASCADE_DETACH_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isCascadeDetach() <em>Cascade Detach</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeDetach()
+ * @generated
+ * @ordered
+ */
+ protected boolean cascadeDetach = CASCADE_DETACH_EDEFAULT;
+
+ /**
+ * 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 CascadeType()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.CASCADE_TYPE;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade Detach</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Detach</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 Detach</em>' attribute.
+ * @see #setCascadeDetach(boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlCascadeType_2_0_CascadeDetach()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isCascadeDetach()
+ {
+ return cascadeDetach;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType#isCascadeDetach <em>Cascade Detach</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Detach</em>' attribute.
+ * @see #isCascadeDetach()
+ * @generated
+ */
+ public void setCascadeDetach(boolean newCascadeDetach)
+ {
+ boolean oldCascadeDetach = cascadeDetach;
+ cascadeDetach = newCascadeDetach;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE__CASCADE_DETACH, oldCascadeDetach, cascadeDetach));
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.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
+ */
+ public void setCascadeAll(boolean newCascadeAll)
+ {
+ boolean oldCascadeAll = cascadeAll;
+ cascadeAll = newCascadeAll;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE__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.jpa.core.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.jpa.core.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
+ */
+ public void setCascadePersist(boolean newCascadePersist)
+ {
+ boolean oldCascadePersist = cascadePersist;
+ cascadePersist = newCascadePersist;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE__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.jpa.core.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.jpa.core.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
+ */
+ public void setCascadeMerge(boolean newCascadeMerge)
+ {
+ boolean oldCascadeMerge = cascadeMerge;
+ cascadeMerge = newCascadeMerge;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE__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.jpa.core.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.jpa.core.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
+ */
+ public void setCascadeRemove(boolean newCascadeRemove)
+ {
+ boolean oldCascadeRemove = cascadeRemove;
+ cascadeRemove = newCascadeRemove;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE__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.jpa.core.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.jpa.core.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
+ */
+ public void setCascadeRefresh(boolean newCascadeRefresh)
+ {
+ boolean oldCascadeRefresh = cascadeRefresh;
+ cascadeRefresh = newCascadeRefresh;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE__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__CASCADE_DETACH:
+ return isCascadeDetach();
+ case OrmPackage.CASCADE_TYPE__CASCADE_ALL:
+ return isCascadeAll();
+ case OrmPackage.CASCADE_TYPE__CASCADE_PERSIST:
+ return isCascadePersist();
+ case OrmPackage.CASCADE_TYPE__CASCADE_MERGE:
+ return isCascadeMerge();
+ case OrmPackage.CASCADE_TYPE__CASCADE_REMOVE:
+ return isCascadeRemove();
+ case OrmPackage.CASCADE_TYPE__CASCADE_REFRESH:
+ return isCascadeRefresh();
+ }
+ 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__CASCADE_DETACH:
+ setCascadeDetach((Boolean)newValue);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_ALL:
+ setCascadeAll((Boolean)newValue);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_PERSIST:
+ setCascadePersist((Boolean)newValue);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_MERGE:
+ setCascadeMerge((Boolean)newValue);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_REMOVE:
+ setCascadeRemove((Boolean)newValue);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_REFRESH:
+ setCascadeRefresh((Boolean)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.CASCADE_TYPE__CASCADE_DETACH:
+ setCascadeDetach(CASCADE_DETACH_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_ALL:
+ setCascadeAll(CASCADE_ALL_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_PERSIST:
+ setCascadePersist(CASCADE_PERSIST_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_MERGE:
+ setCascadeMerge(CASCADE_MERGE_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE__CASCADE_REMOVE:
+ setCascadeRemove(CASCADE_REMOVE_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE__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__CASCADE_DETACH:
+ return cascadeDetach != CASCADE_DETACH_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE__CASCADE_ALL:
+ return cascadeAll != CASCADE_ALL_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE__CASCADE_PERSIST:
+ return cascadePersist != CASCADE_PERSIST_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE__CASCADE_MERGE:
+ return cascadeMerge != CASCADE_MERGE_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE__CASCADE_REMOVE:
+ return cascadeRemove != CASCADE_REMOVE_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE__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(" (cascadeDetach: ");
+ result.append(cascadeDetach);
+ 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();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildCascadeAllTranslator(),
+ buildCascadePersistTranslator(),
+ buildCascadeMergeTranslator(),
+ buildCascadeRemoveTranslator(),
+ buildCascadeRefreshTranslator(),
+ buildCascadeDetachTranslator()
+ };
+ }
+
+ protected static Translator buildCascadeAllTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.CASCADE_ALL, OrmPackage.eINSTANCE.getCascadeType_CascadeAll());
+ }
+
+ protected static Translator buildCascadePersistTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.CASCADE_PERSIST, OrmPackage.eINSTANCE.getCascadeType_CascadePersist());
+ }
+
+ protected static Translator buildCascadeMergeTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.CASCADE_MERGE, OrmPackage.eINSTANCE.getCascadeType_CascadeMerge());
+ }
+
+ protected static Translator buildCascadeRemoveTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.CASCADE_REMOVE, OrmPackage.eINSTANCE.getCascadeType_CascadeRemove());
+ }
+
+ protected static Translator buildCascadeRefreshTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.CASCADE_REFRESH, OrmPackage.eINSTANCE.getCascadeType_CascadeRefresh());
+ }
+
+ protected static Translator buildCascadeDetachTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.CASCADE_DETACH, OrmV2_0Package.eINSTANCE.getXmlCascadeType_2_0_CascadeDetach());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnMapping.java
new file mode 100644
index 0000000000..7d56dd107e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnMapping.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Column Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.ColumnMapping#getColumn <em>Column</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface ColumnMapping extends JpaEObject
+{
+ /**
+ * 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(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ XmlColumn getColumn();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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(XmlColumn value);
+
+} // ColumnMapping
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnResult.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnResult.java
new file mode 100644
index 0000000000..5a62b6af10
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnResult.java
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Column Result</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.ColumnResult#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnResult()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class ColumnResult extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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 ColumnResult()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.COLUMN_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.jpa.core.resource.orm.OrmPackage#getColumnResult_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.jpa.core.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)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_RESULT__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_RESULT__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.COLUMN_RESULT__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.COLUMN_RESULT__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.COLUMN_RESULT__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();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getColumnResult_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+} // ColumnResult
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/DiscriminatorType.java
new file mode 100644
index 0000000000..112880bef5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/DiscriminatorType.java
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * 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.jpa.core.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>Discriminator Type</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getDiscriminatorType()
+ * @model
+ * @generated
+ */
+public enum DiscriminatorType implements Enumerator
+{
+ /**
+ * The '<em><b>STRING</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #STRING_VALUE
+ * @generated
+ * @ordered
+ */
+ STRING(0, "STRING", "STRING"),
+
+ /**
+ * The '<em><b>CHAR</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #CHAR_VALUE
+ * @generated
+ * @ordered
+ */
+ CHAR(1, "CHAR", "CHAR"),
+
+ /**
+ * The '<em><b>INTEGER</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #INTEGER_VALUE
+ * @generated
+ * @ordered
+ */
+ 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #STRING
+ * @model
+ * @generated
+ * @ordered
+ */
+ 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #CHAR
+ * @model
+ * @generated
+ * @ordered
+ */
+ 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #INTEGER
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int INTEGER_VALUE = 2;
+
+ /**
+ * An array of all the '<em><b>Discriminator Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<DiscriminatorType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Discriminator Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Discriminator Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Discriminator Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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;
+ }
+
+ /**
+ * <!-- 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 DiscriminatorType(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;
+ }
+
+} //DiscriminatorType
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListener.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListener.java
new file mode 100644
index 0000000000..8786a2f9e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListener.java
@@ -0,0 +1,928 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Listener</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.EntityListener#getClassName <em>Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEntityListener()
+ * @model kind="class"
+ * @generated
+ */
+public class EntityListener extends AbstractJpaEObject implements XmlEventMethodContainer, XmlEntityListener_2_0
+{
+ /**
+ * 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 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 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 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.jpa.core.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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.jpa.core.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));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEntityListener_2_0_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.jpa.core.resource.orm.EntityListener#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_LISTENER__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * <!-- 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__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();
+ case OrmPackage.ENTITY_LISTENER__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.ENTITY_LISTENER__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.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;
+ case OrmPackage.ENTITY_LISTENER__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__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.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;
+ case OrmPackage.ENTITY_LISTENER__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_LISTENER__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.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;
+ case OrmPackage.ENTITY_LISTENER__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.ENTITY_LISTENER__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 int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlEntityListener_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ENTITY_LISTENER__DESCRIPTION: return OrmV2_0Package.XML_ENTITY_LISTENER_20__DESCRIPTION;
+ 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 == XmlEntityListener_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ENTITY_LISTENER_20__DESCRIPTION: return OrmPackage.ENTITY_LISTENER__DESCRIPTION;
+ 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(" (description: ");
+ result.append(description);
+ result.append(", className: ");
+ result.append(className);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildDescriptionTranslator(),
+ buildClassTranslator(),
+ PrePersist.buildTranslator(),
+ PostPersist.buildTranslator(),
+ PreRemove.buildTranslator(),
+ PostRemove.buildTranslator(),
+ PreUpdate.buildTranslator(),
+ PostUpdate.buildTranslator(),
+ PostLoad.buildTranslator()
+ };
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlEntityListener_2_0_Description());
+ }
+
+ protected static Translator buildClassTranslator() {
+ return new Translator(JPA.CLASS, OrmPackage.eINSTANCE.getEntityListener_ClassName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListeners.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListeners.java
new file mode 100644
index 0000000000..7276b96958
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListeners.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Listeners</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.EntityListeners#getEntityListeners <em>Entity Listeners</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEntityListeners()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class EntityListeners extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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.jpa.core.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.jpa.core.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);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ EntityListener.buildTranslator(JPA.ENTITY_LISTENER, OrmPackage.eINSTANCE.getEntityListeners_EntityListeners())
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityResult.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityResult.java
new file mode 100644
index 0000000000..f7548f267b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityResult.java
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Result</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.EntityResult#getDiscriminatorColumn <em>Discriminator Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.EntityResult#getEntityClass <em>Entity Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.EntityResult#getFieldResults <em>Field Results</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEntityResult()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class EntityResult extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildEntityClassTranslator(),
+ buildDiscriminatorColumnTranslator(),
+ FieldResult.buildTranslator(JPA.FIELD_RESULT, OrmPackage.eINSTANCE.getEntityResult_FieldResults()),
+ };
+ }
+
+ protected static Translator buildEntityClassTranslator() {
+ return new Translator(JPA.ENTITY_CLASS, OrmPackage.eINSTANCE.getEntityResult_EntityClass(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDiscriminatorColumnTranslator() {
+ return new Translator(JPA.DISCRIMINATOR_COLUMN, OrmPackage.eINSTANCE.getEntityResult_DiscriminatorColumn(), Translator.DOM_ATTRIBUTE);
+ }
+} // EntityResult
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EnumType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EnumType.java
new file mode 100644
index 0000000000..7b3cc29f98
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EnumType.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * 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.jpa.core.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>Enum Type</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEnumType()
+ * @model
+ * @generated
+ */
+public enum EnumType implements Enumerator
+{
+ /**
+ * The '<em><b>ORDINAL</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #ORDINAL_VALUE
+ * @generated
+ * @ordered
+ */
+ ORDINAL(0, "ORDINAL", "ORDINAL"),
+
+ /**
+ * The '<em><b>STRING</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #STRING_VALUE
+ * @generated
+ * @ordered
+ */
+ STRING(1, "STRING", "STRING");
+
+ /**
+ * The '<em><b>ORDINAL</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>ORDINAL</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #ORDINAL
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int ORDINAL_VALUE = 0;
+
+ /**
+ * 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #STRING
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int STRING_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>Enum Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<EnumType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Enum Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Enum Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Enum Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static EnumType get(int value)
+ {
+ switch (value)
+ {
+ case ORDINAL_VALUE: return ORDINAL;
+ case STRING_VALUE: return STRING;
+ }
+ 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 EnumType(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;
+ }
+
+} //EnumType
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EventMethod.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EventMethod.java
new file mode 100644
index 0000000000..8487c7b6b8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EventMethod.java
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Event Method</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.EventMethod#getMethodName <em>Method Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEventMethod()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class EventMethod extends AbstractJpaEObject implements XmlEventMethod_2_0
+{
+
+ /**
+ * 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 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>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.jpa.core.resource.orm.OrmPackage#getXmlEventMethod_2_0_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.jpa.core.resource.orm.EventMethod#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.EVENT_METHOD__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.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__DESCRIPTION:
+ return getDescription();
+ 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__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ 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__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ 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__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ 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(" (description: ");
+ result.append(description);
+ result.append(", methodName: ");
+ result.append(methodName);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** translators **********
+
+ protected static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildMethodNameTranslator(),
+ buildDescriptionTranslator()
+ };
+ }
+
+ protected static Translator buildMethodNameTranslator() {
+ return new Translator(JPA.METHOD_NAME, OrmPackage.eINSTANCE.getEventMethod_MethodName(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlEventMethod_2_0_Description());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FetchType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FetchType.java
new file mode 100644
index 0000000000..5f77353477
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FetchType.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * 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.jpa.core.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.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FieldResult.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FieldResult.java
new file mode 100644
index 0000000000..c180b7b96f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FieldResult.java
@@ -0,0 +1,294 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Field Result</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.FieldResult#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.FieldResult#getColumn <em>Column</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getFieldResult()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class FieldResult extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ createColumnTranslator()
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getFieldResult_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator createColumnTranslator() {
+ return new Translator(JPA.COLUMN, OrmPackage.eINSTANCE.getFieldResult_Column(), Translator.DOM_ATTRIBUTE);
+ }
+
+} // FieldResult
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/GenerationType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/GenerationType.java
new file mode 100644
index 0000000000..383484cdfc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/GenerationType.java
@@ -0,0 +1,289 @@
+/*******************************************************************************
+ * 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.jpa.core.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>Generation Type</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getGenerationType()
+ * @model
+ * @generated
+ */
+public enum GenerationType implements Enumerator
+{
+ /**
+ * The '<em><b>TABLE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #TABLE_VALUE
+ * @generated
+ * @ordered
+ */
+ TABLE(0, "TABLE", "TABLE"),
+
+ /**
+ * The '<em><b>SEQUENCE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #SEQUENCE_VALUE
+ * @generated
+ * @ordered
+ */
+ SEQUENCE(1, "SEQUENCE", "SEQUENCE"),
+
+ /**
+ * The '<em><b>IDENTITY</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #IDENTITY_VALUE
+ * @generated
+ * @ordered
+ */
+ IDENTITY(2, "IDENTITY", "IDENTITY"),
+
+ /**
+ * The '<em><b>AUTO</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #AUTO_VALUE
+ * @generated
+ * @ordered
+ */
+ AUTO(3, "AUTO", "AUTO");
+
+ /**
+ * The '<em><b>TABLE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * 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 #TABLE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_VALUE = 0;
+
+ /**
+ * 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
+ * @generated
+ * @ordered
+ */
+ 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #IDENTITY
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int IDENTITY_VALUE = 2;
+
+ /**
+ * The '<em><b>AUTO</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * 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 #AUTO
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int AUTO_VALUE = 3;
+
+ /**
+ * An array of all the '<em><b>Generation Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<GenerationType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Generation Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Generation Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Generation Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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;
+ }
+
+ /**
+ * <!-- 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 GenerationType(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;
+ }
+
+} //GenerationType
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Inheritance.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Inheritance.java
new file mode 100644
index 0000000000..7e83fc41ee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Inheritance.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Inheritance</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.Inheritance#getStrategy <em>Strategy</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getInheritance()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class Inheritance extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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.jpa.core.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.jpa.core.resource.orm.InheritanceType
+ * @see #setStrategy(InheritanceType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getInheritance_Strategy()
+ * @model default="SINGLE_TABLE"
+ * @generated
+ */
+ public InheritanceType getStrategy()
+ {
+ return strategy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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();
+ }
+
+ public TextRange getStrategyTextRange() {
+ return getAttributeTextRange(JPA.STRATEGY);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildStrategyTranslator(),
+ };
+ }
+
+ protected static Translator buildStrategyTranslator() {
+ return new Translator(JPA.STRATEGY, OrmPackage.eINSTANCE.getInheritance_Strategy(), Translator.DOM_ATTRIBUTE);
+ }
+
+} // Inheritance
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/InheritanceType.java
new file mode 100644
index 0000000000..e290ddfa18
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/InheritanceType.java
@@ -0,0 +1,260 @@
+/*******************************************************************************
+ * 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.jpa.core.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>Inheritance Type</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getInheritanceType()
+ * @model
+ * @generated
+ */
+public enum InheritanceType implements Enumerator
+{
+ /**
+ * The '<em><b>SINGLE TABLE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #SINGLE_TABLE_VALUE
+ * @generated
+ * @ordered
+ */
+ SINGLE_TABLE(0, "SINGLE_TABLE", "SINGLE_TABLE"), /**
+ * The '<em><b>JOINED</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #JOINED_VALUE
+ * @generated
+ * @ordered
+ */
+ JOINED(1, "JOINED", "JOINED"),
+
+ /**
+ * The '<em><b>TABLE PER CLASS</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #TABLE_PER_CLASS_VALUE
+ * @generated
+ * @ordered
+ */
+ 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #SINGLE_TABLE
+ * @model
+ * @generated
+ * @ordered
+ */
+ 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #JOINED
+ * @model
+ * @generated
+ * @ordered
+ */
+ 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,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #TABLE_PER_CLASS
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_PER_CLASS_VALUE = 2;
+
+ /**
+ * An array of all the '<em><b>Inheritance Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<InheritanceType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Inheritance Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Inheritance Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Inheritance Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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;
+ }
+
+ /**
+ * <!-- 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 InheritanceType(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;
+ }
+
+} //InheritanceType
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/JPA.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/JPA.java
new file mode 100644
index 0000000000..30f3626978
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/JPA.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Oracle. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+@SuppressWarnings("nls")
+public interface JPA
+{
+ String SCHEMA_NAMESPACE = "http://java.sun.com/xml/ns/persistence/orm";
+ String SCHEMA_LOCATION = "http://java.sun.com/xml/ns/persistence/orm_1_0.xsd";
+ String SCHEMA_VERSION = "1.0";
+
+ String ACCESS = "access";
+ String ALLOCATION_SIZE = "allocation-size";
+ String ASSOCIATION_OVERRIDE = "association-override";
+ String ATTRIBUTE_OVERRIDE = "attribute-override";
+ String ATTRIBUTES = "attributes";
+ String BASIC = "basic";
+ String CASCADE = "cascade";
+ String CASCADE_ALL = "cascade-all";
+ String CASCADE_DETACH = "cascade-detach";
+ String CASCADE_MERGE = "cascade-merge";
+ String CASCADE_PERSIST = "cascade-persist";
+ String CASCADE_REFRESH = "cascade-refresh";
+ String CASCADE_REMOVE = "cascade-remove";
+ String CATALOG = "catalog";
+ String CLASS = "class";
+ String COLUMN = "column";
+ String COLUMN_DEFINITION= "column-definition";
+ String COLUMN_NAME = "column-name";
+ String COLUMN_RESULT = "column-result";
+ String DESCRIPTION = "description";
+ String DISCRIMINATOR_COLUMN = "discriminator-column";
+ String DISCRIMINATOR_TYPE = "discriminator-type";
+ String DISCRIMINATOR_VALUE = "discriminator-value";
+ String EMBEDDABLE = "embeddable";
+ String EMBEDDED = "embedded";
+ String EMBEDDED_ID = "embedded-id";
+ String ENTITY = "entity";
+ String ENTITY_CLASS = "entity-class";
+ String ENTITY_LISTENER = "entity-listener";
+ String ENTITY_LISTENERS = "entity-listeners";
+ String ENTITY_MAPPINGS = "entity-mappings";
+ String ENTITY_RESULT = "entity-result";
+ String ENUMERATED = "enumerated";
+ String EXCLUDE_DEFAULT_LISTENERS = "exclude-default-listeners";
+ String EXCLUDE_SUPERCLASS_LISTENERS = "exclude-superclass-listeners";
+ String FETCH = "fetch";
+ String FIELD_RESULT = "field-result";
+ String GENERATED_VALUE = "generated-value";
+ String GENERATOR = "generator";
+ String HINT = "hint";
+ String ID = "id";
+ String ID_CLASS = "id-class";
+ String INHERITANCE = "inheritance";
+ String INITIAL_VALUE = "initial-value";
+ String INSERTABLE = "insertable";
+ String INVERSE_JOIN_COLUMN = "inverse-join-column";
+ String JOIN_COLUMN = "join-column";
+ String JOIN_TABLE = "join-table";
+ String LENGTH = "length";
+ String LOB = "lob";
+ String MANY_TO_MANY = "many-to-many";
+ String MANY_TO_ONE = "many-to-one";
+ String MAP_KEY = "map-key";
+ String MAPPED_BY = "mapped-by";
+ String MAPPED_SUPERCLASS = "mapped-superclass";
+ String METADATA_COMPLETE = "metadata-complete";
+ String METHOD_NAME = "method-name";
+ String NAME = "name";
+ String NAMED_NATIVE_QUERY = "named-native-query";
+ String NAMED_QUERY = "named-query";
+ String NULLABLE = "nullable";
+ String ONE_TO_MANY = "one-to-many";
+ String ONE_TO_ONE = "one-to-one";
+ String OPTIONAL = "optional";
+ String ORDER_BY = "order-by";
+ String PACKAGE = "package";
+ String PERSISTENCE_UNIT_DEFAULTS = "persistence-unit-defaults";
+ String PERSISTENCE_UNIT_METADATA = "persistence-unit-metadata";
+ String PK_COLUMN_NAME = "pk-column-name";
+ String PK_COLUMN_VALUE = "pk-column-value";
+ String POST_LOAD = "post-load";
+ String POST_PERSIST = "post-persist";
+ String POST_REMOVE = "post-remove";
+ String POST_UPDATE = "post-update";
+ String PRE_PERSIST = "pre-persist";
+ String PRE_REMOVE = "pre-remove";
+ String PRE_UPDATE = "pre-update";
+ String PRECISION= "precision";
+ String PRIMARY_KEY_JOIN_COLUMN = "primary-key-join-column";
+ String QUERY = "query";
+ String REFERENCED_COLUMN_NAME = "referenced-column-name";
+ String RESULT_CLASS = "result-class";
+ String RESULT_SET_MAPPING = "result-set-mapping";
+ String SCALE= "scale";
+ String SCHEMA = "schema";
+ String SECONDARY_TABLE = "secondary-table";
+ String SEQUENCE_GENERATOR = "sequence-generator";
+ String SEQUENCE_NAME = "sequence-name";
+ String SQL_RESULT_SET_MAPPING = "sql-result-set-mapping";
+ String STRATEGY = "strategy";
+ String TABLE = "table";
+ String TABLE_GENERATOR = "table-generator";
+ String TARGET_ENTITY = "target-entity";
+ String TEMPORAL = "temporal";
+ String TRANSIENT = "transient";
+ String UNIQUE = "unique";
+ String UNIQUE_CONSTRAINT = "unique-constraint";
+ String UPDATABLE = "updatable";
+ String VALUE = "value";
+ String VALUE_COLUMN_NAME = "value-column-name";
+ String VERSION = "version";
+ String XML_MAPPING_METADATA_COMPLETE = "xml-mapping-metadata-complete";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Lob.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Lob.java
new file mode 100644
index 0000000000..28f1e40433
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Lob.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Lob</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getLob()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class Lob extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Lob()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.LOB;
+ }
+
+} // Lob
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java
new file mode 100644
index 0000000000..5eec067638
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Map Key</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.MapKey#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getMapKey()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class MapKey extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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 MapKey()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.MAP_KEY;
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.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
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAP_KEY__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__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__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__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__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();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getMapKey_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+} // MapKey
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmFactory.java
new file mode 100644
index 0000000000..7ccb142d3f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmFactory.java
@@ -0,0 +1,970 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+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.jpa.core.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.XML_ASSOCIATION_OVERRIDE: return (EObject)createXmlAssociationOverride();
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE: return (EObject)createXmlAttributeOverride();
+ case OrmPackage.ATTRIBUTES: return (EObject)createAttributes();
+ case OrmPackage.XML_BASIC: return (EObject)createXmlBasic();
+ case OrmPackage.CASCADE_TYPE: return (EObject)createCascadeType();
+ case OrmPackage.XML_CLASS_REFERENCE: return (EObject)createXmlClassReference();
+ case OrmPackage.XML_COLLECTION_TABLE: return (EObject)createXmlCollectionTable();
+ case OrmPackage.XML_COLUMN: return (EObject)createXmlColumn();
+ case OrmPackage.COLUMN_RESULT: return (EObject)createColumnResult();
+ case OrmPackage.XML_DISCRIMINATOR_COLUMN: return (EObject)createXmlDiscriminatorColumn();
+ case OrmPackage.XML_ELEMENT_COLLECTION: return (EObject)createXmlElementCollection();
+ case OrmPackage.XML_EMBEDDABLE: return (EObject)createXmlEmbeddable();
+ case OrmPackage.XML_EMBEDDED: return (EObject)createXmlEmbedded();
+ case OrmPackage.XML_EMBEDDED_ID: return (EObject)createXmlEmbeddedId();
+ case OrmPackage.XML_ENTITY: return (EObject)createXmlEntity();
+ case OrmPackage.ENTITY_LISTENER: return (EObject)createEntityListener();
+ case OrmPackage.ENTITY_LISTENERS: return (EObject)createEntityListeners();
+ case OrmPackage.XML_ENTITY_MAPPINGS: return (EObject)createXmlEntityMappings();
+ case OrmPackage.ENTITY_RESULT: return (EObject)createEntityResult();
+ case OrmPackage.FIELD_RESULT: return (EObject)createFieldResult();
+ case OrmPackage.XML_GENERATED_VALUE: return (EObject)createXmlGeneratedValue();
+ case OrmPackage.XML_ID: return (EObject)createXmlId();
+ case OrmPackage.INHERITANCE: return (EObject)createInheritance();
+ case OrmPackage.XML_JOIN_COLUMN: return (EObject)createXmlJoinColumn();
+ case OrmPackage.XML_JOIN_TABLE: return (EObject)createXmlJoinTable();
+ case OrmPackage.LOB: return (EObject)createLob();
+ case OrmPackage.XML_MANY_TO_MANY: return (EObject)createXmlManyToMany();
+ case OrmPackage.XML_MANY_TO_ONE: return (EObject)createXmlManyToOne();
+ case OrmPackage.MAP_KEY: return (EObject)createMapKey();
+ case OrmPackage.XML_MAPPED_SUPERCLASS: return (EObject)createXmlMappedSuperclass();
+ case OrmPackage.XML_NAMED_NATIVE_QUERY: return (EObject)createXmlNamedNativeQuery();
+ case OrmPackage.XML_NAMED_QUERY: return (EObject)createXmlNamedQuery();
+ case OrmPackage.XML_ONE_TO_MANY: return (EObject)createXmlOneToMany();
+ case OrmPackage.XML_ONE_TO_ONE: return (EObject)createXmlOneToOne();
+ case OrmPackage.XML_ORDER_COLUMN: return (EObject)createXmlOrderColumn();
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS: return (EObject)createXmlPersistenceUnitDefaults();
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA: return (EObject)createXmlPersistenceUnitMetadata();
+ 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.XML_PRIMARY_KEY_JOIN_COLUMN: return (EObject)createXmlPrimaryKeyJoinColumn();
+ case OrmPackage.XML_QUERY_HINT: return (EObject)createXmlQueryHint();
+ case OrmPackage.XML_SECONDARY_TABLE: return (EObject)createXmlSecondaryTable();
+ case OrmPackage.XML_SEQUENCE_GENERATOR: return (EObject)createXmlSequenceGenerator();
+ case OrmPackage.SQL_RESULT_SET_MAPPING: return (EObject)createSqlResultSetMapping();
+ case OrmPackage.XML_TABLE: return (EObject)createXmlTable();
+ case OrmPackage.XML_TABLE_GENERATOR: return (EObject)createXmlTableGenerator();
+ case OrmPackage.XML_TRANSIENT: return (EObject)createXmlTransient();
+ case OrmPackage.XML_UNIQUE_CONSTRAINT: return (EObject)createXmlUniqueConstraint();
+ case OrmPackage.XML_VERSION: return (EObject)createXmlVersion();
+ 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);
+ 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);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlAssociationOverride createXmlAssociationOverride()
+ {
+ XmlAssociationOverride xmlAssociationOverride = new XmlAssociationOverride();
+ return xmlAssociationOverride;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlAttributeOverride createXmlAttributeOverride()
+ {
+ XmlAttributeOverride xmlAttributeOverride = new XmlAttributeOverride();
+ return xmlAttributeOverride;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Attributes createAttributes()
+ {
+ Attributes attributes = new Attributes();
+ return attributes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlBasic createXmlBasic()
+ {
+ XmlBasic xmlBasic = new XmlBasic();
+ return xmlBasic;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CascadeType createCascadeType()
+ {
+ CascadeType cascadeType = new CascadeType();
+ return cascadeType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlClassReference createXmlClassReference()
+ {
+ XmlClassReference xmlClassReference = new XmlClassReference();
+ return xmlClassReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlCollectionTable createXmlCollectionTable()
+ {
+ XmlCollectionTable xmlCollectionTable = new XmlCollectionTable();
+ return xmlCollectionTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlColumn createXmlColumn()
+ {
+ XmlColumn xmlColumn = new XmlColumn();
+ return xmlColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ColumnResult createColumnResult()
+ {
+ ColumnResult columnResult = new ColumnResult();
+ return columnResult;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlDiscriminatorColumn createXmlDiscriminatorColumn()
+ {
+ XmlDiscriminatorColumn xmlDiscriminatorColumn = new XmlDiscriminatorColumn();
+ return xmlDiscriminatorColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlElementCollection createXmlElementCollection()
+ {
+ XmlElementCollection xmlElementCollection = new XmlElementCollection();
+ return xmlElementCollection;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlEmbeddable createXmlEmbeddable()
+ {
+ XmlEmbeddable xmlEmbeddable = new XmlEmbeddable();
+ return xmlEmbeddable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlEmbedded createXmlEmbedded()
+ {
+ XmlEmbedded xmlEmbedded = new XmlEmbedded();
+ return xmlEmbedded;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlEmbeddedId createXmlEmbeddedId()
+ {
+ XmlEmbeddedId xmlEmbeddedId = new XmlEmbeddedId();
+ return xmlEmbeddedId;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlEntity createXmlEntity()
+ {
+ XmlEntity xmlEntity = new XmlEntity();
+ return xmlEntity;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EntityListener createEntityListener()
+ {
+ EntityListener entityListener = new EntityListener();
+ return entityListener;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EntityListeners createEntityListeners()
+ {
+ EntityListeners entityListeners = new EntityListeners();
+ return entityListeners;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlEntityMappings createXmlEntityMappings()
+ {
+ XmlEntityMappings xmlEntityMappings = new XmlEntityMappings();
+ return xmlEntityMappings;
+ }
+
+ /**
+ * <!-- 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 XmlGeneratedValue createXmlGeneratedValue()
+ {
+ XmlGeneratedValue xmlGeneratedValue = new XmlGeneratedValue();
+ return xmlGeneratedValue;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlId createXmlId()
+ {
+ XmlId xmlId = new XmlId();
+ return xmlId;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Inheritance createInheritance()
+ {
+ Inheritance inheritance = new Inheritance();
+ return inheritance;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlJoinColumn createXmlJoinColumn()
+ {
+ XmlJoinColumn xmlJoinColumn = new XmlJoinColumn();
+ return xmlJoinColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlJoinTable createXmlJoinTable()
+ {
+ XmlJoinTable xmlJoinTable = new XmlJoinTable();
+ return xmlJoinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Lob createLob()
+ {
+ Lob lob = new Lob();
+ return lob;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlManyToMany createXmlManyToMany()
+ {
+ XmlManyToMany xmlManyToMany = new XmlManyToMany();
+ return xmlManyToMany;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlManyToOne createXmlManyToOne()
+ {
+ XmlManyToOne xmlManyToOne = new XmlManyToOne();
+ return xmlManyToOne;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MapKey createMapKey()
+ {
+ MapKey mapKey = new MapKey();
+ return mapKey;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlMappedSuperclass createXmlMappedSuperclass()
+ {
+ XmlMappedSuperclass xmlMappedSuperclass = new XmlMappedSuperclass();
+ return xmlMappedSuperclass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlNamedNativeQuery createXmlNamedNativeQuery()
+ {
+ XmlNamedNativeQuery xmlNamedNativeQuery = new XmlNamedNativeQuery();
+ return xmlNamedNativeQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlNamedQuery createXmlNamedQuery()
+ {
+ XmlNamedQuery xmlNamedQuery = new XmlNamedQuery();
+ return xmlNamedQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlOneToMany createXmlOneToMany()
+ {
+ XmlOneToMany xmlOneToMany = new XmlOneToMany();
+ return xmlOneToMany;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlOneToOne createXmlOneToOne()
+ {
+ XmlOneToOne xmlOneToOne = new XmlOneToOne();
+ return xmlOneToOne;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlOrderColumn createXmlOrderColumn()
+ {
+ XmlOrderColumn xmlOrderColumn = new XmlOrderColumn();
+ return xmlOrderColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlPersistenceUnitDefaults createXmlPersistenceUnitDefaults()
+ {
+ XmlPersistenceUnitDefaults xmlPersistenceUnitDefaults = new XmlPersistenceUnitDefaults();
+ return xmlPersistenceUnitDefaults;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlPersistenceUnitMetadata createXmlPersistenceUnitMetadata()
+ {
+ XmlPersistenceUnitMetadata xmlPersistenceUnitMetadata = new XmlPersistenceUnitMetadata();
+ return xmlPersistenceUnitMetadata;
+ }
+
+ /**
+ * <!-- 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 XmlPrimaryKeyJoinColumn createXmlPrimaryKeyJoinColumn()
+ {
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = new XmlPrimaryKeyJoinColumn();
+ return xmlPrimaryKeyJoinColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlQueryHint createXmlQueryHint()
+ {
+ XmlQueryHint xmlQueryHint = new XmlQueryHint();
+ return xmlQueryHint;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlSecondaryTable createXmlSecondaryTable()
+ {
+ XmlSecondaryTable xmlSecondaryTable = new XmlSecondaryTable();
+ return xmlSecondaryTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlSequenceGenerator createXmlSequenceGenerator()
+ {
+ XmlSequenceGenerator xmlSequenceGenerator = new XmlSequenceGenerator();
+ return xmlSequenceGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SqlResultSetMapping createSqlResultSetMapping()
+ {
+ SqlResultSetMapping sqlResultSetMapping = new SqlResultSetMapping();
+ return sqlResultSetMapping;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlTable createXmlTable()
+ {
+ XmlTable xmlTable = new XmlTable();
+ return xmlTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlTableGenerator createXmlTableGenerator()
+ {
+ XmlTableGenerator xmlTableGenerator = new XmlTableGenerator();
+ return xmlTableGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlTransient createXmlTransient()
+ {
+ XmlTransient xmlTransient = new XmlTransient();
+ return xmlTransient;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlUniqueConstraint createXmlUniqueConstraint()
+ {
+ XmlUniqueConstraint xmlUniqueConstraint = new XmlUniqueConstraint();
+ return xmlUniqueConstraint;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlVersion createXmlVersion()
+ {
+ XmlVersion xmlVersion = new XmlVersion();
+ return xmlVersion;
+ }
+
+ /**
+ * <!-- 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 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.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java
new file mode 100644
index 0000000000..715b6aa4e5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java
@@ -0,0 +1,12554 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+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.emf.ecore.xml.type.XMLTypePackage;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.xml.CommonPackage;
+
+/**
+ * <!-- 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.jpa.core.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.jpa.core.resource.orm";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final OrmPackage eINSTANCE = org.eclipse.jpt.jpa.core.resource.orm.OrmPackage.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder <em>Xml Access Holder</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder()
+ * @generated
+ */
+ public static final int XML_ACCESS_HOLDER = 10;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ACCESS_HOLDER__ACCESS = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Access Holder</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ACCESS_HOLDER_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping <em>Xml Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeMapping()
+ * @generated
+ */
+ public static final int XML_ATTRIBUTE_MAPPING = 11;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTE_MAPPING__ACCESS = OrmV2_0Package.XML_ATTRIBUTE_MAPPING_20__ACCESS;
+
+ /**
+ * 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_MAPPING__NAME = OrmV2_0Package.XML_ATTRIBUTE_MAPPING_20_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 = OrmV2_0Package.XML_ATTRIBUTE_MAPPING_20_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlAttributeMapping <em>Abstract Xml Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlAttributeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlAttributeMapping()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_ATTRIBUTE_MAPPING = 0;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS = XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * 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_ATTRIBUTE_MAPPING__NAME = XML_ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The number of structural features of the '<em>Abstract Xml Attribute Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn <em>Abstract Xml Named Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlNamedColumn()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_NAMED_COLUMN = 4;
+
+ /**
+ * 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 = 0;
+
+ /**
+ * 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 = 1;
+
+ /**
+ * 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 = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn <em>Abstract Xml Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_COLUMN = 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 ABSTRACT_XML_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_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_XML_COLUMN__NAME = ABSTRACT_XML_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_XML_COLUMN__INSERTABLE = 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>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 + 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_XML_COLUMN__UNIQUE = ABSTRACT_XML_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_XML_COLUMN__UPDATABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 4;
+
+ /**
+ * 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 + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded <em>Abstract Xml Embedded</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlEmbedded()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_EMBEDDED = 2;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_EMBEDDED__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * 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_EMBEDDED__NAME = ABSTRACT_XML_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 ABSTRACT_XML_EMBEDDED__ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Abstract Xml Embedded</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_EMBEDDED_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping <em>Abstract Xml Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlRelationshipMapping()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_RELATIONSHIP_MAPPING = 5;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_RELATIONSHIP_MAPPING__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * 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_RELATIONSHIP_MAPPING__NAME = ABSTRACT_XML_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 ABSTRACT_XML_RELATIONSHIP_MAPPING__TARGET_ENTITY = ABSTRACT_XML_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 ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Abstract Xml Relationship Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping <em>Abstract Xml Multi Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlMultiRelationshipMapping()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING = 3;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ACCESS = ABSTRACT_XML_RELATIONSHIP_MAPPING__ACCESS;
+
+ /**
+ * 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_MULTI_RELATIONSHIP_MAPPING__NAME = ABSTRACT_XML_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 ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY = ABSTRACT_XML_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 ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__FETCH = ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__CASCADE = ABSTRACT_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 ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * 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 ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 8;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 9;
+
+ /**
+ * 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 ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 10;
+
+ /**
+ * The number of structural features of the '<em>Abstract Xml Multi Relationship Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 11;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping <em>Abstract Xml Single Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlSingleRelationshipMapping()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING = 6;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ACCESS = ABSTRACT_XML_RELATIONSHIP_MAPPING__ACCESS;
+
+ /**
+ * 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_SINGLE_RELATIONSHIP_MAPPING__NAME = ABSTRACT_XML_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 ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY = ABSTRACT_XML_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 ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__FETCH = ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__CASCADE = ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * 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 ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE = ABSTRACT_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 ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID = ABSTRACT_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 ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>Abstract Xml Single Relationship Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT = ABSTRACT_XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable <em>Abstract Xml Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlTable()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_TABLE = 8;
+
+ /**
+ * 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 = 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_XML_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_XML_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_XML_TABLE__UNIQUE_CONSTRAINTS = 3;
+
+ /**
+ * 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 = 4;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping <em>Xml Type Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping()
+ * @generated
+ */
+ public static final int XML_TYPE_MAPPING = 83;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTypeMapping <em>Abstract Xml Type Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTypeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlTypeMapping()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_TYPE_MAPPING = 9;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride <em>Xml Association Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverride()
+ * @generated
+ */
+ public static final int XML_ASSOCIATION_OVERRIDE = 12;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer <em>Xml Association Override Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer()
+ * @generated
+ */
+ public static final int XML_ASSOCIATION_OVERRIDE_CONTAINER = 13;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride <em>Xml Attribute Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverride()
+ * @generated
+ */
+ public static final int XML_ATTRIBUTE_OVERRIDE = 14;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer <em>Xml Attribute Override Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer()
+ * @generated
+ */
+ public static final int XML_ATTRIBUTE_OVERRIDE_CONTAINER = 15;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes <em>Attributes</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.Attributes
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAttributes()
+ * @generated
+ */
+ public static final int ATTRIBUTES = 16;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlBasic <em>Xml Basic</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlBasic
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlBasic()
+ * @generated
+ */
+ public static final int XML_BASIC = 17;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType <em>Cascade Type</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.CascadeType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getCascadeType()
+ * @generated
+ */
+ public static final int CASCADE_TYPE = 18;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable <em>Abstract Xml Reference Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlReferenceTable()
+ * @generated
+ */
+ public static final int ABSTRACT_XML_REFERENCE_TABLE = 7;
+
+ /**
+ * 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_REFERENCE_TABLE__NAME = ABSTRACT_XML_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 ABSTRACT_XML_REFERENCE_TABLE__CATALOG = ABSTRACT_XML_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 ABSTRACT_XML_REFERENCE_TABLE__SCHEMA = ABSTRACT_XML_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 ABSTRACT_XML_REFERENCE_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_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 ABSTRACT_XML_REFERENCE_TABLE__JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Abstract Xml Reference Table</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_REFERENCE_TABLE_FEATURE_COUNT = ABSTRACT_XML_TABLE_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 XML_TYPE_MAPPING__ACCESS = XML_ACCESS_HOLDER__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_TYPE_MAPPING__CLASS_NAME = XML_ACCESS_HOLDER_FEATURE_COUNT + 0;
+
+ /**
+ * 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 = XML_ACCESS_HOLDER_FEATURE_COUNT + 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_TYPE_MAPPING__DESCRIPTION = XML_ACCESS_HOLDER_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Attributes</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_TYPE_MAPPING__ATTRIBUTES = XML_ACCESS_HOLDER_FEATURE_COUNT + 3;
+
+ /**
+ * 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 = XML_ACCESS_HOLDER_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_TYPE_MAPPING__ACCESS = XML_TYPE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME = XML_TYPE_MAPPING__CLASS_NAME;
+
+ /**
+ * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_TYPE_MAPPING__METADATA_COMPLETE = XML_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 ABSTRACT_XML_TYPE_MAPPING__DESCRIPTION = XML_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 ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES = XML_TYPE_MAPPING__ATTRIBUTES;
+
+ /**
+ * The number of structural features of the '<em>Abstract Xml Type Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT = XML_TYPE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOverride <em>Xml Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOverride
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOverride()
+ * @generated
+ */
+ public static final int XML_OVERRIDE = 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_OVERRIDE__NAME = 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 = 1;
+
+ /**
+ * 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>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ASSOCIATION_OVERRIDE__JOIN_TABLE = XML_OVERRIDE_FEATURE_COUNT + 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_ASSOCIATION_OVERRIDE__DESCRIPTION = 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 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_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Association Override Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ASSOCIATION_OVERRIDE_CONTAINER_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 XML_ATTRIBUTE_OVERRIDE__NAME = XML_OVERRIDE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTE_OVERRIDE__DESCRIPTION = XML_OVERRIDE_FEATURE_COUNT + 0;
+
+ /**
+ * 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 + 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 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_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Attribute Override Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTE_OVERRIDE_CONTAINER_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__DESCRIPTION = OrmV2_0Package.XML_ATTRIBUTES_20__DESCRIPTION;
+
+ /**
+ * The feature id for the '<em><b>Element Collections</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__ELEMENT_COLLECTIONS = OrmV2_0Package.XML_ATTRIBUTES_20__ELEMENT_COLLECTIONS;
+
+ /**
+ * 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_ATTRIBUTES_20_FEATURE_COUNT + 10;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_BASIC__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_BASIC__NAME = ABSTRACT_XML_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 XML_BASIC__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * 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 = ABSTRACT_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_BASIC__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Cascade Detach</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE__CASCADE_DETACH = OrmV2_0Package.XML_CASCADE_TYPE_20__CASCADE_DETACH;
+
+ /**
+ * 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 = OrmV2_0Package.XML_CASCADE_TYPE_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_CASCADE_TYPE_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_CASCADE_TYPE_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_CASCADE_TYPE_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_CASCADE_TYPE_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_CASCADE_TYPE_20_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference <em>Xml Class Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlClassReference()
+ * @generated
+ */
+ public static final int XML_CLASS_REFERENCE = 19;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CLASS_REFERENCE__CLASS_NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Class Reference</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CLASS_REFERENCE_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable <em>Xml Collection Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlCollectionTable()
+ * @generated
+ */
+ public static final int XML_COLLECTION_TABLE = 20;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_COLLECTION_TABLE__NAME = ABSTRACT_XML_REFERENCE_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 XML_COLLECTION_TABLE__CATALOG = ABSTRACT_XML_REFERENCE_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 XML_COLLECTION_TABLE__SCHEMA = ABSTRACT_XML_REFERENCE_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 XML_COLLECTION_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_REFERENCE_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 XML_COLLECTION_TABLE__JOIN_COLUMNS = ABSTRACT_XML_REFERENCE_TABLE__JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>Xml Collection Table</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_COLLECTION_TABLE_FEATURE_COUNT = ABSTRACT_XML_REFERENCE_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn <em>Xml Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlColumn()
+ * @generated
+ */
+ public static final int XML_COLUMN = 21;
+
+ /**
+ * 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>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>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>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>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>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>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>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>Precision</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_COLUMN__PRECISION = ABSTRACT_XML_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 XML_COLUMN__SCALE = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 2;
+
+ /**
+ * 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 + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.ColumnMapping <em>Column Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.ColumnMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnMapping()
+ * @generated
+ */
+ public static final int COLUMN_MAPPING = 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 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.jpa.core.resource.orm.ColumnResult <em>Column Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.ColumnResult
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnResult()
+ * @generated
+ */
+ public static final int COLUMN_RESULT = 23;
+
+ /**
+ * 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.jpa.core.resource.orm.XmlConvertibleMapping <em>Xml Convertible Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping()
+ * @generated
+ */
+ public static final int XML_CONVERTIBLE_MAPPING = 24;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CONVERTIBLE_MAPPING__LOB = 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_CONVERTIBLE_MAPPING__TEMPORAL = 1;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CONVERTIBLE_MAPPING__ENUMERATED = 2;
+
+ /**
+ * The number of structural features of the '<em>Xml Convertible Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CONVERTIBLE_MAPPING_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn <em>Xml Discriminator Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn()
+ * @generated
+ */
+ public static final int XML_DISCRIMINATOR_COLUMN = 25;
+
+ /**
+ * 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>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>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>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 + 1;
+
+ /**
+ * 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 + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection <em>Xml Element Collection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection()
+ * @generated
+ */
+ public static final int XML_ELEMENT_COLLECTION = 26;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__NAME = ABSTRACT_XML_ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__LOB = ABSTRACT_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_ELEMENT_COLLECTION__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__ORDER_COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * 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_ELEMENT_COLLECTION__ORDER_BY = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 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 XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * 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_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Target Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__TARGET_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__FETCH = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9;
+
+ /**
+ * 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 XML_ELEMENT_COLLECTION__MAP_KEY = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_CLASS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 11;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 12;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 13;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 14;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 15;
+
+ /**
+ * 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_ELEMENT_COLLECTION__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 16;
+
+ /**
+ * The feature id for the '<em><b>Collection Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION__COLLECTION_TABLE = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 17;
+
+ /**
+ * The number of structural features of the '<em>Xml Element Collection</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_FEATURE_COUNT = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 18;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable <em>Xml Embeddable</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbeddable()
+ * @generated
+ */
+ public static final int XML_EMBEDDABLE = 27;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EMBEDDABLE__CLASS_NAME = ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME;
+
+ /**
+ * 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 = ABSTRACT_XML_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 XML_EMBEDDABLE__DESCRIPTION = ABSTRACT_XML_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 XML_EMBEDDABLE__ATTRIBUTES = ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded <em>Xml Embedded</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbedded()
+ * @generated
+ */
+ public static final int XML_EMBEDDED = 28;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EMBEDDED__ACCESS = ABSTRACT_XML_EMBEDDED__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EMBEDDED__NAME = ABSTRACT_XML_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 XML_EMBEDDED__ATTRIBUTE_OVERRIDES = ABSTRACT_XML_EMBEDDED__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_EMBEDDED__ASSOCIATION_OVERRIDES = ABSTRACT_XML_EMBEDDED_FEATURE_COUNT + 0;
+
+ /**
+ * 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 = ABSTRACT_XML_EMBEDDED_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId <em>Xml Embedded Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbeddedId()
+ * @generated
+ */
+ public static final int XML_EMBEDDED_ID = 29;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EMBEDDED_ID__ACCESS = ABSTRACT_XML_EMBEDDED__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EMBEDDED_ID__NAME = ABSTRACT_XML_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 XML_EMBEDDED_ID__ATTRIBUTE_OVERRIDES = ABSTRACT_XML_EMBEDDED__ATTRIBUTE_OVERRIDES;
+
+ /**
+ * 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 = ABSTRACT_XML_EMBEDDED_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity <em>Xml Entity</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntity
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntity()
+ * @generated
+ */
+ public static final int XML_ENTITY = 30;
+
+ /**
+ * 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__ACCESS = ABSTRACT_XML_TYPE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY__CLASS_NAME = ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME;
+
+ /**
+ * 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__METADATA_COMPLETE = ABSTRACT_XML_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 XML_ENTITY__DESCRIPTION = ABSTRACT_XML_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 XML_ENTITY__ATTRIBUTES = ABSTRACT_XML_TYPE_MAPPING__ATTRIBUTES;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_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_ENTITY__TABLE_GENERATOR = ABSTRACT_XML_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 XML_ENTITY__PRE_PERSIST = ABSTRACT_XML_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 XML_ENTITY__POST_PERSIST = ABSTRACT_XML_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 XML_ENTITY__PRE_REMOVE = ABSTRACT_XML_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 XML_ENTITY__POST_REMOVE = ABSTRACT_XML_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 XML_ENTITY__PRE_UPDATE = ABSTRACT_XML_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 XML_ENTITY__POST_UPDATE = ABSTRACT_XML_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 XML_ENTITY__POST_LOAD = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 10;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 11;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 12;
+
+ /**
+ * The feature id for the '<em><b>Cacheable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY__CACHEABLE = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 13;
+
+ /**
+ * 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 XML_ENTITY__ID_CLASS = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 14;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 15;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 16;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 17;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 18;
+
+ /**
+ * The feature id for the '<em><b>Inheritance</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY__INHERITANCE = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 19;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 20;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 21;
+
+ /**
+ * 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 XML_ENTITY__SQL_RESULT_SET_MAPPINGS = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 22;
+
+ /**
+ * 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 XML_ENTITY__EXCLUDE_DEFAULT_LISTENERS = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 23;
+
+ /**
+ * 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 XML_ENTITY__EXCLUDE_SUPERCLASS_LISTENERS = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 24;
+
+ /**
+ * 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 XML_ENTITY__ENTITY_LISTENERS = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 25;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 26;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer <em>Xml Event Method Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer()
+ * @generated
+ */
+ public static final int XML_EVENT_METHOD_CONTAINER = 36;
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__PRE_PERSIST = 0;
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__POST_PERSIST = 1;
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__PRE_REMOVE = 2;
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__POST_REMOVE = 3;
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__PRE_UPDATE = 4;
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__POST_UPDATE = 5;
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__POST_LOAD = 6;
+
+ /**
+ * The number of structural features of the '<em>Xml Event Method Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EVENT_METHOD_CONTAINER_FEATURE_COUNT = 7;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EntityListener <em>Entity Listener</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EntityListener
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEntityListener()
+ * @generated
+ */
+ public static final int ENTITY_LISTENER = 31;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER__PRE_PERSIST;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER__POST_PERSIST;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER__PRE_REMOVE;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER__POST_REMOVE;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER__PRE_UPDATE;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER__POST_UPDATE;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER__POST_LOAD;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__DESCRIPTION = XML_EVENT_METHOD_CONTAINER_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 ENTITY_LISTENER__CLASS_NAME = XML_EVENT_METHOD_CONTAINER_FEATURE_COUNT + 1;
+
+ /**
+ * 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 = XML_EVENT_METHOD_CONTAINER_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EntityListeners <em>Entity Listeners</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EntityListeners
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEntityListeners()
+ * @generated
+ */
+ public static final int ENTITY_LISTENERS = 32;
+
+ /**
+ * 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.jpa.core.resource.orm.XmlEntityMappings <em>Xml Entity Mappings</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings()
+ * @generated
+ */
+ public static final int XML_ENTITY_MAPPINGS = 33;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EntityResult <em>Entity Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EntityResult
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEntityResult()
+ * @generated
+ */
+ public static final int ENTITY_RESULT = 34;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EventMethod <em>Event Method</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EventMethod
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEventMethod()
+ * @generated
+ */
+ public static final int EVENT_METHOD = 35;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.FieldResult <em>Field Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.FieldResult
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getFieldResult()
+ * @generated
+ */
+ public static final int FIELD_RESULT = 37;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue <em>Xml Generated Value</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratedValue()
+ * @generated
+ */
+ public static final int XML_GENERATED_VALUE = 38;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator <em>Xml Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGenerator()
+ * @generated
+ */
+ public static final int XML_GENERATOR = 39;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer <em>Xml Generator Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer()
+ * @generated
+ */
+ public static final int XML_GENERATOR_CONTAINER = 40;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlId <em>Xml Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlId
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlId()
+ * @generated
+ */
+ public static final int XML_ID = 41;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.Inheritance <em>Inheritance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.Inheritance
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getInheritance()
+ * @generated
+ */
+ public static final int INHERITANCE = 43;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn <em>Xml Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinColumn()
+ * @generated
+ */
+ public static final int XML_JOIN_COLUMN = 44;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable <em>Xml Join Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTable()
+ * @generated
+ */
+ public static final int XML_JOIN_TABLE = 46;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.Lob <em>Lob</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.Lob
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getLob()
+ * @generated
+ */
+ public static final int LOB = 48;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany <em>Xml Many To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlManyToMany()
+ * @generated
+ */
+ public static final int XML_MANY_TO_MANY = 49;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne <em>Xml Many To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlManyToOne()
+ * @generated
+ */
+ public static final int XML_MANY_TO_ONE = 50;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.MapKey <em>Map Key</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.MapKey
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getMapKey()
+ * @generated
+ */
+ public static final int MAP_KEY = 51;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping <em>Xml Mapped By Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMappedByMapping()
+ * @generated
+ */
+ public static final int XML_MAPPED_BY_MAPPING = 52;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass <em>Xml Mapped Superclass</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMappedSuperclass()
+ * @generated
+ */
+ public static final int XML_MAPPED_SUPERCLASS = 53;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery <em>Xml Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQuery
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQuery()
+ * @generated
+ */
+ public static final int XML_QUERY = 74;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery <em>Xml Named Native Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNamedNativeQuery()
+ * @generated
+ */
+ public static final int XML_NAMED_NATIVE_QUERY = 54;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery <em>Xml Named Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNamedQuery()
+ * @generated
+ */
+ public static final int XML_NAMED_QUERY = 55;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping <em>Xml Null Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNullAttributeMapping()
+ * @generated
+ */
+ public static final int XML_NULL_ATTRIBUTE_MAPPING = 56;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany <em>Xml One To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOneToMany()
+ * @generated
+ */
+ public static final int XML_ONE_TO_MANY = 57;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne <em>Xml One To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOneToOne()
+ * @generated
+ */
+ public static final int XML_ONE_TO_ONE = 58;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn <em>Xml Order Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderColumn()
+ * @generated
+ */
+ public static final int XML_ORDER_COLUMN = 60;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults <em>Xml Persistence Unit Defaults</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_DEFAULTS = 62;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata <em>Xml Persistence Unit Metadata</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitMetadata()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_METADATA = 63;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostLoad <em>Post Load</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostLoad
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostLoad()
+ * @generated
+ */
+ public static final int POST_LOAD = 65;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostPersist <em>Post Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostPersist
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostPersist()
+ * @generated
+ */
+ public static final int POST_PERSIST = 66;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostRemove <em>Post Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostRemove
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostRemove()
+ * @generated
+ */
+ public static final int POST_REMOVE = 67;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostUpdate <em>Post Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostUpdate
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostUpdate()
+ * @generated
+ */
+ public static final int POST_UPDATE = 68;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PrePersist <em>Pre Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PrePersist
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPrePersist()
+ * @generated
+ */
+ public static final int PRE_PERSIST = 69;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PreRemove <em>Pre Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PreRemove
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPreRemove()
+ * @generated
+ */
+ public static final int PRE_REMOVE = 70;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PreUpdate <em>Pre Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PreUpdate
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPreUpdate()
+ * @generated
+ */
+ public static final int PRE_UPDATE = 71;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn <em>Xml Primary Key Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
+ * @generated
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN = 72;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer <em>Xml Query Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer()
+ * @generated
+ */
+ public static final int XML_QUERY_CONTAINER = 75;
+
+ /**
+ * The feature id for the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_MAPPINGS__VERSION = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__VERSION;
+
+ /**
+ * The feature id for the '<em><b>Schema Location</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_MAPPINGS__SCHEMA_LOCATION = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION;
+
+ /**
+ * 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_MAPPINGS__NAMED_QUERIES = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 0;
+
+ /**
+ * 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_MAPPINGS__NAMED_NATIVE_QUERIES = CommonPackage.ABSTRACT_JPA_ROOT_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 XML_ENTITY_MAPPINGS__ACCESS = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_MAPPINGS__DESCRIPTION = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 3;
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Package</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_MAPPINGS__PACKAGE = CommonPackage.ABSTRACT_JPA_ROOT_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 XML_ENTITY_MAPPINGS__SCHEMA = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_MAPPINGS__CATALOG = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 7;
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 8;
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__TABLE_GENERATORS = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 9;
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 10;
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 11;
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__ENTITIES = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 12;
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__EMBEDDABLES = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 13;
+
+ /**
+ * The number of structural features of the '<em>Xml Entity Mappings</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_MAPPINGS_FEATURE_COUNT = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 14;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EVENT_METHOD__DESCRIPTION = OrmV2_0Package.XML_EVENT_METHOD_20__DESCRIPTION;
+
+ /**
+ * 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 = OrmV2_0Package.XML_EVENT_METHOD_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_EVENT_METHOD_20_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 XML_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 XML_GENERATED_VALUE__STRATEGY = 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 = 2;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_GENERATOR__DESCRIPTION = OrmV2_0Package.XML_GENERATOR_20__DESCRIPTION;
+
+ /**
+ * 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 = OrmV2_0Package.XML_GENERATOR_20_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 = OrmV2_0Package.XML_GENERATOR_20_FEATURE_COUNT + 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 XML_GENERATOR__ALLOCATION_SIZE = OrmV2_0Package.XML_GENERATOR_20_FEATURE_COUNT + 2;
+
+ /**
+ * 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 = OrmV2_0Package.XML_GENERATOR_20_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_GENERATOR_CONTAINER__SEQUENCE_GENERATOR = 0;
+
+ /**
+ * 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_GENERATOR_CONTAINER__TABLE_GENERATOR = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Generator Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_GENERATOR_CONTAINER_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 XML_ID__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID__NAME = ABSTRACT_XML_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 XML_ID__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID__LOB = ABSTRACT_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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID__ENUMERATED = ABSTRACT_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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer <em>Xml Id Class Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlIdClassContainer()
+ * @generated
+ */
+ public static final int XML_ID_CLASS_CONTAINER = 42;
+
+ /**
+ * 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 XML_ID_CLASS_CONTAINER__ID_CLASS = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Id Class Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ID_CLASS_CONTAINER_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 XML_JOIN_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_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 XML_JOIN_COLUMN__NAME = ABSTRACT_XML_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 XML_JOIN_COLUMN__INSERTABLE = ABSTRACT_XML_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 XML_JOIN_COLUMN__NULLABLE = ABSTRACT_XML_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 XML_JOIN_COLUMN__TABLE = ABSTRACT_XML_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 XML_JOIN_COLUMN__UNIQUE = ABSTRACT_XML_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 XML_JOIN_COLUMN__UPDATABLE = ABSTRACT_XML_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 XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * 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 + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer <em>Xml Join Column Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinColumnContainer()
+ * @generated
+ */
+ public static final int XML_JOIN_COLUMN_CONTAINER = 45;
+
+ /**
+ * 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_COLUMN_CONTAINER__JOIN_COLUMNS = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Join Column Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_JOIN_COLUMN_CONTAINER_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable <em>Xml Reference Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlReferenceTable()
+ * @generated
+ */
+ public static final int XML_REFERENCE_TABLE = 64;
+
+ /**
+ * 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_REFERENCE_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 XML_JOIN_TABLE__CATALOG = ABSTRACT_XML_REFERENCE_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 XML_JOIN_TABLE__SCHEMA = ABSTRACT_XML_REFERENCE_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 XML_JOIN_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_REFERENCE_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 XML_JOIN_TABLE__JOIN_COLUMNS = ABSTRACT_XML_REFERENCE_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 XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS = ABSTRACT_XML_REFERENCE_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * 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_REFERENCE_TABLE_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer <em>Xml Join Table Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTableContainer()
+ * @generated
+ */
+ public static final int XML_JOIN_TABLE_CONTAINER = 47;
+
+ /**
+ * 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_JOIN_TABLE_CONTAINER__JOIN_TABLE = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Join Table Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_JOIN_TABLE_CONTAINER_FEATURE_COUNT = 1;
+
+ /**
+ * 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>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__ACCESS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__NAME = ABSTRACT_XML_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 XML_MANY_TO_MANY__TARGET_ENTITY = ABSTRACT_XML_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 XML_MANY_TO_MANY__FETCH = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * 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 = ABSTRACT_XML_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 XML_MANY_TO_MANY__MAPPED_BY = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
+
+ /**
+ * 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 = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__ORDER_COLUMN = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN;
+
+ /**
+ * 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 = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__MAP_KEY_CLASS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__MAP_KEY_TEMPORAL = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__MAP_KEY_ENUMERATED = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__MAP_KEY_COLUMN = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY__MAP_KEY_JOIN_COLUMNS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS;
+
+ /**
+ * 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 XML_MANY_TO_MANY__MAP_KEY = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY;
+
+ /**
+ * 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 = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_ONE__ACCESS = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_ONE__NAME = ABSTRACT_XML_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 XML_MANY_TO_ONE__TARGET_ENTITY = ABSTRACT_XML_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 XML_MANY_TO_ONE__FETCH = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * 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 = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * 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_ONE__JOIN_TABLE = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * 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 = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_ONE__ID = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID;
+
+ /**
+ * The feature id for the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_ONE__MAPS_ID = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID;
+
+ /**
+ * 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 = ABSTRACT_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 = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING_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 feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAPPED_BY_MAPPING__MAPPED_BY = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Mapped By Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAPPED_BY_MAPPING_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 XML_MAPPED_SUPERCLASS__ACCESS = ABSTRACT_XML_TYPE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAPPED_SUPERCLASS__CLASS_NAME = ABSTRACT_XML_TYPE_MAPPING__CLASS_NAME;
+
+ /**
+ * 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 = ABSTRACT_XML_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 XML_MAPPED_SUPERCLASS__DESCRIPTION = ABSTRACT_XML_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 XML_MAPPED_SUPERCLASS__ATTRIBUTES = ABSTRACT_XML_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 XML_MAPPED_SUPERCLASS__ID_CLASS = ABSTRACT_XML_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 XML_MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS = ABSTRACT_XML_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 XML_MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS = ABSTRACT_XML_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 XML_MAPPED_SUPERCLASS__ENTITY_LISTENERS = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * 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 = ABSTRACT_XML_TYPE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_QUERY__DESCRIPTION = OrmV2_0Package.XML_QUERY_20__DESCRIPTION;
+
+ /**
+ * 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__NAME = OrmV2_0Package.XML_QUERY_20_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 XML_QUERY__QUERY = OrmV2_0Package.XML_QUERY_20_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 XML_QUERY__HINTS = OrmV2_0Package.XML_QUERY_20_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Xml Query</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_QUERY_FEATURE_COUNT = OrmV2_0Package.XML_QUERY_20_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 XML_NAMED_NATIVE_QUERY__DESCRIPTION = XML_QUERY__DESCRIPTION;
+
+ /**
+ * 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 = 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 = 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 = 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 = 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 = 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 = XML_QUERY_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_NAMED_QUERY__DESCRIPTION = XML_QUERY__DESCRIPTION;
+
+ /**
+ * 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 = 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 = 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 = XML_QUERY__HINTS;
+
+ /**
+ * The feature id for the '<em><b>Lock Mode</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_NAMED_QUERY__LOCK_MODE = XML_QUERY_FEATURE_COUNT + 0;
+
+ /**
+ * 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 = XML_QUERY_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 XML_NULL_ATTRIBUTE_MAPPING__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_NULL_ATTRIBUTE_MAPPING__NAME = ABSTRACT_XML_ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__ACCESS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__NAME = ABSTRACT_XML_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 XML_ONE_TO_MANY__TARGET_ENTITY = ABSTRACT_XML_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 XML_ONE_TO_MANY__FETCH = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * 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 = ABSTRACT_XML_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 XML_ONE_TO_MANY__MAPPED_BY = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
+
+ /**
+ * 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 = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__ORDER_COLUMN = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_COLUMN;
+
+ /**
+ * 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 = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__MAP_KEY_ATTRIBUTE_OVERRIDES = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ATTRIBUTE_OVERRIDES;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__MAP_KEY_CLASS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_CLASS;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__MAP_KEY_TEMPORAL = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_TEMPORAL;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__MAP_KEY_ENUMERATED = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_ENUMERATED;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__MAP_KEY_COLUMN = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__MAP_KEY_JOIN_COLUMNS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY_JOIN_COLUMNS;
+
+ /**
+ * 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 XML_ONE_TO_MANY__MAP_KEY = ABSTRACT_XML_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 XML_ONE_TO_MANY__JOIN_COLUMNS = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY__ORPHAN_REMOVAL = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * 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 = ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING_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 XML_ONE_TO_ONE__ACCESS = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE__NAME = ABSTRACT_XML_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 XML_ONE_TO_ONE__TARGET_ENTITY = ABSTRACT_XML_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 XML_ONE_TO_ONE__FETCH = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * 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 = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * 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_ONE__JOIN_TABLE = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * 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 = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE__ID = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__ID;
+
+ /**
+ * The feature id for the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE__MAPS_ID = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__MAPS_ID;
+
+ /**
+ * 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 = ABSTRACT_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 = ABSTRACT_XML_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 XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE__ORPHAN_REMOVAL = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * 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 = ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint <em>Xml Query Hint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQueryHint()
+ * @generated
+ */
+ public static final int XML_QUERY_HINT = 76;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable <em>Xml Secondary Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSecondaryTable()
+ * @generated
+ */
+ public static final int XML_SECONDARY_TABLE = 77;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator <em>Xml Sequence Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSequenceGenerator()
+ * @generated
+ */
+ public static final int XML_SEQUENCE_GENERATOR = 78;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping <em>Sql Result Set Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getSqlResultSetMapping()
+ * @generated
+ */
+ public static final int SQL_RESULT_SET_MAPPING = 79;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTable <em>Xml Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTable()
+ * @generated
+ */
+ public static final int XML_TABLE = 80;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator <em>Xml Table Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator()
+ * @generated
+ */
+ public static final int XML_TABLE_GENERATOR = 81;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTransient <em>Xml Transient</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTransient
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTransient()
+ * @generated
+ */
+ public static final int XML_TRANSIENT = 82;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint <em>Xml Unique Constraint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlUniqueConstraint()
+ * @generated
+ */
+ public static final int XML_UNIQUE_CONSTRAINT = 84;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlVersion <em>Xml Version</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlVersion
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlVersion()
+ * @generated
+ */
+ public static final int XML_VERSION = 85;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable <em>Xml Orderable</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderable()
+ * @generated
+ */
+ public static final int XML_ORDERABLE = 59;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDERABLE__ORDER_COLUMN = OrmV2_0Package.XML_ORDERABLE_20__ORDER_COLUMN;
+
+ /**
+ * 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_ORDERABLE__ORDER_BY = OrmV2_0Package.XML_ORDERABLE_20_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Orderable</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDERABLE_FEATURE_COUNT = OrmV2_0Package.XML_ORDERABLE_20_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 XML_ORDER_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_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 XML_ORDER_COLUMN__NAME = ABSTRACT_XML_NAMED_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN__NULLABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN__INSERTABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN__UPDATABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Xml Order Column</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN_FEATURE_COUNT = ABSTRACT_XML_NAMED_COLUMN_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_PERSISTENCE_UNIT_DEFAULTS__ACCESS = XML_ACCESS_HOLDER__ACCESS;
+
+ /**
+ * 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_DEFAULTS__DESCRIPTION = XML_ACCESS_HOLDER_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Delimited Identifiers</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS = XML_ACCESS_HOLDER_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 XML_PERSISTENCE_UNIT_DEFAULTS__SCHEMA = XML_ACCESS_HOLDER_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_PERSISTENCE_UNIT_DEFAULTS__CATALOG = XML_ACCESS_HOLDER_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Cascade Persist</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST = XML_ACCESS_HOLDER_FEATURE_COUNT + 4;
+
+ /**
+ * 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 XML_PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS = XML_ACCESS_HOLDER_FEATURE_COUNT + 5;
+
+ /**
+ * The number of structural features of the '<em>Xml Persistence Unit Defaults</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_DEFAULTS_FEATURE_COUNT = XML_ACCESS_HOLDER_FEATURE_COUNT + 6;
+
+ /**
+ * 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_METADATA__DESCRIPTION = OrmV2_0Package.XML_PERSISTENCE_UNIT_METADATA_20__DESCRIPTION;
+
+ /**
+ * 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 XML_PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE = OrmV2_0Package.XML_PERSISTENCE_UNIT_METADATA_20_FEATURE_COUNT + 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 XML_PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS = OrmV2_0Package.XML_PERSISTENCE_UNIT_METADATA_20_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Persistence Unit Metadata</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_METADATA_FEATURE_COUNT = OrmV2_0Package.XML_PERSISTENCE_UNIT_METADATA_20_FEATURE_COUNT + 2;
+
+ /**
+ * 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_REFERENCE_TABLE__JOIN_COLUMNS = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Reference Table</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_REFERENCE_TABLE_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_LOAD__DESCRIPTION = EVENT_METHOD__DESCRIPTION;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_PERSIST__DESCRIPTION = EVENT_METHOD__DESCRIPTION;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_REMOVE__DESCRIPTION = EVENT_METHOD__DESCRIPTION;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_UPDATE__DESCRIPTION = EVENT_METHOD__DESCRIPTION;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_PERSIST__DESCRIPTION = EVENT_METHOD__DESCRIPTION;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_REMOVE__DESCRIPTION = EVENT_METHOD__DESCRIPTION;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_UPDATE__DESCRIPTION = EVENT_METHOD__DESCRIPTION;
+
+ /**
+ * 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 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>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>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 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 + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer <em>Xml Primary Key Join Column Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnContainer()
+ * @generated
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER = 73;
+
+ /**
+ * 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_PRIMARY_KEY_JOIN_COLUMN_CONTAINER__PRIMARY_KEY_JOIN_COLUMNS = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Primary Key Join Column Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER_FEATURE_COUNT = 1;
+
+ /**
+ * 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_QUERY_CONTAINER__NAMED_QUERIES = 0;
+
+ /**
+ * 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_QUERY_CONTAINER__NAMED_NATIVE_QUERIES = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Query Container</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_QUERY_CONTAINER_FEATURE_COUNT = 2;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_QUERY_HINT__DESCRIPTION = OrmV2_0Package.XML_QUERY_HINT_20__DESCRIPTION;
+
+ /**
+ * 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 = OrmV2_0Package.XML_QUERY_HINT_20_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 = OrmV2_0Package.XML_QUERY_HINT_20_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 = OrmV2_0Package.XML_QUERY_HINT_20_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 XML_SECONDARY_TABLE__NAME = ABSTRACT_XML_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 XML_SECONDARY_TABLE__CATALOG = ABSTRACT_XML_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 XML_SECONDARY_TABLE__SCHEMA = ABSTRACT_XML_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 XML_SECONDARY_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_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 XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * 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 + 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_SEQUENCE_GENERATOR__DESCRIPTION = XML_GENERATOR__DESCRIPTION;
+
+ /**
+ * 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>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>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SEQUENCE_GENERATOR__CATALOG = XML_GENERATOR_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SEQUENCE_GENERATOR__SCHEMA = XML_GENERATOR_FEATURE_COUNT + 1;
+
+ /**
+ * 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 + 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SQL_RESULT_SET_MAPPING__DESCRIPTION = OrmV2_0Package.XML_SQL_RESULT_SET_MAPPING_20__DESCRIPTION;
+
+ /**
+ * 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 = OrmV2_0Package.XML_SQL_RESULT_SET_MAPPING_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_SQL_RESULT_SET_MAPPING_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_SQL_RESULT_SET_MAPPING_20_FEATURE_COUNT + 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 = OrmV2_0Package.XML_SQL_RESULT_SET_MAPPING_20_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 XML_TABLE__NAME = ABSTRACT_XML_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 XML_TABLE__CATALOG = ABSTRACT_XML_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 XML_TABLE__SCHEMA = ABSTRACT_XML_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 XML_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS;
+
+ /**
+ * 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 feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_TABLE_GENERATOR__DESCRIPTION = XML_GENERATOR__DESCRIPTION;
+
+ /**
+ * 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>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>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>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_TABLE_GENERATOR__CATALOG = XML_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 XML_TABLE_GENERATOR__SCHEMA = XML_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 XML_TABLE_GENERATOR__PK_COLUMN_NAME = XML_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 XML_TABLE_GENERATOR__VALUE_COLUMN_NAME = XML_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 XML_TABLE_GENERATOR__PK_COLUMN_VALUE = XML_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 XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS = XML_GENERATOR_FEATURE_COUNT + 6;
+
+ /**
+ * 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 + 7;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_TRANSIENT__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_TRANSIENT__NAME = ABSTRACT_XML_ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_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_UNIQUE_CONSTRAINT__NAME = OrmV2_0Package.XML_UNIQUE_CONSTRAINT_20__NAME;
+
+ /**
+ * 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 = OrmV2_0Package.XML_UNIQUE_CONSTRAINT_20_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 = OrmV2_0Package.XML_UNIQUE_CONSTRAINT_20_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 XML_VERSION__ACCESS = ABSTRACT_XML_ATTRIBUTE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_VERSION__NAME = ABSTRACT_XML_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 XML_VERSION__COLUMN = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_VERSION__LOB = ABSTRACT_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_VERSION__TEMPORAL = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_VERSION__ENUMERATED = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * 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 = ABSTRACT_XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AccessType <em>Access Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AccessType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAccessType()
+ * @generated
+ */
+ public static final int ACCESS_TYPE = 86;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType <em>Discriminator Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getDiscriminatorType()
+ * @generated
+ */
+ public static final int DISCRIMINATOR_TYPE = 87;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EnumType <em>Enum Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEnumType()
+ * @generated
+ */
+ public static final int ENUM_TYPE = 88;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.FetchType <em>Fetch Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.FetchType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getFetchType()
+ * @generated
+ */
+ public static final int FETCH_TYPE = 89;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.GenerationType <em>Generation Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.GenerationType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getGenerationType()
+ * @generated
+ */
+ public static final int GENERATION_TYPE = 90;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.InheritanceType <em>Inheritance Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.InheritanceType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getInheritanceType()
+ * @generated
+ */
+ public static final int INHERITANCE_TYPE = 91;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType <em>Temporal Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getTemporalType()
+ * @generated
+ */
+ public static final int TEMPORAL_TYPE = 92;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlAttributeMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlEmbeddedEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlMultiRelationshipMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlNamedColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlRelationshipMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlSingleRelationshipMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlTypeMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAccessHolderEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAttributeMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAssociationOverrideEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAssociationOverrideContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAttributeOverrideEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAttributeOverrideContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass attributesEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlBasicEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass cascadeTypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlClassReferenceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlCollectionTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass columnMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass columnResultEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlConvertibleMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlDiscriminatorColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlElementCollectionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlEmbeddableEClass = 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 xmlEntityEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityListenerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityListenersEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlEntityMappingsEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityResultEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass eventMethodEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlEventMethodContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass fieldResultEClass = 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 xmlGeneratorContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlIdEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlIdClassContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass inheritanceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlJoinColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlJoinColumnContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlJoinTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlJoinTableContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass lobEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlManyToManyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlManyToOneEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass mapKeyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlMappedByMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlMappedSuperclassEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlNamedNativeQueryEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlNamedQueryEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlNullAttributeMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOneToManyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOneToOneEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOrderColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOverrideEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPersistenceUnitDefaultsEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPersistenceUnitMetadataEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractXmlReferenceTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlReferenceTableEClass = 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 xmlPrimaryKeyJoinColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPrimaryKeyJoinColumnContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlQueryEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlQueryContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlQueryHintEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlSecondaryTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlSequenceGeneratorEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass sqlResultSetMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlTableGeneratorEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlTransientEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlTypeMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlUniqueConstraintEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlVersionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOrderableEClass = 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;
+
+ /**
+ * 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.jpa.core.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.
+ *
+ * <p>This method is used to initialize {@link OrmPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- 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.get(eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.get(eNS_URI) : new OrmPackage());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+ XMLTypePackage.eINSTANCE.eClass();
+
+ // Obtain or create and register interdependencies
+ CommonPackage theCommonPackage = (CommonPackage)(EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) instanceof CommonPackage ? EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) : CommonPackage.eINSTANCE);
+ OrmV2_0Package theOrmV2_0Package = (OrmV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) instanceof OrmV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) : OrmV2_0Package.eINSTANCE);
+ PersistencePackage thePersistencePackage = (PersistencePackage)(EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
+ PersistenceV2_0Package thePersistenceV2_0Package = (PersistenceV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) instanceof PersistenceV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) : PersistenceV2_0Package.eINSTANCE);
+
+ // Create package meta-data objects
+ theOrmPackage.createPackageContents();
+ theCommonPackage.createPackageContents();
+ theOrmV2_0Package.createPackageContents();
+ thePersistencePackage.createPackageContents();
+ thePersistenceV2_0Package.createPackageContents();
+
+ // Initialize created meta-data
+ theOrmPackage.initializePackageContents();
+ theCommonPackage.initializePackageContents();
+ theOrmV2_0Package.initializePackageContents();
+ thePersistencePackage.initializePackageContents();
+ thePersistenceV2_0Package.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theOrmPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(OrmPackage.eNS_URI, theOrmPackage);
+ return theOrmPackage;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlAttributeMapping <em>Abstract Xml Attribute Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Xml Attribute Mapping</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlAttributeMapping
+ * @generated
+ */
+ public EClass getAbstractXmlAttributeMapping()
+ {
+ return abstractXmlAttributeMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.AbstractXmlColumn
+ * @generated
+ */
+ public EClass getAbstractXmlColumn()
+ {
+ return abstractXmlColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getInsertable <em>Insertable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Insertable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getInsertable()
+ * @see #getAbstractXmlColumn()
+ * @generated
+ */
+ public EAttribute getAbstractXmlColumn_Insertable()
+ {
+ return (EAttribute)abstractXmlColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getNullable <em>Nullable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Nullable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getNullable()
+ * @see #getAbstractXmlColumn()
+ * @generated
+ */
+ public EAttribute getAbstractXmlColumn_Nullable()
+ {
+ return (EAttribute)abstractXmlColumnEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getTable <em>Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Table</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getTable()
+ * @see #getAbstractXmlColumn()
+ * @generated
+ */
+ public EAttribute getAbstractXmlColumn_Table()
+ {
+ return (EAttribute)abstractXmlColumnEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getUnique <em>Unique</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Unique</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getUnique()
+ * @see #getAbstractXmlColumn()
+ * @generated
+ */
+ public EAttribute getAbstractXmlColumn_Unique()
+ {
+ return (EAttribute)abstractXmlColumnEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getUpdatable <em>Updatable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Updatable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn#getUpdatable()
+ * @see #getAbstractXmlColumn()
+ * @generated
+ */
+ public EAttribute getAbstractXmlColumn_Updatable()
+ {
+ return (EAttribute)abstractXmlColumnEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded <em>Abstract Xml Embedded</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Xml Embedded</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded
+ * @generated
+ */
+ public EClass getAbstractXmlEmbedded()
+ {
+ return abstractXmlEmbeddedEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping <em>Abstract Xml Multi Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Xml Multi Relationship Mapping</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping
+ * @generated
+ */
+ public EClass getAbstractXmlMultiRelationshipMapping()
+ {
+ return abstractXmlMultiRelationshipMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#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.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping#getMapKey()
+ * @see #getAbstractXmlMultiRelationshipMapping()
+ * @generated
+ */
+ public EReference getAbstractXmlMultiRelationshipMapping_MapKey()
+ {
+ return (EReference)abstractXmlMultiRelationshipMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.AbstractXmlNamedColumn
+ * @generated
+ */
+ public EClass getAbstractXmlNamedColumn()
+ {
+ return abstractXmlNamedColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn#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.jpa.core.resource.orm.AbstractXmlNamedColumn#getColumnDefinition()
+ * @see #getAbstractXmlNamedColumn()
+ * @generated
+ */
+ public EAttribute getAbstractXmlNamedColumn_ColumnDefinition()
+ {
+ return (EAttribute)abstractXmlNamedColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn#getName()
+ * @see #getAbstractXmlNamedColumn()
+ * @generated
+ */
+ public EAttribute getAbstractXmlNamedColumn_Name()
+ {
+ return (EAttribute)abstractXmlNamedColumnEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping <em>Abstract Xml Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Xml Relationship Mapping</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping
+ * @generated
+ */
+ public EClass getAbstractXmlRelationshipMapping()
+ {
+ return abstractXmlRelationshipMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#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.jpa.core.resource.orm.AbstractXmlRelationshipMapping#getTargetEntity()
+ * @see #getAbstractXmlRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getAbstractXmlRelationshipMapping_TargetEntity()
+ {
+ return (EAttribute)abstractXmlRelationshipMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#getFetch <em>Fetch</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Fetch</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#getFetch()
+ * @see #getAbstractXmlRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getAbstractXmlRelationshipMapping_Fetch()
+ {
+ return (EAttribute)abstractXmlRelationshipMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping#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.jpa.core.resource.orm.AbstractXmlRelationshipMapping#getCascade()
+ * @see #getAbstractXmlRelationshipMapping()
+ * @generated
+ */
+ public EReference getAbstractXmlRelationshipMapping_Cascade()
+ {
+ return (EReference)abstractXmlRelationshipMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping <em>Abstract Xml Single Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Xml Single Relationship Mapping</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping
+ * @generated
+ */
+ public EClass getAbstractXmlSingleRelationshipMapping()
+ {
+ return abstractXmlSingleRelationshipMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping#getOptional <em>Optional</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Optional</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping#getOptional()
+ * @see #getAbstractXmlSingleRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getAbstractXmlSingleRelationshipMapping_Optional()
+ {
+ return (EAttribute)abstractXmlSingleRelationshipMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.AbstractXmlTable
+ * @generated
+ */
+ public EClass getAbstractXmlTable()
+ {
+ return abstractXmlTableEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getName()
+ * @see #getAbstractXmlTable()
+ * @generated
+ */
+ public EAttribute getAbstractXmlTable_Name()
+ {
+ return (EAttribute)abstractXmlTableEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getCatalog()
+ * @see #getAbstractXmlTable()
+ * @generated
+ */
+ public EAttribute getAbstractXmlTable_Catalog()
+ {
+ return (EAttribute)abstractXmlTableEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#getSchema()
+ * @see #getAbstractXmlTable()
+ * @generated
+ */
+ public EAttribute getAbstractXmlTable_Schema()
+ {
+ return (EAttribute)abstractXmlTableEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable#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.jpa.core.resource.orm.AbstractXmlTable#getUniqueConstraints()
+ * @see #getAbstractXmlTable()
+ * @generated
+ */
+ public EReference getAbstractXmlTable_UniqueConstraints()
+ {
+ return (EReference)abstractXmlTableEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTypeMapping <em>Abstract Xml Type Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Xml Type Mapping</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTypeMapping
+ * @generated
+ */
+ public EClass getAbstractXmlTypeMapping()
+ {
+ return abstractXmlTypeMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder <em>Xml Access Holder</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Access Holder</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder
+ * @generated
+ */
+ public EClass getXmlAccessHolder()
+ {
+ return xmlAccessHolderEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder#getAccess <em>Access</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Access</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder#getAccess()
+ * @see #getXmlAccessHolder()
+ * @generated
+ */
+ public EAttribute getXmlAccessHolder_Access()
+ {
+ return (EAttribute)xmlAccessHolderEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlAttributeMapping
+ * @generated
+ */
+ public EClass getXmlAttributeMapping()
+ {
+ return xmlAttributeMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping#getName()
+ * @see #getXmlAttributeMapping()
+ * @generated
+ */
+ public EAttribute getXmlAttributeMapping_Name()
+ {
+ return (EAttribute)xmlAttributeMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlAssociationOverride
+ * @generated
+ */
+ public EClass getXmlAssociationOverride()
+ {
+ return xmlAssociationOverrideEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer <em>Xml Association Override Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Association Override Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer
+ * @generated
+ */
+ public EClass getXmlAssociationOverrideContainer()
+ {
+ return xmlAssociationOverrideContainerEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer#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.jpa.core.resource.orm.XmlAssociationOverrideContainer#getAssociationOverrides()
+ * @see #getXmlAssociationOverrideContainer()
+ * @generated
+ */
+ public EReference getXmlAssociationOverrideContainer_AssociationOverrides()
+ {
+ return (EReference)xmlAssociationOverrideContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlAttributeOverride
+ * @generated
+ */
+ public EClass getXmlAttributeOverride()
+ {
+ return xmlAttributeOverrideEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride#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.jpa.core.resource.orm.XmlAttributeOverride#getColumn()
+ * @see #getXmlAttributeOverride()
+ * @generated
+ */
+ public EReference getXmlAttributeOverride_Column()
+ {
+ return (EReference)xmlAttributeOverrideEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer <em>Xml Attribute Override Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Attribute Override Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer
+ * @generated
+ */
+ public EClass getXmlAttributeOverrideContainer()
+ {
+ return xmlAttributeOverrideContainerEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer#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.jpa.core.resource.orm.XmlAttributeOverrideContainer#getAttributeOverrides()
+ * @see #getXmlAttributeOverrideContainer()
+ * @generated
+ */
+ public EReference getXmlAttributeOverrideContainer_AttributeOverrides()
+ {
+ return (EReference)xmlAttributeOverrideContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.Attributes
+ * @generated
+ */
+ public EClass getAttributes()
+ {
+ return attributesEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.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.jpa.core.resource.orm.XmlBasic
+ * @generated
+ */
+ public EClass getXmlBasic()
+ {
+ return xmlBasicEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlBasic#getFetch <em>Fetch</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Fetch</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlBasic#getFetch()
+ * @see #getXmlBasic()
+ * @generated
+ */
+ public EAttribute getXmlBasic_Fetch()
+ {
+ return (EAttribute)xmlBasicEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlBasic#getOptional <em>Optional</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Optional</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlBasic#getOptional()
+ * @see #getXmlBasic()
+ * @generated
+ */
+ public EAttribute getXmlBasic_Optional()
+ {
+ return (EAttribute)xmlBasicEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.CascadeType
+ * @generated
+ */
+ public EClass getCascadeType()
+ {
+ return cascadeTypeEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.orm.XmlClassReference <em>Xml Class Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Class Reference</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference
+ * @generated
+ */
+ public EClass getXmlClassReference()
+ {
+ return xmlClassReferenceEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference#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.jpa.core.resource.orm.XmlClassReference#getClassName()
+ * @see #getXmlClassReference()
+ * @generated
+ */
+ public EAttribute getXmlClassReference_ClassName()
+ {
+ return (EAttribute)xmlClassReferenceEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable <em>Xml Collection Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Collection Table</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable
+ * @generated
+ */
+ public EClass getXmlCollectionTable()
+ {
+ return xmlCollectionTableEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlColumn
+ * @generated
+ */
+ public EClass getXmlColumn()
+ {
+ return xmlColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getLength <em>Length</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Length</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getLength()
+ * @see #getXmlColumn()
+ * @generated
+ */
+ public EAttribute getXmlColumn_Length()
+ {
+ return (EAttribute)xmlColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getPrecision <em>Precision</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Precision</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getPrecision()
+ * @see #getXmlColumn()
+ * @generated
+ */
+ public EAttribute getXmlColumn_Precision()
+ {
+ return (EAttribute)xmlColumnEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getScale <em>Scale</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Scale</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getScale()
+ * @see #getXmlColumn()
+ * @generated
+ */
+ public EAttribute getXmlColumn_Scale()
+ {
+ return (EAttribute)xmlColumnEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.ColumnMapping
+ * @generated
+ */
+ public EClass getColumnMapping()
+ {
+ return columnMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.orm.ColumnResult
+ * @generated
+ */
+ public EClass getColumnResult()
+ {
+ return columnResultEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.resource.orm.XmlConvertibleMapping <em>Xml Convertible Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Convertible Mapping</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping
+ * @generated
+ */
+ public EClass getXmlConvertibleMapping()
+ {
+ return xmlConvertibleMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#isLob <em>Lob</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Lob</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#isLob()
+ * @see #getXmlConvertibleMapping()
+ * @generated
+ */
+ public EAttribute getXmlConvertibleMapping_Lob()
+ {
+ return (EAttribute)xmlConvertibleMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#getTemporal <em>Temporal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Temporal</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#getTemporal()
+ * @see #getXmlConvertibleMapping()
+ * @generated
+ */
+ public EAttribute getXmlConvertibleMapping_Temporal()
+ {
+ return (EAttribute)xmlConvertibleMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#getEnumerated <em>Enumerated</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Enumerated</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#getEnumerated()
+ * @see #getXmlConvertibleMapping()
+ * @generated
+ */
+ public EAttribute getXmlConvertibleMapping_Enumerated()
+ {
+ return (EAttribute)xmlConvertibleMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlDiscriminatorColumn
+ * @generated
+ */
+ public EClass getXmlDiscriminatorColumn()
+ {
+ return xmlDiscriminatorColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn#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.jpa.core.resource.orm.XmlDiscriminatorColumn#getDiscriminatorType()
+ * @see #getXmlDiscriminatorColumn()
+ * @generated
+ */
+ public EAttribute getXmlDiscriminatorColumn_DiscriminatorType()
+ {
+ return (EAttribute)xmlDiscriminatorColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn#getLength <em>Length</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Length</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn#getLength()
+ * @see #getXmlDiscriminatorColumn()
+ * @generated
+ */
+ public EAttribute getXmlDiscriminatorColumn_Length()
+ {
+ return (EAttribute)xmlDiscriminatorColumnEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection <em>Xml Element Collection</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Element Collection</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection
+ * @generated
+ */
+ public EClass getXmlElementCollection()
+ {
+ return xmlElementCollectionEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlEmbeddable
+ * @generated
+ */
+ public EClass getXmlEmbeddable()
+ {
+ return xmlEmbeddableEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlEmbedded
+ * @generated
+ */
+ public EClass getXmlEmbedded()
+ {
+ return xmlEmbeddedEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlEmbeddedId
+ * @generated
+ */
+ public EClass getXmlEmbeddedId()
+ {
+ return xmlEmbeddedIdEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlEntity
+ * @generated
+ */
+ public EClass getXmlEntity()
+ {
+ return xmlEntityEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getName()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EAttribute getXmlEntity_Name()
+ {
+ return (EAttribute)xmlEntityEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#getTable()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EReference getXmlEntity_Table()
+ {
+ return (EReference)xmlEntityEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlEntity#getSecondaryTables()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EReference getXmlEntity_SecondaryTables()
+ {
+ return (EReference)xmlEntityEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#getPrimaryKeyJoinColumns()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EReference getXmlEntity_PrimaryKeyJoinColumns()
+ {
+ return (EReference)xmlEntityEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#getInheritance()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EReference getXmlEntity_Inheritance()
+ {
+ return (EReference)xmlEntityEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#getDiscriminatorValue()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EAttribute getXmlEntity_DiscriminatorValue()
+ {
+ return (EAttribute)xmlEntityEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#getDiscriminatorColumn()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EReference getXmlEntity_DiscriminatorColumn()
+ {
+ return (EReference)xmlEntityEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#getSqlResultSetMappings()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EReference getXmlEntity_SqlResultSetMappings()
+ {
+ return (EReference)xmlEntityEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#isExcludeDefaultListeners()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EAttribute getXmlEntity_ExcludeDefaultListeners()
+ {
+ return (EAttribute)xmlEntityEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#isExcludeSuperclassListeners()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EAttribute getXmlEntity_ExcludeSuperclassListeners()
+ {
+ return (EAttribute)xmlEntityEClass.getEStructuralFeatures().get(9);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.jpa.core.resource.orm.XmlEntity#getEntityListeners()
+ * @see #getXmlEntity()
+ * @generated
+ */
+ public EReference getXmlEntity_EntityListeners()
+ {
+ return (EReference)xmlEntityEClass.getEStructuralFeatures().get(10);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EntityListener
+ * @generated
+ */
+ public EClass getEntityListener()
+ {
+ return entityListenerEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EntityListener#getClassName()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EAttribute getEntityListener_ClassName()
+ {
+ return (EAttribute)entityListenerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EntityListeners
+ * @generated
+ */
+ public EClass getEntityListeners()
+ {
+ return entityListenersEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.resource.orm.XmlEntityMappings <em>Xml Entity Mappings</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Entity Mappings</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings
+ * @generated
+ */
+ public EClass getXmlEntityMappings()
+ {
+ return xmlEntityMappingsEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getDescription()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EAttribute getXmlEntityMappings_Description()
+ {
+ return (EAttribute)xmlEntityMappingsEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.resource.orm.XmlEntityMappings#getPersistenceUnitMetadata()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EReference getXmlEntityMappings_PersistenceUnitMetadata()
+ {
+ return (EReference)xmlEntityMappingsEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getPackage <em>Package</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Package</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getPackage()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EAttribute getXmlEntityMappings_Package()
+ {
+ return (EAttribute)xmlEntityMappingsEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getSchema()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EAttribute getXmlEntityMappings_Schema()
+ {
+ return (EAttribute)xmlEntityMappingsEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getCatalog()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EAttribute getXmlEntityMappings_Catalog()
+ {
+ return (EAttribute)xmlEntityMappingsEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.resource.orm.XmlEntityMappings#getSequenceGenerators()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EReference getXmlEntityMappings_SequenceGenerators()
+ {
+ return (EReference)xmlEntityMappingsEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.resource.orm.XmlEntityMappings#getTableGenerators()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EReference getXmlEntityMappings_TableGenerators()
+ {
+ return (EReference)xmlEntityMappingsEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.resource.orm.XmlEntityMappings#getSqlResultSetMappings()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EReference getXmlEntityMappings_SqlResultSetMappings()
+ {
+ return (EReference)xmlEntityMappingsEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.resource.orm.XmlEntityMappings#getMappedSuperclasses()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EReference getXmlEntityMappings_MappedSuperclasses()
+ {
+ return (EReference)xmlEntityMappingsEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.resource.orm.XmlEntityMappings#getEntities()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EReference getXmlEntityMappings_Entities()
+ {
+ return (EReference)xmlEntityMappingsEClass.getEStructuralFeatures().get(9);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.resource.orm.XmlEntityMappings#getEmbeddables()
+ * @see #getXmlEntityMappings()
+ * @generated
+ */
+ public EReference getXmlEntityMappings_Embeddables()
+ {
+ return (EReference)xmlEntityMappingsEClass.getEStructuralFeatures().get(10);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EntityResult
+ * @generated
+ */
+ public EClass getEntityResult()
+ {
+ return entityResultEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.orm.EventMethod
+ * @generated
+ */
+ public EClass getEventMethod()
+ {
+ return eventMethodEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.resource.orm.XmlEventMethodContainer <em>Xml Event Method Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Event Method Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer
+ * @generated
+ */
+ public EClass getXmlEventMethodContainer()
+ {
+ return xmlEventMethodContainerEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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.jpa.core.resource.orm.XmlEventMethodContainer#getPrePersist()
+ * @see #getXmlEventMethodContainer()
+ * @generated
+ */
+ public EReference getXmlEventMethodContainer_PrePersist()
+ {
+ return (EReference)xmlEventMethodContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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.jpa.core.resource.orm.XmlEventMethodContainer#getPostPersist()
+ * @see #getXmlEventMethodContainer()
+ * @generated
+ */
+ public EReference getXmlEventMethodContainer_PostPersist()
+ {
+ return (EReference)xmlEventMethodContainerEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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.jpa.core.resource.orm.XmlEventMethodContainer#getPreRemove()
+ * @see #getXmlEventMethodContainer()
+ * @generated
+ */
+ public EReference getXmlEventMethodContainer_PreRemove()
+ {
+ return (EReference)xmlEventMethodContainerEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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.jpa.core.resource.orm.XmlEventMethodContainer#getPostRemove()
+ * @see #getXmlEventMethodContainer()
+ * @generated
+ */
+ public EReference getXmlEventMethodContainer_PostRemove()
+ {
+ return (EReference)xmlEventMethodContainerEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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.jpa.core.resource.orm.XmlEventMethodContainer#getPreUpdate()
+ * @see #getXmlEventMethodContainer()
+ * @generated
+ */
+ public EReference getXmlEventMethodContainer_PreUpdate()
+ {
+ return (EReference)xmlEventMethodContainerEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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.jpa.core.resource.orm.XmlEventMethodContainer#getPostUpdate()
+ * @see #getXmlEventMethodContainer()
+ * @generated
+ */
+ public EReference getXmlEventMethodContainer_PostUpdate()
+ {
+ return (EReference)xmlEventMethodContainerEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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.jpa.core.resource.orm.XmlEventMethodContainer#getPostLoad()
+ * @see #getXmlEventMethodContainer()
+ * @generated
+ */
+ public EReference getXmlEventMethodContainer_PostLoad()
+ {
+ return (EReference)xmlEventMethodContainerEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.FieldResult
+ * @generated
+ */
+ public EClass getFieldResult()
+ {
+ return fieldResultEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.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.jpa.core.resource.orm.XmlGeneratedValue
+ * @generated
+ */
+ public EClass getXmlGeneratedValue()
+ {
+ return xmlGeneratedValueEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#getGenerator <em>Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Generator</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#getGenerator()
+ * @see #getXmlGeneratedValue()
+ * @generated
+ */
+ public EAttribute getXmlGeneratedValue_Generator()
+ {
+ return (EAttribute)xmlGeneratedValueEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#getStrategy <em>Strategy</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Strategy</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#getStrategy()
+ * @see #getXmlGeneratedValue()
+ * @generated
+ */
+ public EAttribute getXmlGeneratedValue_Strategy()
+ {
+ return (EAttribute)xmlGeneratedValueEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlGenerator
+ * @generated
+ */
+ public EClass getXmlGenerator()
+ {
+ return xmlGeneratorEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#getName()
+ * @see #getXmlGenerator()
+ * @generated
+ */
+ public EAttribute getXmlGenerator_Name()
+ {
+ return (EAttribute)xmlGeneratorEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#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.jpa.core.resource.orm.XmlGenerator#getInitialValue()
+ * @see #getXmlGenerator()
+ * @generated
+ */
+ public EAttribute getXmlGenerator_InitialValue()
+ {
+ return (EAttribute)xmlGeneratorEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#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.jpa.core.resource.orm.XmlGenerator#getAllocationSize()
+ * @see #getXmlGenerator()
+ * @generated
+ */
+ public EAttribute getXmlGenerator_AllocationSize()
+ {
+ return (EAttribute)xmlGeneratorEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer <em>Xml Generator Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Generator Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer
+ * @generated
+ */
+ public EClass getXmlGeneratorContainer()
+ {
+ return xmlGeneratorContainerEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer#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.jpa.core.resource.orm.XmlGeneratorContainer#getSequenceGenerator()
+ * @see #getXmlGeneratorContainer()
+ * @generated
+ */
+ public EReference getXmlGeneratorContainer_SequenceGenerator()
+ {
+ return (EReference)xmlGeneratorContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer#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.jpa.core.resource.orm.XmlGeneratorContainer#getTableGenerator()
+ * @see #getXmlGeneratorContainer()
+ * @generated
+ */
+ public EReference getXmlGeneratorContainer_TableGenerator()
+ {
+ return (EReference)xmlGeneratorContainerEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlId
+ * @generated
+ */
+ public EClass getXmlId()
+ {
+ return xmlIdEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlId#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.jpa.core.resource.orm.XmlId#getGeneratedValue()
+ * @see #getXmlId()
+ * @generated
+ */
+ public EReference getXmlId_GeneratedValue()
+ {
+ return (EReference)xmlIdEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer <em>Xml Id Class Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Id Class Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer
+ * @generated
+ */
+ public EClass getXmlIdClassContainer()
+ {
+ return xmlIdClassContainerEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer#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.jpa.core.resource.orm.XmlIdClassContainer#getIdClass()
+ * @see #getXmlIdClassContainer()
+ * @generated
+ */
+ public EReference getXmlIdClassContainer_IdClass()
+ {
+ return (EReference)xmlIdClassContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.Inheritance
+ * @generated
+ */
+ public EClass getInheritance()
+ {
+ return inheritanceEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.resource.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.jpa.core.resource.orm.XmlJoinColumn
+ * @generated
+ */
+ public EClass getXmlJoinColumn()
+ {
+ return xmlJoinColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn#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.jpa.core.resource.orm.XmlJoinColumn#getReferencedColumnName()
+ * @see #getXmlJoinColumn()
+ * @generated
+ */
+ public EAttribute getXmlJoinColumn_ReferencedColumnName()
+ {
+ return (EAttribute)xmlJoinColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer <em>Xml Join Column Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Join Column Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer
+ * @generated
+ */
+ public EClass getXmlJoinColumnContainer()
+ {
+ return xmlJoinColumnContainerEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer#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.jpa.core.resource.orm.XmlJoinColumnContainer#getJoinColumns()
+ * @see #getXmlJoinColumnContainer()
+ * @generated
+ */
+ public EReference getXmlJoinColumnContainer_JoinColumns()
+ {
+ return (EReference)xmlJoinColumnContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlJoinTable
+ * @generated
+ */
+ public EClass getXmlJoinTable()
+ {
+ return xmlJoinTableEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable#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.jpa.core.resource.orm.XmlJoinTable#getInverseJoinColumns()
+ * @see #getXmlJoinTable()
+ * @generated
+ */
+ public EReference getXmlJoinTable_InverseJoinColumns()
+ {
+ return (EReference)xmlJoinTableEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer <em>Xml Join Table Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Join Table Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer
+ * @generated
+ */
+ public EClass getXmlJoinTableContainer()
+ {
+ return xmlJoinTableContainerEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer#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.jpa.core.resource.orm.XmlJoinTableContainer#getJoinTable()
+ * @see #getXmlJoinTableContainer()
+ * @generated
+ */
+ public EReference getXmlJoinTableContainer_JoinTable()
+ {
+ return (EReference)xmlJoinTableContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.Lob
+ * @generated
+ */
+ public EClass getLob()
+ {
+ return lobEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlManyToMany
+ * @generated
+ */
+ public EClass getXmlManyToMany()
+ {
+ return xmlManyToManyEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlManyToOne
+ * @generated
+ */
+ public EClass getXmlManyToOne()
+ {
+ return xmlManyToOneEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.MapKey
+ * @generated
+ */
+ public EClass getMapKey()
+ {
+ return mapKeyEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.resource.orm.XmlMappedByMapping <em>Xml Mapped By Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Mapped By Mapping</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping
+ * @generated
+ */
+ public EClass getXmlMappedByMapping()
+ {
+ return xmlMappedByMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping#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.jpa.core.resource.orm.XmlMappedByMapping#getMappedBy()
+ * @see #getXmlMappedByMapping()
+ * @generated
+ */
+ public EAttribute getXmlMappedByMapping_MappedBy()
+ {
+ return (EAttribute)xmlMappedByMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlMappedSuperclass
+ * @generated
+ */
+ public EClass getXmlMappedSuperclass()
+ {
+ return xmlMappedSuperclassEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass#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.jpa.core.resource.orm.XmlMappedSuperclass#isExcludeDefaultListeners()
+ * @see #getXmlMappedSuperclass()
+ * @generated
+ */
+ public EAttribute getXmlMappedSuperclass_ExcludeDefaultListeners()
+ {
+ return (EAttribute)xmlMappedSuperclassEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass#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.jpa.core.resource.orm.XmlMappedSuperclass#isExcludeSuperclassListeners()
+ * @see #getXmlMappedSuperclass()
+ * @generated
+ */
+ public EAttribute getXmlMappedSuperclass_ExcludeSuperclassListeners()
+ {
+ return (EAttribute)xmlMappedSuperclassEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass#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.jpa.core.resource.orm.XmlMappedSuperclass#getEntityListeners()
+ * @see #getXmlMappedSuperclass()
+ * @generated
+ */
+ public EReference getXmlMappedSuperclass_EntityListeners()
+ {
+ return (EReference)xmlMappedSuperclassEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlNamedNativeQuery
+ * @generated
+ */
+ public EClass getXmlNamedNativeQuery()
+ {
+ return xmlNamedNativeQueryEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery#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.jpa.core.resource.orm.XmlNamedNativeQuery#getResultClass()
+ * @see #getXmlNamedNativeQuery()
+ * @generated
+ */
+ public EAttribute getXmlNamedNativeQuery_ResultClass()
+ {
+ return (EAttribute)xmlNamedNativeQueryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery#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.jpa.core.resource.orm.XmlNamedNativeQuery#getResultSetMapping()
+ * @see #getXmlNamedNativeQuery()
+ * @generated
+ */
+ public EAttribute getXmlNamedNativeQuery_ResultSetMapping()
+ {
+ return (EAttribute)xmlNamedNativeQueryEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlNamedQuery
+ * @generated
+ */
+ public EClass getXmlNamedQuery()
+ {
+ return xmlNamedQueryEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlNullAttributeMapping
+ * @generated
+ */
+ public EClass getXmlNullAttributeMapping()
+ {
+ return xmlNullAttributeMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlOneToMany
+ * @generated
+ */
+ public EClass getXmlOneToMany()
+ {
+ return xmlOneToManyEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlOneToOne
+ * @generated
+ */
+ public EClass getXmlOneToOne()
+ {
+ return xmlOneToOneEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn <em>Xml Order Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Order Column</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn
+ * @generated
+ */
+ public EClass getXmlOrderColumn()
+ {
+ return xmlOrderColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlOverride
+ * @generated
+ */
+ public EClass getXmlOverride()
+ {
+ return xmlOverrideEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOverride#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOverride#getName()
+ * @see #getXmlOverride()
+ * @generated
+ */
+ public EAttribute getXmlOverride_Name()
+ {
+ return (EAttribute)xmlOverrideEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults <em>Xml Persistence Unit Defaults</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Persistence Unit Defaults</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults
+ * @generated
+ */
+ public EClass getXmlPersistenceUnitDefaults()
+ {
+ return xmlPersistenceUnitDefaultsEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getSchema()
+ * @see #getXmlPersistenceUnitDefaults()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnitDefaults_Schema()
+ {
+ return (EAttribute)xmlPersistenceUnitDefaultsEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getCatalog()
+ * @see #getXmlPersistenceUnitDefaults()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnitDefaults_Catalog()
+ {
+ return (EAttribute)xmlPersistenceUnitDefaultsEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.jpa.core.resource.orm.XmlPersistenceUnitDefaults#isCascadePersist()
+ * @see #getXmlPersistenceUnitDefaults()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnitDefaults_CascadePersist()
+ {
+ return (EAttribute)xmlPersistenceUnitDefaultsEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getEntityListeners()
+ * @see #getXmlPersistenceUnitDefaults()
+ * @generated
+ */
+ public EReference getXmlPersistenceUnitDefaults_EntityListeners()
+ {
+ return (EReference)xmlPersistenceUnitDefaultsEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata <em>Xml Persistence Unit Metadata</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Persistence Unit Metadata</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata
+ * @generated
+ */
+ public EClass getXmlPersistenceUnitMetadata()
+ {
+ return xmlPersistenceUnitMetadataEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata#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.jpa.core.resource.orm.XmlPersistenceUnitMetadata#isXmlMappingMetadataComplete()
+ * @see #getXmlPersistenceUnitMetadata()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnitMetadata_XmlMappingMetadataComplete()
+ {
+ return (EAttribute)xmlPersistenceUnitMetadataEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata#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.jpa.core.resource.orm.XmlPersistenceUnitMetadata#getPersistenceUnitDefaults()
+ * @see #getXmlPersistenceUnitMetadata()
+ * @generated
+ */
+ public EReference getXmlPersistenceUnitMetadata_PersistenceUnitDefaults()
+ {
+ return (EReference)xmlPersistenceUnitMetadataEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable <em>Abstract Xml Reference Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Xml Reference Table</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable
+ * @generated
+ */
+ public EClass getAbstractXmlReferenceTable()
+ {
+ return abstractXmlReferenceTableEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable <em>Xml Reference Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Reference Table</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable
+ * @generated
+ */
+ public EClass getXmlReferenceTable()
+ {
+ return xmlReferenceTableEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable#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.jpa.core.resource.orm.XmlReferenceTable#getJoinColumns()
+ * @see #getXmlReferenceTable()
+ * @generated
+ */
+ public EReference getXmlReferenceTable_JoinColumns()
+ {
+ return (EReference)xmlReferenceTableEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.PostLoad
+ * @generated
+ */
+ public EClass getPostLoad()
+ {
+ return postLoadEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.PostPersist
+ * @generated
+ */
+ public EClass getPostPersist()
+ {
+ return postPersistEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.PostRemove
+ * @generated
+ */
+ public EClass getPostRemove()
+ {
+ return postRemoveEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.PostUpdate
+ * @generated
+ */
+ public EClass getPostUpdate()
+ {
+ return postUpdateEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.PrePersist
+ * @generated
+ */
+ public EClass getPrePersist()
+ {
+ return prePersistEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.PreRemove
+ * @generated
+ */
+ public EClass getPreRemove()
+ {
+ return preRemoveEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.PreUpdate
+ * @generated
+ */
+ public EClass getPreUpdate()
+ {
+ return preUpdateEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn
+ * @generated
+ */
+ public EClass getXmlPrimaryKeyJoinColumn()
+ {
+ return xmlPrimaryKeyJoinColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn#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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn#getReferencedColumnName()
+ * @see #getXmlPrimaryKeyJoinColumn()
+ * @generated
+ */
+ public EAttribute getXmlPrimaryKeyJoinColumn_ReferencedColumnName()
+ {
+ return (EAttribute)xmlPrimaryKeyJoinColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer <em>Xml Primary Key Join Column Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Primary Key Join Column Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer
+ * @generated
+ */
+ public EClass getXmlPrimaryKeyJoinColumnContainer()
+ {
+ return xmlPrimaryKeyJoinColumnContainerEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer#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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer#getPrimaryKeyJoinColumns()
+ * @see #getXmlPrimaryKeyJoinColumnContainer()
+ * @generated
+ */
+ public EReference getXmlPrimaryKeyJoinColumnContainer_PrimaryKeyJoinColumns()
+ {
+ return (EReference)xmlPrimaryKeyJoinColumnContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery <em>Xml Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Query</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQuery
+ * @generated
+ */
+ public EClass getXmlQuery()
+ {
+ return xmlQueryEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#getName()
+ * @see #getXmlQuery()
+ * @generated
+ */
+ public EAttribute getXmlQuery_Name()
+ {
+ return (EAttribute)xmlQueryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#getQuery <em>Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Query</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#getQuery()
+ * @see #getXmlQuery()
+ * @generated
+ */
+ public EAttribute getXmlQuery_Query()
+ {
+ return (EAttribute)xmlQueryEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#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.jpa.core.resource.orm.XmlQuery#getHints()
+ * @see #getXmlQuery()
+ * @generated
+ */
+ public EReference getXmlQuery_Hints()
+ {
+ return (EReference)xmlQueryEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer <em>Xml Query Container</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Query Container</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer
+ * @generated
+ */
+ public EClass getXmlQueryContainer()
+ {
+ return xmlQueryContainerEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer#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.jpa.core.resource.orm.XmlQueryContainer#getNamedQueries()
+ * @see #getXmlQueryContainer()
+ * @generated
+ */
+ public EReference getXmlQueryContainer_NamedQueries()
+ {
+ return (EReference)xmlQueryContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer#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.jpa.core.resource.orm.XmlQueryContainer#getNamedNativeQueries()
+ * @see #getXmlQueryContainer()
+ * @generated
+ */
+ public EReference getXmlQueryContainer_NamedNativeQueries()
+ {
+ return (EReference)xmlQueryContainerEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlQueryHint
+ * @generated
+ */
+ public EClass getXmlQueryHint()
+ {
+ return xmlQueryHintEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint#getName()
+ * @see #getXmlQueryHint()
+ * @generated
+ */
+ public EAttribute getXmlQueryHint_Name()
+ {
+ return (EAttribute)xmlQueryHintEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint#getValue <em>Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint#getValue()
+ * @see #getXmlQueryHint()
+ * @generated
+ */
+ public EAttribute getXmlQueryHint_Value()
+ {
+ return (EAttribute)xmlQueryHintEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlSecondaryTable
+ * @generated
+ */
+ public EClass getXmlSecondaryTable()
+ {
+ return xmlSecondaryTableEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable#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.jpa.core.resource.orm.XmlSecondaryTable#getPrimaryKeyJoinColumns()
+ * @see #getXmlSecondaryTable()
+ * @generated
+ */
+ public EReference getXmlSecondaryTable_PrimaryKeyJoinColumns()
+ {
+ return (EReference)xmlSecondaryTableEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlSequenceGenerator
+ * @generated
+ */
+ public EClass getXmlSequenceGenerator()
+ {
+ return xmlSequenceGeneratorEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator#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.jpa.core.resource.orm.XmlSequenceGenerator#getSequenceName()
+ * @see #getXmlSequenceGenerator()
+ * @generated
+ */
+ public EAttribute getXmlSequenceGenerator_SequenceName()
+ {
+ return (EAttribute)xmlSequenceGeneratorEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.SqlResultSetMapping
+ * @generated
+ */
+ public EClass getSqlResultSetMapping()
+ {
+ return sqlResultSetMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.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.jpa.core.resource.orm.XmlTable
+ * @generated
+ */
+ public EClass getXmlTable()
+ {
+ return xmlTableEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlTableGenerator
+ * @generated
+ */
+ public EClass getXmlTableGenerator()
+ {
+ return xmlTableGeneratorEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getTable <em>Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Table</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getTable()
+ * @see #getXmlTableGenerator()
+ * @generated
+ */
+ public EAttribute getXmlTableGenerator_Table()
+ {
+ return (EAttribute)xmlTableGeneratorEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getCatalog()
+ * @see #getXmlTableGenerator()
+ * @generated
+ */
+ public EAttribute getXmlTableGenerator_Catalog()
+ {
+ return (EAttribute)xmlTableGeneratorEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getSchema()
+ * @see #getXmlTableGenerator()
+ * @generated
+ */
+ public EAttribute getXmlTableGenerator_Schema()
+ {
+ return (EAttribute)xmlTableGeneratorEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#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.jpa.core.resource.orm.XmlTableGenerator#getPkColumnName()
+ * @see #getXmlTableGenerator()
+ * @generated
+ */
+ public EAttribute getXmlTableGenerator_PkColumnName()
+ {
+ return (EAttribute)xmlTableGeneratorEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#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.jpa.core.resource.orm.XmlTableGenerator#getValueColumnName()
+ * @see #getXmlTableGenerator()
+ * @generated
+ */
+ public EAttribute getXmlTableGenerator_ValueColumnName()
+ {
+ return (EAttribute)xmlTableGeneratorEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#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.jpa.core.resource.orm.XmlTableGenerator#getPkColumnValue()
+ * @see #getXmlTableGenerator()
+ * @generated
+ */
+ public EAttribute getXmlTableGenerator_PkColumnValue()
+ {
+ return (EAttribute)xmlTableGeneratorEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#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.jpa.core.resource.orm.XmlTableGenerator#getUniqueConstraints()
+ * @see #getXmlTableGenerator()
+ * @generated
+ */
+ public EReference getXmlTableGenerator_UniqueConstraints()
+ {
+ return (EReference)xmlTableGeneratorEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlTransient
+ * @generated
+ */
+ public EClass getXmlTransient()
+ {
+ return xmlTransientEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlTypeMapping
+ * @generated
+ */
+ public EClass getXmlTypeMapping()
+ {
+ return xmlTypeMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#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.jpa.core.resource.orm.XmlTypeMapping#getClassName()
+ * @see #getXmlTypeMapping()
+ * @generated
+ */
+ public EAttribute getXmlTypeMapping_ClassName()
+ {
+ return (EAttribute)xmlTypeMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlTypeMapping#getMetadataComplete()
+ * @see #getXmlTypeMapping()
+ * @generated
+ */
+ public EAttribute getXmlTypeMapping_MetadataComplete()
+ {
+ return (EAttribute)xmlTypeMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#getDescription()
+ * @see #getXmlTypeMapping()
+ * @generated
+ */
+ public EAttribute getXmlTypeMapping_Description()
+ {
+ return (EAttribute)xmlTypeMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#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.jpa.core.resource.orm.XmlTypeMapping#getAttributes()
+ * @see #getXmlTypeMapping()
+ * @generated
+ */
+ public EReference getXmlTypeMapping_Attributes()
+ {
+ return (EReference)xmlTypeMappingEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlUniqueConstraint
+ * @generated
+ */
+ public EClass getXmlUniqueConstraint()
+ {
+ return xmlUniqueConstraintEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute list '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint#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.jpa.core.resource.orm.XmlUniqueConstraint#getColumnNames()
+ * @see #getXmlUniqueConstraint()
+ * @generated
+ */
+ public EAttribute getXmlUniqueConstraint_ColumnNames()
+ {
+ return (EAttribute)xmlUniqueConstraintEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.XmlVersion
+ * @generated
+ */
+ public EClass getXmlVersion()
+ {
+ return xmlVersionEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable <em>Xml Orderable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Orderable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable
+ * @generated
+ */
+ public EClass getXmlOrderable()
+ {
+ return xmlOrderableEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable#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.jpa.core.resource.orm.XmlOrderable#getOrderBy()
+ * @see #getXmlOrderable()
+ * @generated
+ */
+ public EAttribute getXmlOrderable_OrderBy()
+ {
+ return (EAttribute)xmlOrderableEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.AccessType
+ * @generated
+ */
+ public EEnum getAccessType()
+ {
+ return accessTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.DiscriminatorType
+ * @generated
+ */
+ public EEnum getDiscriminatorType()
+ {
+ return discriminatorTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EnumType
+ * @generated
+ */
+ public EEnum getEnumType()
+ {
+ return enumTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.FetchType
+ * @generated
+ */
+ public EEnum getFetchType()
+ {
+ return fetchTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.GenerationType
+ * @generated
+ */
+ public EEnum getGenerationType()
+ {
+ return generationTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.InheritanceType
+ * @generated
+ */
+ public EEnum getInheritanceType()
+ {
+ return inheritanceTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.TemporalType
+ * @generated
+ */
+ public EEnum getTemporalType()
+ {
+ return temporalTypeEEnum;
+ }
+
+ /**
+ * 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
+ abstractXmlAttributeMappingEClass = createEClass(ABSTRACT_XML_ATTRIBUTE_MAPPING);
+
+ abstractXmlColumnEClass = createEClass(ABSTRACT_XML_COLUMN);
+ createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__INSERTABLE);
+ createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__NULLABLE);
+ createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__TABLE);
+ createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__UNIQUE);
+ createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__UPDATABLE);
+
+ abstractXmlEmbeddedEClass = createEClass(ABSTRACT_XML_EMBEDDED);
+
+ abstractXmlMultiRelationshipMappingEClass = createEClass(ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING);
+ createEReference(abstractXmlMultiRelationshipMappingEClass, ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY);
+
+ abstractXmlNamedColumnEClass = createEClass(ABSTRACT_XML_NAMED_COLUMN);
+ createEAttribute(abstractXmlNamedColumnEClass, ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION);
+ createEAttribute(abstractXmlNamedColumnEClass, ABSTRACT_XML_NAMED_COLUMN__NAME);
+
+ abstractXmlRelationshipMappingEClass = createEClass(ABSTRACT_XML_RELATIONSHIP_MAPPING);
+ createEAttribute(abstractXmlRelationshipMappingEClass, ABSTRACT_XML_RELATIONSHIP_MAPPING__TARGET_ENTITY);
+ createEAttribute(abstractXmlRelationshipMappingEClass, ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH);
+ createEReference(abstractXmlRelationshipMappingEClass, ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE);
+
+ abstractXmlSingleRelationshipMappingEClass = createEClass(ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING);
+ createEAttribute(abstractXmlSingleRelationshipMappingEClass, ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL);
+
+ abstractXmlReferenceTableEClass = createEClass(ABSTRACT_XML_REFERENCE_TABLE);
+
+ abstractXmlTableEClass = createEClass(ABSTRACT_XML_TABLE);
+ createEAttribute(abstractXmlTableEClass, ABSTRACT_XML_TABLE__NAME);
+ createEAttribute(abstractXmlTableEClass, ABSTRACT_XML_TABLE__CATALOG);
+ createEAttribute(abstractXmlTableEClass, ABSTRACT_XML_TABLE__SCHEMA);
+ createEReference(abstractXmlTableEClass, ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS);
+
+ abstractXmlTypeMappingEClass = createEClass(ABSTRACT_XML_TYPE_MAPPING);
+
+ xmlAccessHolderEClass = createEClass(XML_ACCESS_HOLDER);
+ createEAttribute(xmlAccessHolderEClass, XML_ACCESS_HOLDER__ACCESS);
+
+ xmlAttributeMappingEClass = createEClass(XML_ATTRIBUTE_MAPPING);
+ createEAttribute(xmlAttributeMappingEClass, XML_ATTRIBUTE_MAPPING__NAME);
+
+ xmlAssociationOverrideEClass = createEClass(XML_ASSOCIATION_OVERRIDE);
+
+ xmlAssociationOverrideContainerEClass = createEClass(XML_ASSOCIATION_OVERRIDE_CONTAINER);
+ createEReference(xmlAssociationOverrideContainerEClass, XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES);
+
+ xmlAttributeOverrideEClass = createEClass(XML_ATTRIBUTE_OVERRIDE);
+ createEReference(xmlAttributeOverrideEClass, XML_ATTRIBUTE_OVERRIDE__COLUMN);
+
+ xmlAttributeOverrideContainerEClass = createEClass(XML_ATTRIBUTE_OVERRIDE_CONTAINER);
+ createEReference(xmlAttributeOverrideContainerEClass, XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES);
+
+ 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);
+
+ xmlBasicEClass = createEClass(XML_BASIC);
+ createEAttribute(xmlBasicEClass, XML_BASIC__FETCH);
+ createEAttribute(xmlBasicEClass, XML_BASIC__OPTIONAL);
+
+ 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);
+
+ xmlClassReferenceEClass = createEClass(XML_CLASS_REFERENCE);
+ createEAttribute(xmlClassReferenceEClass, XML_CLASS_REFERENCE__CLASS_NAME);
+
+ xmlCollectionTableEClass = createEClass(XML_COLLECTION_TABLE);
+
+ xmlColumnEClass = createEClass(XML_COLUMN);
+ createEAttribute(xmlColumnEClass, XML_COLUMN__LENGTH);
+ createEAttribute(xmlColumnEClass, XML_COLUMN__PRECISION);
+ createEAttribute(xmlColumnEClass, XML_COLUMN__SCALE);
+
+ columnMappingEClass = createEClass(COLUMN_MAPPING);
+ createEReference(columnMappingEClass, COLUMN_MAPPING__COLUMN);
+
+ columnResultEClass = createEClass(COLUMN_RESULT);
+ createEAttribute(columnResultEClass, COLUMN_RESULT__NAME);
+
+ xmlConvertibleMappingEClass = createEClass(XML_CONVERTIBLE_MAPPING);
+ createEAttribute(xmlConvertibleMappingEClass, XML_CONVERTIBLE_MAPPING__LOB);
+ createEAttribute(xmlConvertibleMappingEClass, XML_CONVERTIBLE_MAPPING__TEMPORAL);
+ createEAttribute(xmlConvertibleMappingEClass, XML_CONVERTIBLE_MAPPING__ENUMERATED);
+
+ xmlDiscriminatorColumnEClass = createEClass(XML_DISCRIMINATOR_COLUMN);
+ createEAttribute(xmlDiscriminatorColumnEClass, XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
+ createEAttribute(xmlDiscriminatorColumnEClass, XML_DISCRIMINATOR_COLUMN__LENGTH);
+
+ xmlElementCollectionEClass = createEClass(XML_ELEMENT_COLLECTION);
+
+ xmlEmbeddableEClass = createEClass(XML_EMBEDDABLE);
+
+ xmlEmbeddedEClass = createEClass(XML_EMBEDDED);
+
+ xmlEmbeddedIdEClass = createEClass(XML_EMBEDDED_ID);
+
+ xmlEntityEClass = createEClass(XML_ENTITY);
+ createEAttribute(xmlEntityEClass, XML_ENTITY__NAME);
+ createEReference(xmlEntityEClass, XML_ENTITY__TABLE);
+ createEReference(xmlEntityEClass, XML_ENTITY__SECONDARY_TABLES);
+ createEReference(xmlEntityEClass, XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS);
+ createEReference(xmlEntityEClass, XML_ENTITY__INHERITANCE);
+ createEAttribute(xmlEntityEClass, XML_ENTITY__DISCRIMINATOR_VALUE);
+ createEReference(xmlEntityEClass, XML_ENTITY__DISCRIMINATOR_COLUMN);
+ createEReference(xmlEntityEClass, XML_ENTITY__SQL_RESULT_SET_MAPPINGS);
+ createEAttribute(xmlEntityEClass, XML_ENTITY__EXCLUDE_DEFAULT_LISTENERS);
+ createEAttribute(xmlEntityEClass, XML_ENTITY__EXCLUDE_SUPERCLASS_LISTENERS);
+ createEReference(xmlEntityEClass, XML_ENTITY__ENTITY_LISTENERS);
+
+ entityListenerEClass = createEClass(ENTITY_LISTENER);
+ createEAttribute(entityListenerEClass, ENTITY_LISTENER__CLASS_NAME);
+
+ entityListenersEClass = createEClass(ENTITY_LISTENERS);
+ createEReference(entityListenersEClass, ENTITY_LISTENERS__ENTITY_LISTENERS);
+
+ xmlEntityMappingsEClass = createEClass(XML_ENTITY_MAPPINGS);
+ createEAttribute(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__DESCRIPTION);
+ createEReference(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA);
+ createEAttribute(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__PACKAGE);
+ createEAttribute(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__SCHEMA);
+ createEAttribute(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__CATALOG);
+ createEReference(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS);
+ createEReference(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__TABLE_GENERATORS);
+ createEReference(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS);
+ createEReference(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES);
+ createEReference(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__ENTITIES);
+ createEReference(xmlEntityMappingsEClass, XML_ENTITY_MAPPINGS__EMBEDDABLES);
+
+ 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);
+
+ xmlEventMethodContainerEClass = createEClass(XML_EVENT_METHOD_CONTAINER);
+ createEReference(xmlEventMethodContainerEClass, XML_EVENT_METHOD_CONTAINER__PRE_PERSIST);
+ createEReference(xmlEventMethodContainerEClass, XML_EVENT_METHOD_CONTAINER__POST_PERSIST);
+ createEReference(xmlEventMethodContainerEClass, XML_EVENT_METHOD_CONTAINER__PRE_REMOVE);
+ createEReference(xmlEventMethodContainerEClass, XML_EVENT_METHOD_CONTAINER__POST_REMOVE);
+ createEReference(xmlEventMethodContainerEClass, XML_EVENT_METHOD_CONTAINER__PRE_UPDATE);
+ createEReference(xmlEventMethodContainerEClass, XML_EVENT_METHOD_CONTAINER__POST_UPDATE);
+ createEReference(xmlEventMethodContainerEClass, XML_EVENT_METHOD_CONTAINER__POST_LOAD);
+
+ fieldResultEClass = createEClass(FIELD_RESULT);
+ createEAttribute(fieldResultEClass, FIELD_RESULT__NAME);
+ createEAttribute(fieldResultEClass, FIELD_RESULT__COLUMN);
+
+ xmlGeneratedValueEClass = createEClass(XML_GENERATED_VALUE);
+ createEAttribute(xmlGeneratedValueEClass, XML_GENERATED_VALUE__GENERATOR);
+ createEAttribute(xmlGeneratedValueEClass, XML_GENERATED_VALUE__STRATEGY);
+
+ xmlGeneratorEClass = createEClass(XML_GENERATOR);
+ createEAttribute(xmlGeneratorEClass, XML_GENERATOR__NAME);
+ createEAttribute(xmlGeneratorEClass, XML_GENERATOR__INITIAL_VALUE);
+ createEAttribute(xmlGeneratorEClass, XML_GENERATOR__ALLOCATION_SIZE);
+
+ xmlGeneratorContainerEClass = createEClass(XML_GENERATOR_CONTAINER);
+ createEReference(xmlGeneratorContainerEClass, XML_GENERATOR_CONTAINER__SEQUENCE_GENERATOR);
+ createEReference(xmlGeneratorContainerEClass, XML_GENERATOR_CONTAINER__TABLE_GENERATOR);
+
+ xmlIdEClass = createEClass(XML_ID);
+ createEReference(xmlIdEClass, XML_ID__GENERATED_VALUE);
+
+ xmlIdClassContainerEClass = createEClass(XML_ID_CLASS_CONTAINER);
+ createEReference(xmlIdClassContainerEClass, XML_ID_CLASS_CONTAINER__ID_CLASS);
+
+ inheritanceEClass = createEClass(INHERITANCE);
+ createEAttribute(inheritanceEClass, INHERITANCE__STRATEGY);
+
+ xmlJoinColumnEClass = createEClass(XML_JOIN_COLUMN);
+ createEAttribute(xmlJoinColumnEClass, XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+
+ xmlJoinColumnContainerEClass = createEClass(XML_JOIN_COLUMN_CONTAINER);
+ createEReference(xmlJoinColumnContainerEClass, XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS);
+
+ xmlJoinTableEClass = createEClass(XML_JOIN_TABLE);
+ createEReference(xmlJoinTableEClass, XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS);
+
+ xmlJoinTableContainerEClass = createEClass(XML_JOIN_TABLE_CONTAINER);
+ createEReference(xmlJoinTableContainerEClass, XML_JOIN_TABLE_CONTAINER__JOIN_TABLE);
+
+ lobEClass = createEClass(LOB);
+
+ xmlManyToManyEClass = createEClass(XML_MANY_TO_MANY);
+
+ xmlManyToOneEClass = createEClass(XML_MANY_TO_ONE);
+
+ mapKeyEClass = createEClass(MAP_KEY);
+ createEAttribute(mapKeyEClass, MAP_KEY__NAME);
+
+ xmlMappedByMappingEClass = createEClass(XML_MAPPED_BY_MAPPING);
+ createEAttribute(xmlMappedByMappingEClass, XML_MAPPED_BY_MAPPING__MAPPED_BY);
+
+ xmlMappedSuperclassEClass = createEClass(XML_MAPPED_SUPERCLASS);
+ createEAttribute(xmlMappedSuperclassEClass, XML_MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS);
+ createEAttribute(xmlMappedSuperclassEClass, XML_MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS);
+ createEReference(xmlMappedSuperclassEClass, XML_MAPPED_SUPERCLASS__ENTITY_LISTENERS);
+
+ xmlNamedNativeQueryEClass = createEClass(XML_NAMED_NATIVE_QUERY);
+ createEAttribute(xmlNamedNativeQueryEClass, XML_NAMED_NATIVE_QUERY__RESULT_CLASS);
+ createEAttribute(xmlNamedNativeQueryEClass, XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING);
+
+ xmlNamedQueryEClass = createEClass(XML_NAMED_QUERY);
+
+ xmlNullAttributeMappingEClass = createEClass(XML_NULL_ATTRIBUTE_MAPPING);
+
+ xmlOneToManyEClass = createEClass(XML_ONE_TO_MANY);
+
+ xmlOneToOneEClass = createEClass(XML_ONE_TO_ONE);
+
+ xmlOrderableEClass = createEClass(XML_ORDERABLE);
+ createEAttribute(xmlOrderableEClass, XML_ORDERABLE__ORDER_BY);
+
+ xmlOrderColumnEClass = createEClass(XML_ORDER_COLUMN);
+
+ xmlOverrideEClass = createEClass(XML_OVERRIDE);
+ createEAttribute(xmlOverrideEClass, XML_OVERRIDE__NAME);
+
+ xmlPersistenceUnitDefaultsEClass = createEClass(XML_PERSISTENCE_UNIT_DEFAULTS);
+ createEAttribute(xmlPersistenceUnitDefaultsEClass, XML_PERSISTENCE_UNIT_DEFAULTS__SCHEMA);
+ createEAttribute(xmlPersistenceUnitDefaultsEClass, XML_PERSISTENCE_UNIT_DEFAULTS__CATALOG);
+ createEAttribute(xmlPersistenceUnitDefaultsEClass, XML_PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST);
+ createEReference(xmlPersistenceUnitDefaultsEClass, XML_PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS);
+
+ xmlPersistenceUnitMetadataEClass = createEClass(XML_PERSISTENCE_UNIT_METADATA);
+ createEAttribute(xmlPersistenceUnitMetadataEClass, XML_PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE);
+ createEReference(xmlPersistenceUnitMetadataEClass, XML_PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS);
+
+ xmlReferenceTableEClass = createEClass(XML_REFERENCE_TABLE);
+ createEReference(xmlReferenceTableEClass, XML_REFERENCE_TABLE__JOIN_COLUMNS);
+
+ 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);
+
+ xmlPrimaryKeyJoinColumnEClass = createEClass(XML_PRIMARY_KEY_JOIN_COLUMN);
+ createEAttribute(xmlPrimaryKeyJoinColumnEClass, XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+
+ xmlPrimaryKeyJoinColumnContainerEClass = createEClass(XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER);
+ createEReference(xmlPrimaryKeyJoinColumnContainerEClass, XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER__PRIMARY_KEY_JOIN_COLUMNS);
+
+ xmlQueryEClass = createEClass(XML_QUERY);
+ createEAttribute(xmlQueryEClass, XML_QUERY__NAME);
+ createEAttribute(xmlQueryEClass, XML_QUERY__QUERY);
+ createEReference(xmlQueryEClass, XML_QUERY__HINTS);
+
+ xmlQueryContainerEClass = createEClass(XML_QUERY_CONTAINER);
+ createEReference(xmlQueryContainerEClass, XML_QUERY_CONTAINER__NAMED_QUERIES);
+ createEReference(xmlQueryContainerEClass, XML_QUERY_CONTAINER__NAMED_NATIVE_QUERIES);
+
+ xmlQueryHintEClass = createEClass(XML_QUERY_HINT);
+ createEAttribute(xmlQueryHintEClass, XML_QUERY_HINT__NAME);
+ createEAttribute(xmlQueryHintEClass, XML_QUERY_HINT__VALUE);
+
+ xmlSecondaryTableEClass = createEClass(XML_SECONDARY_TABLE);
+ createEReference(xmlSecondaryTableEClass, XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS);
+
+ xmlSequenceGeneratorEClass = createEClass(XML_SEQUENCE_GENERATOR);
+ createEAttribute(xmlSequenceGeneratorEClass, XML_SEQUENCE_GENERATOR__SEQUENCE_NAME);
+
+ 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);
+
+ xmlTableEClass = createEClass(XML_TABLE);
+
+ xmlTableGeneratorEClass = createEClass(XML_TABLE_GENERATOR);
+ createEAttribute(xmlTableGeneratorEClass, XML_TABLE_GENERATOR__TABLE);
+ createEAttribute(xmlTableGeneratorEClass, XML_TABLE_GENERATOR__CATALOG);
+ createEAttribute(xmlTableGeneratorEClass, XML_TABLE_GENERATOR__SCHEMA);
+ createEAttribute(xmlTableGeneratorEClass, XML_TABLE_GENERATOR__PK_COLUMN_NAME);
+ createEAttribute(xmlTableGeneratorEClass, XML_TABLE_GENERATOR__VALUE_COLUMN_NAME);
+ createEAttribute(xmlTableGeneratorEClass, XML_TABLE_GENERATOR__PK_COLUMN_VALUE);
+ createEReference(xmlTableGeneratorEClass, XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
+
+ xmlTransientEClass = createEClass(XML_TRANSIENT);
+
+ xmlTypeMappingEClass = createEClass(XML_TYPE_MAPPING);
+ createEAttribute(xmlTypeMappingEClass, XML_TYPE_MAPPING__CLASS_NAME);
+ createEAttribute(xmlTypeMappingEClass, XML_TYPE_MAPPING__METADATA_COMPLETE);
+ createEAttribute(xmlTypeMappingEClass, XML_TYPE_MAPPING__DESCRIPTION);
+ createEReference(xmlTypeMappingEClass, XML_TYPE_MAPPING__ATTRIBUTES);
+
+ xmlUniqueConstraintEClass = createEClass(XML_UNIQUE_CONSTRAINT);
+ createEAttribute(xmlUniqueConstraintEClass, XML_UNIQUE_CONSTRAINT__COLUMN_NAMES);
+
+ xmlVersionEClass = createEClass(XML_VERSION);
+
+ // 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);
+ }
+
+ /**
+ * <!-- 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
+ OrmV2_0Package theOrmV2_0Package = (OrmV2_0Package)EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI);
+ XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
+ CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI);
+
+ // Add subpackages
+ getESubpackages().add(theOrmV2_0Package);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ abstractXmlAttributeMappingEClass.getESuperTypes().add(this.getXmlAttributeMapping());
+ abstractXmlColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
+ abstractXmlEmbeddedEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ abstractXmlEmbeddedEClass.getESuperTypes().add(this.getXmlAttributeOverrideContainer());
+ abstractXmlMultiRelationshipMappingEClass.getESuperTypes().add(this.getAbstractXmlRelationshipMapping());
+ abstractXmlMultiRelationshipMappingEClass.getESuperTypes().add(this.getXmlMappedByMapping());
+ abstractXmlMultiRelationshipMappingEClass.getESuperTypes().add(this.getXmlJoinTableContainer());
+ abstractXmlMultiRelationshipMappingEClass.getESuperTypes().add(this.getXmlOrderable());
+ abstractXmlMultiRelationshipMappingEClass.getESuperTypes().add(theOrmV2_0Package.getXmlMultiRelationshipMapping_2_0());
+ abstractXmlRelationshipMappingEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ abstractXmlSingleRelationshipMappingEClass.getESuperTypes().add(this.getAbstractXmlRelationshipMapping());
+ abstractXmlSingleRelationshipMappingEClass.getESuperTypes().add(this.getXmlJoinTableContainer());
+ abstractXmlSingleRelationshipMappingEClass.getESuperTypes().add(this.getXmlJoinColumnContainer());
+ abstractXmlSingleRelationshipMappingEClass.getESuperTypes().add(theOrmV2_0Package.getXmlSingleRelationshipMapping_2_0());
+ abstractXmlReferenceTableEClass.getESuperTypes().add(this.getAbstractXmlTable());
+ abstractXmlReferenceTableEClass.getESuperTypes().add(this.getXmlReferenceTable());
+ abstractXmlTypeMappingEClass.getESuperTypes().add(this.getXmlTypeMapping());
+ xmlAttributeMappingEClass.getESuperTypes().add(theOrmV2_0Package.getXmlAttributeMapping_2_0());
+ xmlAssociationOverrideEClass.getESuperTypes().add(this.getXmlOverride());
+ xmlAssociationOverrideEClass.getESuperTypes().add(this.getXmlJoinColumnContainer());
+ xmlAssociationOverrideEClass.getESuperTypes().add(theOrmV2_0Package.getXmlAssociationOverride_2_0());
+ xmlAttributeOverrideEClass.getESuperTypes().add(this.getXmlOverride());
+ xmlAttributeOverrideEClass.getESuperTypes().add(theOrmV2_0Package.getXmlAttributeOverride_2_0());
+ attributesEClass.getESuperTypes().add(theOrmV2_0Package.getXmlAttributes_2_0());
+ xmlBasicEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ xmlBasicEClass.getESuperTypes().add(this.getColumnMapping());
+ xmlBasicEClass.getESuperTypes().add(this.getXmlConvertibleMapping());
+ cascadeTypeEClass.getESuperTypes().add(theOrmV2_0Package.getXmlCascadeType_2_0());
+ xmlCollectionTableEClass.getESuperTypes().add(this.getAbstractXmlReferenceTable());
+ xmlCollectionTableEClass.getESuperTypes().add(theOrmV2_0Package.getXmlCollectionTable_2_0());
+ xmlColumnEClass.getESuperTypes().add(this.getAbstractXmlColumn());
+ xmlDiscriminatorColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
+ xmlElementCollectionEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ xmlElementCollectionEClass.getESuperTypes().add(theOrmV2_0Package.getXmlElementCollection_2_0());
+ xmlEmbeddableEClass.getESuperTypes().add(this.getAbstractXmlTypeMapping());
+ xmlEmbeddedEClass.getESuperTypes().add(this.getAbstractXmlEmbedded());
+ xmlEmbeddedEClass.getESuperTypes().add(theOrmV2_0Package.getXmlEmbedded_2_0());
+ xmlEmbeddedIdEClass.getESuperTypes().add(this.getAbstractXmlEmbedded());
+ xmlEntityEClass.getESuperTypes().add(this.getAbstractXmlTypeMapping());
+ xmlEntityEClass.getESuperTypes().add(this.getXmlQueryContainer());
+ xmlEntityEClass.getESuperTypes().add(this.getXmlGeneratorContainer());
+ xmlEntityEClass.getESuperTypes().add(this.getXmlEventMethodContainer());
+ xmlEntityEClass.getESuperTypes().add(this.getXmlAttributeOverrideContainer());
+ xmlEntityEClass.getESuperTypes().add(this.getXmlAssociationOverrideContainer());
+ xmlEntityEClass.getESuperTypes().add(theOrmV2_0Package.getXmlEntity_2_0());
+ xmlEntityEClass.getESuperTypes().add(this.getXmlIdClassContainer());
+ entityListenerEClass.getESuperTypes().add(this.getXmlEventMethodContainer());
+ entityListenerEClass.getESuperTypes().add(theOrmV2_0Package.getXmlEntityListener_2_0());
+ xmlEntityMappingsEClass.getESuperTypes().add(theCommonPackage.getAbstractJpaRootEObject());
+ xmlEntityMappingsEClass.getESuperTypes().add(this.getXmlQueryContainer());
+ xmlEntityMappingsEClass.getESuperTypes().add(this.getXmlAccessHolder());
+ eventMethodEClass.getESuperTypes().add(theOrmV2_0Package.getXmlEventMethod_2_0());
+ xmlGeneratorEClass.getESuperTypes().add(theOrmV2_0Package.getXmlGenerator_2_0());
+ xmlIdEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ xmlIdEClass.getESuperTypes().add(this.getColumnMapping());
+ xmlIdEClass.getESuperTypes().add(this.getXmlConvertibleMapping());
+ xmlIdEClass.getESuperTypes().add(this.getXmlGeneratorContainer());
+ xmlJoinColumnEClass.getESuperTypes().add(this.getAbstractXmlColumn());
+ xmlJoinTableEClass.getESuperTypes().add(this.getAbstractXmlReferenceTable());
+ xmlManyToManyEClass.getESuperTypes().add(this.getAbstractXmlMultiRelationshipMapping());
+ xmlManyToManyEClass.getESuperTypes().add(theOrmV2_0Package.getXmlManyToMany_2_0());
+ xmlManyToOneEClass.getESuperTypes().add(this.getAbstractXmlSingleRelationshipMapping());
+ xmlMappedSuperclassEClass.getESuperTypes().add(this.getAbstractXmlTypeMapping());
+ xmlMappedSuperclassEClass.getESuperTypes().add(this.getXmlIdClassContainer());
+ xmlNamedNativeQueryEClass.getESuperTypes().add(this.getXmlQuery());
+ xmlNamedQueryEClass.getESuperTypes().add(this.getXmlQuery());
+ xmlNamedQueryEClass.getESuperTypes().add(theOrmV2_0Package.getXmlNamedQuery_2_0());
+ xmlNullAttributeMappingEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ xmlOneToManyEClass.getESuperTypes().add(this.getAbstractXmlMultiRelationshipMapping());
+ xmlOneToManyEClass.getESuperTypes().add(this.getXmlJoinColumnContainer());
+ xmlOneToManyEClass.getESuperTypes().add(theOrmV2_0Package.getXmlOneToMany_2_0());
+ xmlOneToOneEClass.getESuperTypes().add(this.getAbstractXmlSingleRelationshipMapping());
+ xmlOneToOneEClass.getESuperTypes().add(this.getXmlMappedByMapping());
+ xmlOneToOneEClass.getESuperTypes().add(this.getXmlPrimaryKeyJoinColumnContainer());
+ xmlOneToOneEClass.getESuperTypes().add(theOrmV2_0Package.getXmlOneToOne_2_0());
+ xmlOrderableEClass.getESuperTypes().add(theOrmV2_0Package.getXmlOrderable_2_0());
+ xmlOrderColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
+ xmlOrderColumnEClass.getESuperTypes().add(theOrmV2_0Package.getXmlOrderColumn_2_0());
+ xmlPersistenceUnitDefaultsEClass.getESuperTypes().add(this.getXmlAccessHolder());
+ xmlPersistenceUnitDefaultsEClass.getESuperTypes().add(theOrmV2_0Package.getXmlPersistenceUnitDefaults_2_0());
+ xmlPersistenceUnitMetadataEClass.getESuperTypes().add(theOrmV2_0Package.getXmlPersistenceUnitMetadata_2_0());
+ 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());
+ xmlPrimaryKeyJoinColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
+ xmlQueryEClass.getESuperTypes().add(theOrmV2_0Package.getXmlQuery_2_0());
+ xmlQueryHintEClass.getESuperTypes().add(theOrmV2_0Package.getXmlQueryHint_2_0());
+ xmlSecondaryTableEClass.getESuperTypes().add(this.getAbstractXmlTable());
+ xmlSequenceGeneratorEClass.getESuperTypes().add(this.getXmlGenerator());
+ xmlSequenceGeneratorEClass.getESuperTypes().add(theOrmV2_0Package.getXmlSequenceGenerator_2_0());
+ sqlResultSetMappingEClass.getESuperTypes().add(theOrmV2_0Package.getXmlSqlResultSetMapping_2_0());
+ xmlTableEClass.getESuperTypes().add(this.getAbstractXmlTable());
+ xmlTableGeneratorEClass.getESuperTypes().add(this.getXmlGenerator());
+ xmlTransientEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ xmlTypeMappingEClass.getESuperTypes().add(this.getXmlAccessHolder());
+ xmlUniqueConstraintEClass.getESuperTypes().add(theOrmV2_0Package.getXmlUniqueConstraint_2_0());
+ xmlVersionEClass.getESuperTypes().add(this.getAbstractXmlAttributeMapping());
+ xmlVersionEClass.getESuperTypes().add(this.getColumnMapping());
+ xmlVersionEClass.getESuperTypes().add(this.getXmlConvertibleMapping());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(abstractXmlAttributeMappingEClass, AbstractXmlAttributeMapping.class, "AbstractXmlAttributeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(abstractXmlColumnEClass, AbstractXmlColumn.class, "AbstractXmlColumn", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAbstractXmlColumn_Insertable(), theXMLTypePackage.getBooleanObject(), "insertable", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlColumn_Nullable(), theXMLTypePackage.getBooleanObject(), "nullable", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlColumn_Table(), theXMLTypePackage.getString(), "table", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlColumn_Unique(), theXMLTypePackage.getBooleanObject(), "unique", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlColumn_Updatable(), theXMLTypePackage.getBooleanObject(), "updatable", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractXmlEmbeddedEClass, AbstractXmlEmbedded.class, "AbstractXmlEmbedded", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(abstractXmlMultiRelationshipMappingEClass, AbstractXmlMultiRelationshipMapping.class, "AbstractXmlMultiRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAbstractXmlMultiRelationshipMapping_MapKey(), this.getMapKey(), null, "mapKey", null, 0, 1, AbstractXmlMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractXmlNamedColumnEClass, AbstractXmlNamedColumn.class, "AbstractXmlNamedColumn", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAbstractXmlNamedColumn_ColumnDefinition(), theXMLTypePackage.getString(), "columnDefinition", null, 0, 1, AbstractXmlNamedColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlNamedColumn_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, AbstractXmlNamedColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractXmlRelationshipMappingEClass, AbstractXmlRelationshipMapping.class, "AbstractXmlRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAbstractXmlRelationshipMapping_TargetEntity(), theXMLTypePackage.getString(), "targetEntity", null, 0, 1, AbstractXmlRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlRelationshipMapping_Fetch(), this.getFetchType(), "fetch", "LAZY", 0, 1, AbstractXmlRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAbstractXmlRelationshipMapping_Cascade(), this.getCascadeType(), null, "cascade", null, 0, 1, AbstractXmlRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractXmlSingleRelationshipMappingEClass, AbstractXmlSingleRelationshipMapping.class, "AbstractXmlSingleRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAbstractXmlSingleRelationshipMapping_Optional(), theXMLTypePackage.getBooleanObject(), "optional", null, 0, 1, AbstractXmlSingleRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractXmlReferenceTableEClass, AbstractXmlReferenceTable.class, "AbstractXmlReferenceTable", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(abstractXmlTableEClass, AbstractXmlTable.class, "AbstractXmlTable", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAbstractXmlTable_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, AbstractXmlTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlTable_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, AbstractXmlTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractXmlTable_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, AbstractXmlTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAbstractXmlTable_UniqueConstraints(), this.getXmlUniqueConstraint(), null, "uniqueConstraints", null, 0, -1, AbstractXmlTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractXmlTypeMappingEClass, AbstractXmlTypeMapping.class, "AbstractXmlTypeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlAccessHolderEClass, XmlAccessHolder.class, "XmlAccessHolder", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlAccessHolder_Access(), this.getAccessType(), "access", null, 0, 1, XmlAccessHolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlAttributeMappingEClass, XmlAttributeMapping.class, "XmlAttributeMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlAttributeMapping_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlAttributeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlAssociationOverrideEClass, XmlAssociationOverride.class, "XmlAssociationOverride", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlAssociationOverrideContainerEClass, XmlAssociationOverrideContainer.class, "XmlAssociationOverrideContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlAssociationOverrideContainer_AssociationOverrides(), this.getXmlAssociationOverride(), null, "associationOverrides", null, 0, -1, XmlAssociationOverrideContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlAttributeOverrideEClass, XmlAttributeOverride.class, "XmlAttributeOverride", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlAttributeOverride_Column(), this.getXmlColumn(), null, "column", null, 1, 1, XmlAttributeOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlAttributeOverrideContainerEClass, XmlAttributeOverrideContainer.class, "XmlAttributeOverrideContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlAttributeOverrideContainer_AttributeOverrides(), this.getXmlAttributeOverride(), null, "attributeOverrides", null, 0, -1, XmlAttributeOverrideContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(attributesEClass, Attributes.class, "Attributes", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAttributes_Ids(), this.getXmlId(), 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.getXmlEmbeddedId(), 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.getXmlBasic(), 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.getXmlVersion(), 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.getXmlManyToOne(), 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.getXmlOneToMany(), 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.getXmlOneToOne(), 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.getXmlManyToMany(), 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.getXmlEmbedded(), 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.getXmlTransient(), 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(xmlBasicEClass, XmlBasic.class, "XmlBasic", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlBasic_Fetch(), this.getFetchType(), "fetch", "LAZY", 0, 1, XmlBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlBasic_Optional(), theXMLTypePackage.getBooleanObject(), "optional", null, 0, 1, XmlBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ 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(xmlClassReferenceEClass, XmlClassReference.class, "XmlClassReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlClassReference_ClassName(), theXMLTypePackage.getString(), "className", null, 1, 1, XmlClassReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlCollectionTableEClass, XmlCollectionTable.class, "XmlCollectionTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlColumnEClass, XmlColumn.class, "XmlColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlColumn_Length(), theXMLTypePackage.getIntObject(), "length", null, 0, 1, XmlColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlColumn_Precision(), theXMLTypePackage.getIntObject(), "precision", null, 0, 1, XmlColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlColumn_Scale(), theXMLTypePackage.getIntObject(), "scale", null, 0, 1, XmlColumn.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.getXmlColumn(), 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(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(xmlConvertibleMappingEClass, XmlConvertibleMapping.class, "XmlConvertibleMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlConvertibleMapping_Lob(), theXMLTypePackage.getBoolean(), "lob", null, 0, 1, XmlConvertibleMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlConvertibleMapping_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, XmlConvertibleMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlConvertibleMapping_Enumerated(), this.getEnumType(), "enumerated", null, 0, 1, XmlConvertibleMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlDiscriminatorColumnEClass, XmlDiscriminatorColumn.class, "XmlDiscriminatorColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlDiscriminatorColumn_DiscriminatorType(), this.getDiscriminatorType(), "discriminatorType", "STRING", 0, 1, XmlDiscriminatorColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlDiscriminatorColumn_Length(), theXMLTypePackage.getIntObject(), "length", null, 0, 1, XmlDiscriminatorColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlElementCollectionEClass, XmlElementCollection.class, "XmlElementCollection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlEmbeddableEClass, XmlEmbeddable.class, "XmlEmbeddable", !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(xmlEntityEClass, XmlEntity.class, "XmlEntity", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlEntity_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, XmlEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntity_Table(), this.getXmlTable(), null, "table", 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_SecondaryTables(), this.getXmlSecondaryTable(), 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_PrimaryKeyJoinColumns(), this.getXmlPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", 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_Inheritance(), this.getInheritance(), null, "inheritance", null, 0, 1, XmlEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlEntity_DiscriminatorValue(), theXMLTypePackage.getString(), "discriminatorValue", null, 0, 1, XmlEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntity_DiscriminatorColumn(), this.getXmlDiscriminatorColumn(), null, "discriminatorColumn", 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_SqlResultSetMappings(), this.getSqlResultSetMapping(), null, "sqlResultSetMappings", null, 0, -1, XmlEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlEntity_ExcludeDefaultListeners(), theXMLTypePackage.getBoolean(), "excludeDefaultListeners", null, 0, 1, XmlEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlEntity_ExcludeSuperclassListeners(), theXMLTypePackage.getBoolean(), "excludeSuperclassListeners", null, 0, 1, XmlEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntity_EntityListeners(), this.getEntityListeners(), null, "entityListeners", 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(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);
+
+ 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(xmlEntityMappingsEClass, XmlEntityMappings.class, "XmlEntityMappings", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlEntityMappings_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntityMappings_PersistenceUnitMetadata(), this.getXmlPersistenceUnitMetadata(), null, "persistenceUnitMetadata", null, 0, 1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlEntityMappings_Package(), theXMLTypePackage.getString(), "package", null, 0, 1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlEntityMappings_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlEntityMappings_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntityMappings_SequenceGenerators(), this.getXmlSequenceGenerator(), null, "sequenceGenerators", null, 0, -1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntityMappings_TableGenerators(), this.getXmlTableGenerator(), null, "tableGenerators", null, 0, -1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntityMappings_SqlResultSetMappings(), this.getSqlResultSetMapping(), null, "sqlResultSetMappings", null, 0, -1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntityMappings_MappedSuperclasses(), this.getXmlMappedSuperclass(), null, "mappedSuperclasses", null, 0, -1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntityMappings_Entities(), this.getXmlEntity(), null, "entities", null, 0, -1, XmlEntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEntityMappings_Embeddables(), this.getXmlEmbeddable(), null, "embeddables", null, 0, -1, XmlEntityMappings.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(xmlEventMethodContainerEClass, XmlEventMethodContainer.class, "XmlEventMethodContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlEventMethodContainer_PrePersist(), this.getPrePersist(), null, "prePersist", null, 0, 1, XmlEventMethodContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEventMethodContainer_PostPersist(), this.getPostPersist(), null, "postPersist", null, 0, 1, XmlEventMethodContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEventMethodContainer_PreRemove(), this.getPreRemove(), null, "preRemove", null, 0, 1, XmlEventMethodContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEventMethodContainer_PostRemove(), this.getPostRemove(), null, "postRemove", null, 0, 1, XmlEventMethodContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEventMethodContainer_PreUpdate(), this.getPreUpdate(), null, "preUpdate", null, 0, 1, XmlEventMethodContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEventMethodContainer_PostUpdate(), this.getPostUpdate(), null, "postUpdate", null, 0, 1, XmlEventMethodContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlEventMethodContainer_PostLoad(), this.getPostLoad(), null, "postLoad", null, 0, 1, XmlEventMethodContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, 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(xmlGeneratedValueEClass, XmlGeneratedValue.class, "XmlGeneratedValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlGeneratedValue_Generator(), theXMLTypePackage.getString(), "generator", null, 0, 1, XmlGeneratedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlGeneratedValue_Strategy(), this.getGenerationType(), "strategy", "TABLE", 0, 1, XmlGeneratedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlGeneratorEClass, XmlGenerator.class, "XmlGenerator", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlGenerator_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlGenerator_InitialValue(), theXMLTypePackage.getIntObject(), "initialValue", null, 0, 1, XmlGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlGenerator_AllocationSize(), theXMLTypePackage.getIntObject(), "allocationSize", null, 0, 1, XmlGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlGeneratorContainerEClass, XmlGeneratorContainer.class, "XmlGeneratorContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlGeneratorContainer_SequenceGenerator(), this.getXmlSequenceGenerator(), null, "sequenceGenerator", null, 0, 1, XmlGeneratorContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlGeneratorContainer_TableGenerator(), this.getXmlTableGenerator(), null, "tableGenerator", null, 0, 1, XmlGeneratorContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlIdEClass, XmlId.class, "XmlId", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlId_GeneratedValue(), this.getXmlGeneratedValue(), null, "generatedValue", null, 0, 1, XmlId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlIdClassContainerEClass, XmlIdClassContainer.class, "XmlIdClassContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlIdClassContainer_IdClass(), this.getXmlClassReference(), null, "idClass", null, 0, 1, XmlIdClassContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, 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(xmlJoinColumnEClass, XmlJoinColumn.class, "XmlJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlJoinColumn_ReferencedColumnName(), theXMLTypePackage.getString(), "referencedColumnName", null, 0, 1, XmlJoinColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlJoinColumnContainerEClass, XmlJoinColumnContainer.class, "XmlJoinColumnContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlJoinColumnContainer_JoinColumns(), this.getXmlJoinColumn(), null, "joinColumns", null, 0, -1, XmlJoinColumnContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlJoinTableEClass, XmlJoinTable.class, "XmlJoinTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlJoinTable_InverseJoinColumns(), this.getXmlJoinColumn(), null, "inverseJoinColumns", null, 0, -1, XmlJoinTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlJoinTableContainerEClass, XmlJoinTableContainer.class, "XmlJoinTableContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlJoinTableContainer_JoinTable(), this.getXmlJoinTable(), null, "joinTable", null, 0, 1, XmlJoinTableContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(lobEClass, Lob.class, "Lob", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlManyToManyEClass, XmlManyToMany.class, "XmlManyToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlManyToOneEClass, XmlManyToOne.class, "XmlManyToOne", !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(xmlMappedByMappingEClass, XmlMappedByMapping.class, "XmlMappedByMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlMappedByMapping_MappedBy(), theXMLTypePackage.getString(), "mappedBy", null, 0, 1, XmlMappedByMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlMappedSuperclassEClass, XmlMappedSuperclass.class, "XmlMappedSuperclass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlMappedSuperclass_ExcludeDefaultListeners(), theXMLTypePackage.getBoolean(), "excludeDefaultListeners", null, 0, 1, XmlMappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlMappedSuperclass_ExcludeSuperclassListeners(), theXMLTypePackage.getBoolean(), "excludeSuperclassListeners", null, 0, 1, XmlMappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlMappedSuperclass_EntityListeners(), this.getEntityListeners(), null, "entityListeners", 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(xmlNamedNativeQueryEClass, XmlNamedNativeQuery.class, "XmlNamedNativeQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlNamedNativeQuery_ResultClass(), theXMLTypePackage.getString(), "resultClass", null, 0, 1, XmlNamedNativeQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlNamedNativeQuery_ResultSetMapping(), theXMLTypePackage.getString(), "resultSetMapping", null, 0, 1, XmlNamedNativeQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlNamedQueryEClass, XmlNamedQuery.class, "XmlNamedQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlNullAttributeMappingEClass, XmlNullAttributeMapping.class, "XmlNullAttributeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlOneToManyEClass, XmlOneToMany.class, "XmlOneToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlOneToOneEClass, XmlOneToOne.class, "XmlOneToOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlOrderableEClass, XmlOrderable.class, "XmlOrderable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlOrderable_OrderBy(), theXMLTypePackage.getString(), "orderBy", null, 0, 1, XmlOrderable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlOrderColumnEClass, XmlOrderColumn.class, "XmlOrderColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlOverrideEClass, XmlOverride.class, "XmlOverride", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlOverride_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlPersistenceUnitDefaultsEClass, XmlPersistenceUnitDefaults.class, "XmlPersistenceUnitDefaults", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlPersistenceUnitDefaults_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, XmlPersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnitDefaults_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, XmlPersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnitDefaults_CascadePersist(), theXMLTypePackage.getBoolean(), "cascadePersist", null, 0, 1, XmlPersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlPersistenceUnitDefaults_EntityListeners(), this.getEntityListeners(), null, "entityListeners", null, 0, 1, XmlPersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlPersistenceUnitMetadataEClass, XmlPersistenceUnitMetadata.class, "XmlPersistenceUnitMetadata", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlPersistenceUnitMetadata_XmlMappingMetadataComplete(), theXMLTypePackage.getBoolean(), "xmlMappingMetadataComplete", null, 0, 1, XmlPersistenceUnitMetadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlPersistenceUnitMetadata_PersistenceUnitDefaults(), this.getXmlPersistenceUnitDefaults(), null, "persistenceUnitDefaults", null, 0, 1, XmlPersistenceUnitMetadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlReferenceTableEClass, XmlReferenceTable.class, "XmlReferenceTable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlReferenceTable_JoinColumns(), this.getXmlJoinColumn(), null, "joinColumns", null, 0, -1, XmlReferenceTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ 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(xmlPrimaryKeyJoinColumnEClass, XmlPrimaryKeyJoinColumn.class, "XmlPrimaryKeyJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlPrimaryKeyJoinColumn_ReferencedColumnName(), theXMLTypePackage.getString(), "referencedColumnName", null, 0, 1, XmlPrimaryKeyJoinColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlPrimaryKeyJoinColumnContainerEClass, XmlPrimaryKeyJoinColumnContainer.class, "XmlPrimaryKeyJoinColumnContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlPrimaryKeyJoinColumnContainer_PrimaryKeyJoinColumns(), this.getXmlPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", null, 0, -1, XmlPrimaryKeyJoinColumnContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlQueryEClass, XmlQuery.class, "XmlQuery", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlQuery_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlQuery_Query(), theXMLTypePackage.getString(), "query", null, 1, 1, XmlQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlQuery_Hints(), this.getXmlQueryHint(), null, "hints", null, 0, -1, XmlQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlQueryContainerEClass, XmlQueryContainer.class, "XmlQueryContainer", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlQueryContainer_NamedQueries(), this.getXmlNamedQuery(), null, "namedQueries", null, 0, -1, XmlQueryContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlQueryContainer_NamedNativeQueries(), this.getXmlNamedNativeQuery(), null, "namedNativeQueries", null, 0, -1, XmlQueryContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlQueryHintEClass, XmlQueryHint.class, "XmlQueryHint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlQueryHint_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlQueryHint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlQueryHint_Value(), theXMLTypePackage.getString(), "value", null, 1, 1, XmlQueryHint.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);
+ initEReference(getXmlSecondaryTable_PrimaryKeyJoinColumns(), this.getXmlPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", null, 0, -1, XmlSecondaryTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlSequenceGeneratorEClass, XmlSequenceGenerator.class, "XmlSequenceGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlSequenceGenerator_SequenceName(), theXMLTypePackage.getString(), "sequenceName", null, 0, 1, XmlSequenceGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ 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(xmlTableEClass, XmlTable.class, "XmlTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlTableGeneratorEClass, XmlTableGenerator.class, "XmlTableGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlTableGenerator_Table(), theXMLTypePackage.getString(), "table", null, 0, 1, XmlTableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlTableGenerator_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, XmlTableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlTableGenerator_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, XmlTableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlTableGenerator_PkColumnName(), theXMLTypePackage.getString(), "pkColumnName", null, 0, 1, XmlTableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlTableGenerator_ValueColumnName(), theXMLTypePackage.getString(), "valueColumnName", null, 0, 1, XmlTableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlTableGenerator_PkColumnValue(), theXMLTypePackage.getString(), "pkColumnValue", null, 0, 1, XmlTableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlTableGenerator_UniqueConstraints(), this.getXmlUniqueConstraint(), null, "uniqueConstraints", null, 0, -1, XmlTableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlTransientEClass, XmlTransient.class, "XmlTransient", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlTypeMappingEClass, XmlTypeMapping.class, "XmlTypeMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlTypeMapping_ClassName(), theXMLTypePackage.getString(), "className", null, 1, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlTypeMapping_MetadataComplete(), theXMLTypePackage.getBooleanObject(), "metadataComplete", null, 0, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlTypeMapping_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlTypeMapping_Attributes(), this.getAttributes(), null, "attributes", null, 0, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlUniqueConstraintEClass, XmlUniqueConstraint.class, "XmlUniqueConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlUniqueConstraint_ColumnNames(), theXMLTypePackage.getString(), "columnNames", null, 1, -1, XmlUniqueConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlVersionEClass, XmlVersion.class, "XmlVersion", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ // 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);
+
+ // 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.jpa.core.resource.orm.AbstractXmlAttributeMapping <em>Abstract Xml Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlAttributeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlAttributeMapping()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_ATTRIBUTE_MAPPING = eINSTANCE.getAbstractXmlAttributeMapping();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn <em>Abstract Xml Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlColumn()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_COLUMN = eINSTANCE.getAbstractXmlColumn();
+
+ /**
+ * 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_XML_COLUMN__INSERTABLE = eINSTANCE.getAbstractXmlColumn_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_XML_COLUMN__NULLABLE = eINSTANCE.getAbstractXmlColumn_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_XML_COLUMN__TABLE = eINSTANCE.getAbstractXmlColumn_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_XML_COLUMN__UNIQUE = eINSTANCE.getAbstractXmlColumn_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_XML_COLUMN__UPDATABLE = eINSTANCE.getAbstractXmlColumn_Updatable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded <em>Abstract Xml Embedded</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlEmbedded()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_EMBEDDED = eINSTANCE.getAbstractXmlEmbedded();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping <em>Abstract Xml Multi Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlMultiRelationshipMapping()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING = eINSTANCE.getAbstractXmlMultiRelationshipMapping();
+
+ /**
+ * 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 ABSTRACT_XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY = eINSTANCE.getAbstractXmlMultiRelationshipMapping_MapKey();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn <em>Abstract Xml Named Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlNamedColumn()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_NAMED_COLUMN = eINSTANCE.getAbstractXmlNamedColumn();
+
+ /**
+ * 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 ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION = eINSTANCE.getAbstractXmlNamedColumn_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 ABSTRACT_XML_NAMED_COLUMN__NAME = eINSTANCE.getAbstractXmlNamedColumn_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping <em>Abstract Xml Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlRelationshipMapping()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_RELATIONSHIP_MAPPING = eINSTANCE.getAbstractXmlRelationshipMapping();
+
+ /**
+ * 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 ABSTRACT_XML_RELATIONSHIP_MAPPING__TARGET_ENTITY = eINSTANCE.getAbstractXmlRelationshipMapping_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 ABSTRACT_XML_RELATIONSHIP_MAPPING__FETCH = eINSTANCE.getAbstractXmlRelationshipMapping_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 ABSTRACT_XML_RELATIONSHIP_MAPPING__CASCADE = eINSTANCE.getAbstractXmlRelationshipMapping_Cascade();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping <em>Abstract Xml Single Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlSingleRelationshipMapping()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING = eINSTANCE.getAbstractXmlSingleRelationshipMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Optional</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL = eINSTANCE.getAbstractXmlSingleRelationshipMapping_Optional();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable <em>Abstract Xml Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlTable()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_TABLE = eINSTANCE.getAbstractXmlTable();
+
+ /**
+ * 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_XML_TABLE__NAME = eINSTANCE.getAbstractXmlTable_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_XML_TABLE__CATALOG = eINSTANCE.getAbstractXmlTable_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_XML_TABLE__SCHEMA = eINSTANCE.getAbstractXmlTable_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_XML_TABLE__UNIQUE_CONSTRAINTS = eINSTANCE.getAbstractXmlTable_UniqueConstraints();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTypeMapping <em>Abstract Xml Type Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTypeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlTypeMapping()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_TYPE_MAPPING = eINSTANCE.getAbstractXmlTypeMapping();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder <em>Xml Access Holder</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder()
+ * @generated
+ */
+ public static final EClass XML_ACCESS_HOLDER = eINSTANCE.getXmlAccessHolder();
+
+ /**
+ * 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_ACCESS_HOLDER__ACCESS = eINSTANCE.getXmlAccessHolder_Access();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping <em>Xml Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeMapping()
+ * @generated
+ */
+ public static final EClass XML_ATTRIBUTE_MAPPING = eINSTANCE.getXmlAttributeMapping();
+
+ /**
+ * 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_ATTRIBUTE_MAPPING__NAME = eINSTANCE.getXmlAttributeMapping_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride <em>Xml Association Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverride()
+ * @generated
+ */
+ public static final EClass XML_ASSOCIATION_OVERRIDE = eINSTANCE.getXmlAssociationOverride();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer <em>Xml Association Override Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer()
+ * @generated
+ */
+ public static final EClass XML_ASSOCIATION_OVERRIDE_CONTAINER = eINSTANCE.getXmlAssociationOverrideContainer();
+
+ /**
+ * 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 XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES = eINSTANCE.getXmlAssociationOverrideContainer_AssociationOverrides();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride <em>Xml Attribute Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverride()
+ * @generated
+ */
+ public static final EClass XML_ATTRIBUTE_OVERRIDE = eINSTANCE.getXmlAttributeOverride();
+
+ /**
+ * 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 XML_ATTRIBUTE_OVERRIDE__COLUMN = eINSTANCE.getXmlAttributeOverride_Column();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer <em>Xml Attribute Override Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer()
+ * @generated
+ */
+ public static final EClass XML_ATTRIBUTE_OVERRIDE_CONTAINER = eINSTANCE.getXmlAttributeOverrideContainer();
+
+ /**
+ * 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 XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES = eINSTANCE.getXmlAttributeOverrideContainer_AttributeOverrides();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.Attributes <em>Attributes</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.Attributes
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlBasic <em>Xml Basic</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlBasic
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlBasic()
+ * @generated
+ */
+ public static final EClass XML_BASIC = eINSTANCE.getXmlBasic();
+
+ /**
+ * The meta object literal for the '<em><b>Fetch</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_BASIC__FETCH = eINSTANCE.getXmlBasic_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 XML_BASIC__OPTIONAL = eINSTANCE.getXmlBasic_Optional();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.CascadeType <em>Cascade Type</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.CascadeType
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlClassReference <em>Xml Class Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlClassReference()
+ * @generated
+ */
+ public static final EClass XML_CLASS_REFERENCE = eINSTANCE.getXmlClassReference();
+
+ /**
+ * 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 XML_CLASS_REFERENCE__CLASS_NAME = eINSTANCE.getXmlClassReference_ClassName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable <em>Xml Collection Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlCollectionTable()
+ * @generated
+ */
+ public static final EClass XML_COLLECTION_TABLE = eINSTANCE.getXmlCollectionTable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn <em>Xml Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlColumn()
+ * @generated
+ */
+ public static final EClass XML_COLUMN = eINSTANCE.getXmlColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Length</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_COLUMN__LENGTH = eINSTANCE.getXmlColumn_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 XML_COLUMN__PRECISION = eINSTANCE.getXmlColumn_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 XML_COLUMN__SCALE = eINSTANCE.getXmlColumn_Scale();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.ColumnMapping <em>Column Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.ColumnMapping
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.ColumnResult <em>Column Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.ColumnResult
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlConvertibleMapping <em>Xml Convertible Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping()
+ * @generated
+ */
+ public static final EClass XML_CONVERTIBLE_MAPPING = eINSTANCE.getXmlConvertibleMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Lob</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_CONVERTIBLE_MAPPING__LOB = eINSTANCE.getXmlConvertibleMapping_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 XML_CONVERTIBLE_MAPPING__TEMPORAL = eINSTANCE.getXmlConvertibleMapping_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 XML_CONVERTIBLE_MAPPING__ENUMERATED = eINSTANCE.getXmlConvertibleMapping_Enumerated();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn <em>Xml Discriminator Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn()
+ * @generated
+ */
+ public static final EClass XML_DISCRIMINATOR_COLUMN = eINSTANCE.getXmlDiscriminatorColumn();
+
+ /**
+ * 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 XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = eINSTANCE.getXmlDiscriminatorColumn_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 XML_DISCRIMINATOR_COLUMN__LENGTH = eINSTANCE.getXmlDiscriminatorColumn_Length();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection <em>Xml Element Collection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection()
+ * @generated
+ */
+ public static final EClass XML_ELEMENT_COLLECTION = eINSTANCE.getXmlElementCollection();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable <em>Xml Embeddable</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbeddable()
+ * @generated
+ */
+ public static final EClass XML_EMBEDDABLE = eINSTANCE.getXmlEmbeddable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded <em>Xml Embedded</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbedded()
+ * @generated
+ */
+ public static final EClass XML_EMBEDDED = eINSTANCE.getXmlEmbedded();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId <em>Xml Embedded Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbeddedId()
+ * @generated
+ */
+ public static final EClass XML_EMBEDDED_ID = eINSTANCE.getXmlEmbeddedId();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity <em>Xml Entity</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntity
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntity()
+ * @generated
+ */
+ public static final EClass XML_ENTITY = eINSTANCE.getXmlEntity();
+
+ /**
+ * 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_ENTITY__NAME = eINSTANCE.getXmlEntity_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 XML_ENTITY__TABLE = eINSTANCE.getXmlEntity_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 XML_ENTITY__SECONDARY_TABLES = eINSTANCE.getXmlEntity_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 XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getXmlEntity_PrimaryKeyJoinColumns();
+
+ /**
+ * 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 XML_ENTITY__INHERITANCE = eINSTANCE.getXmlEntity_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 XML_ENTITY__DISCRIMINATOR_VALUE = eINSTANCE.getXmlEntity_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 XML_ENTITY__DISCRIMINATOR_COLUMN = eINSTANCE.getXmlEntity_DiscriminatorColumn();
+
+ /**
+ * 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 XML_ENTITY__SQL_RESULT_SET_MAPPINGS = eINSTANCE.getXmlEntity_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 XML_ENTITY__EXCLUDE_DEFAULT_LISTENERS = eINSTANCE.getXmlEntity_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 XML_ENTITY__EXCLUDE_SUPERCLASS_LISTENERS = eINSTANCE.getXmlEntity_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 XML_ENTITY__ENTITY_LISTENERS = eINSTANCE.getXmlEntity_EntityListeners();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EntityListener <em>Entity Listener</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EntityListener
+ * @see org.eclipse.jpt.jpa.core.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 '{@link org.eclipse.jpt.jpa.core.resource.orm.EntityListeners <em>Entity Listeners</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EntityListeners
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlEntityMappings <em>Xml Entity Mappings</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings()
+ * @generated
+ */
+ public static final EClass XML_ENTITY_MAPPINGS = eINSTANCE.getXmlEntityMappings();
+
+ /**
+ * 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_ENTITY_MAPPINGS__DESCRIPTION = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__PACKAGE = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__SCHEMA = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__CATALOG = eINSTANCE.getXmlEntityMappings_Catalog();
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__TABLE_GENERATORS = eINSTANCE.getXmlEntityMappings_TableGenerators();
+
+ /**
+ * 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 XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__ENTITIES = eINSTANCE.getXmlEntityMappings_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 XML_ENTITY_MAPPINGS__EMBEDDABLES = eINSTANCE.getXmlEntityMappings_Embeddables();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EntityResult <em>Entity Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EntityResult
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EventMethod <em>Event Method</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EventMethod
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlEventMethodContainer <em>Xml Event Method Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer()
+ * @generated
+ */
+ public static final EClass XML_EVENT_METHOD_CONTAINER = eINSTANCE.getXmlEventMethodContainer();
+
+ /**
+ * 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 XML_EVENT_METHOD_CONTAINER__PRE_PERSIST = eINSTANCE.getXmlEventMethodContainer_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 XML_EVENT_METHOD_CONTAINER__POST_PERSIST = eINSTANCE.getXmlEventMethodContainer_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 XML_EVENT_METHOD_CONTAINER__PRE_REMOVE = eINSTANCE.getXmlEventMethodContainer_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 XML_EVENT_METHOD_CONTAINER__POST_REMOVE = eINSTANCE.getXmlEventMethodContainer_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 XML_EVENT_METHOD_CONTAINER__PRE_UPDATE = eINSTANCE.getXmlEventMethodContainer_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 XML_EVENT_METHOD_CONTAINER__POST_UPDATE = eINSTANCE.getXmlEventMethodContainer_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 XML_EVENT_METHOD_CONTAINER__POST_LOAD = eINSTANCE.getXmlEventMethodContainer_PostLoad();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.FieldResult <em>Field Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.FieldResult
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlGeneratedValue <em>Xml Generated Value</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratedValue()
+ * @generated
+ */
+ public static final EClass XML_GENERATED_VALUE = eINSTANCE.getXmlGeneratedValue();
+
+ /**
+ * The meta object literal for the '<em><b>Generator</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_GENERATED_VALUE__GENERATOR = eINSTANCE.getXmlGeneratedValue_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 XML_GENERATED_VALUE__STRATEGY = eINSTANCE.getXmlGeneratedValue_Strategy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator <em>Xml Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGenerator()
+ * @generated
+ */
+ public static final EClass XML_GENERATOR = eINSTANCE.getXmlGenerator();
+
+ /**
+ * 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_GENERATOR__NAME = eINSTANCE.getXmlGenerator_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 XML_GENERATOR__INITIAL_VALUE = eINSTANCE.getXmlGenerator_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 XML_GENERATOR__ALLOCATION_SIZE = eINSTANCE.getXmlGenerator_AllocationSize();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer <em>Xml Generator Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer()
+ * @generated
+ */
+ public static final EClass XML_GENERATOR_CONTAINER = eINSTANCE.getXmlGeneratorContainer();
+
+ /**
+ * 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 XML_GENERATOR_CONTAINER__SEQUENCE_GENERATOR = eINSTANCE.getXmlGeneratorContainer_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 XML_GENERATOR_CONTAINER__TABLE_GENERATOR = eINSTANCE.getXmlGeneratorContainer_TableGenerator();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlId <em>Xml Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlId
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlId()
+ * @generated
+ */
+ public static final EClass XML_ID = eINSTANCE.getXmlId();
+
+ /**
+ * 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 XML_ID__GENERATED_VALUE = eINSTANCE.getXmlId_GeneratedValue();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer <em>Xml Id Class Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlIdClassContainer()
+ * @generated
+ */
+ public static final EClass XML_ID_CLASS_CONTAINER = eINSTANCE.getXmlIdClassContainer();
+
+ /**
+ * 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 XML_ID_CLASS_CONTAINER__ID_CLASS = eINSTANCE.getXmlIdClassContainer_IdClass();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.Inheritance <em>Inheritance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.Inheritance
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlJoinColumn <em>Xml Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinColumn()
+ * @generated
+ */
+ public static final EClass XML_JOIN_COLUMN = eINSTANCE.getXmlJoinColumn();
+
+ /**
+ * 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 XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME = eINSTANCE.getXmlJoinColumn_ReferencedColumnName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer <em>Xml Join Column Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinColumnContainer()
+ * @generated
+ */
+ public static final EClass XML_JOIN_COLUMN_CONTAINER = eINSTANCE.getXmlJoinColumnContainer();
+
+ /**
+ * 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 XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS = eINSTANCE.getXmlJoinColumnContainer_JoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable <em>Xml Join Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTable()
+ * @generated
+ */
+ public static final EClass XML_JOIN_TABLE = eINSTANCE.getXmlJoinTable();
+
+ /**
+ * 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 XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS = eINSTANCE.getXmlJoinTable_InverseJoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer <em>Xml Join Table Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTableContainer()
+ * @generated
+ */
+ public static final EClass XML_JOIN_TABLE_CONTAINER = eINSTANCE.getXmlJoinTableContainer();
+
+ /**
+ * 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 XML_JOIN_TABLE_CONTAINER__JOIN_TABLE = eINSTANCE.getXmlJoinTableContainer_JoinTable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.Lob <em>Lob</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.Lob
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getLob()
+ * @generated
+ */
+ public static final EClass LOB = eINSTANCE.getLob();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany <em>Xml Many To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlManyToMany()
+ * @generated
+ */
+ public static final EClass XML_MANY_TO_MANY = eINSTANCE.getXmlManyToMany();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne <em>Xml Many To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlManyToOne()
+ * @generated
+ */
+ public static final EClass XML_MANY_TO_ONE = eINSTANCE.getXmlManyToOne();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.MapKey <em>Map Key</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.MapKey
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlMappedByMapping <em>Xml Mapped By Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMappedByMapping()
+ * @generated
+ */
+ public static final EClass XML_MAPPED_BY_MAPPING = eINSTANCE.getXmlMappedByMapping();
+
+ /**
+ * 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 XML_MAPPED_BY_MAPPING__MAPPED_BY = eINSTANCE.getXmlMappedByMapping_MappedBy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass <em>Xml Mapped Superclass</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMappedSuperclass()
+ * @generated
+ */
+ public static final EClass XML_MAPPED_SUPERCLASS = eINSTANCE.getXmlMappedSuperclass();
+
+ /**
+ * 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 XML_MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS = eINSTANCE.getXmlMappedSuperclass_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 XML_MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS = eINSTANCE.getXmlMappedSuperclass_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 XML_MAPPED_SUPERCLASS__ENTITY_LISTENERS = eINSTANCE.getXmlMappedSuperclass_EntityListeners();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery <em>Xml Named Native Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNamedNativeQuery()
+ * @generated
+ */
+ public static final EClass XML_NAMED_NATIVE_QUERY = eINSTANCE.getXmlNamedNativeQuery();
+
+ /**
+ * 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 XML_NAMED_NATIVE_QUERY__RESULT_CLASS = eINSTANCE.getXmlNamedNativeQuery_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 XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = eINSTANCE.getXmlNamedNativeQuery_ResultSetMapping();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery <em>Xml Named Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNamedQuery()
+ * @generated
+ */
+ public static final EClass XML_NAMED_QUERY = eINSTANCE.getXmlNamedQuery();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping <em>Xml Null Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNullAttributeMapping()
+ * @generated
+ */
+ public static final EClass XML_NULL_ATTRIBUTE_MAPPING = eINSTANCE.getXmlNullAttributeMapping();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany <em>Xml One To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOneToMany()
+ * @generated
+ */
+ public static final EClass XML_ONE_TO_MANY = eINSTANCE.getXmlOneToMany();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne <em>Xml One To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOneToOne()
+ * @generated
+ */
+ public static final EClass XML_ONE_TO_ONE = eINSTANCE.getXmlOneToOne();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn <em>Xml Order Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderColumn()
+ * @generated
+ */
+ public static final EClass XML_ORDER_COLUMN = eINSTANCE.getXmlOrderColumn();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOverride <em>Xml Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOverride
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOverride()
+ * @generated
+ */
+ public static final EClass XML_OVERRIDE = eINSTANCE.getXmlOverride();
+
+ /**
+ * 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_OVERRIDE__NAME = eINSTANCE.getXmlOverride_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults <em>Xml Persistence Unit Defaults</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults()
+ * @generated
+ */
+ public static final EClass XML_PERSISTENCE_UNIT_DEFAULTS = eINSTANCE.getXmlPersistenceUnitDefaults();
+
+ /**
+ * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT_DEFAULTS__SCHEMA = eINSTANCE.getXmlPersistenceUnitDefaults_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 XML_PERSISTENCE_UNIT_DEFAULTS__CATALOG = eINSTANCE.getXmlPersistenceUnitDefaults_Catalog();
+
+ /**
+ * 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 XML_PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST = eINSTANCE.getXmlPersistenceUnitDefaults_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 XML_PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS = eINSTANCE.getXmlPersistenceUnitDefaults_EntityListeners();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata <em>Xml Persistence Unit Metadata</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitMetadata()
+ * @generated
+ */
+ public static final EClass XML_PERSISTENCE_UNIT_METADATA = eINSTANCE.getXmlPersistenceUnitMetadata();
+
+ /**
+ * 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 XML_PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE = eINSTANCE.getXmlPersistenceUnitMetadata_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 XML_PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS = eINSTANCE.getXmlPersistenceUnitMetadata_PersistenceUnitDefaults();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable <em>Abstract Xml Reference Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAbstractXmlReferenceTable()
+ * @generated
+ */
+ public static final EClass ABSTRACT_XML_REFERENCE_TABLE = eINSTANCE.getAbstractXmlReferenceTable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable <em>Xml Reference Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlReferenceTable()
+ * @generated
+ */
+ public static final EClass XML_REFERENCE_TABLE = eINSTANCE.getXmlReferenceTable();
+
+ /**
+ * 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 XML_REFERENCE_TABLE__JOIN_COLUMNS = eINSTANCE.getXmlReferenceTable_JoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostLoad <em>Post Load</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostLoad
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostLoad()
+ * @generated
+ */
+ public static final EClass POST_LOAD = eINSTANCE.getPostLoad();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostPersist <em>Post Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostPersist
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostPersist()
+ * @generated
+ */
+ public static final EClass POST_PERSIST = eINSTANCE.getPostPersist();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostRemove <em>Post Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostRemove
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostRemove()
+ * @generated
+ */
+ public static final EClass POST_REMOVE = eINSTANCE.getPostRemove();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PostUpdate <em>Post Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PostUpdate
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostUpdate()
+ * @generated
+ */
+ public static final EClass POST_UPDATE = eINSTANCE.getPostUpdate();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PrePersist <em>Pre Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PrePersist
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPrePersist()
+ * @generated
+ */
+ public static final EClass PRE_PERSIST = eINSTANCE.getPrePersist();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PreRemove <em>Pre Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PreRemove
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPreRemove()
+ * @generated
+ */
+ public static final EClass PRE_REMOVE = eINSTANCE.getPreRemove();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.PreUpdate <em>Pre Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.PreUpdate
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPreUpdate()
+ * @generated
+ */
+ public static final EClass PRE_UPDATE = eINSTANCE.getPreUpdate();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn <em>Xml Primary Key Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
+ * @generated
+ */
+ public static final EClass XML_PRIMARY_KEY_JOIN_COLUMN = eINSTANCE.getXmlPrimaryKeyJoinColumn();
+
+ /**
+ * 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 XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = eINSTANCE.getXmlPrimaryKeyJoinColumn_ReferencedColumnName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer <em>Xml Primary Key Join Column Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnContainer()
+ * @generated
+ */
+ public static final EClass XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER = eINSTANCE.getXmlPrimaryKeyJoinColumnContainer();
+
+ /**
+ * 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 XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getXmlPrimaryKeyJoinColumnContainer_PrimaryKeyJoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery <em>Xml Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQuery
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQuery()
+ * @generated
+ */
+ public static final EClass XML_QUERY = eINSTANCE.getXmlQuery();
+
+ /**
+ * 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_QUERY__NAME = eINSTANCE.getXmlQuery_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 XML_QUERY__QUERY = eINSTANCE.getXmlQuery_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 XML_QUERY__HINTS = eINSTANCE.getXmlQuery_Hints();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer <em>Xml Query Container</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer()
+ * @generated
+ */
+ public static final EClass XML_QUERY_CONTAINER = eINSTANCE.getXmlQueryContainer();
+
+ /**
+ * 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 XML_QUERY_CONTAINER__NAMED_QUERIES = eINSTANCE.getXmlQueryContainer_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 XML_QUERY_CONTAINER__NAMED_NATIVE_QUERIES = eINSTANCE.getXmlQueryContainer_NamedNativeQueries();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint <em>Xml Query Hint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQueryHint()
+ * @generated
+ */
+ public static final EClass XML_QUERY_HINT = eINSTANCE.getXmlQueryHint();
+
+ /**
+ * 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_QUERY_HINT__NAME = eINSTANCE.getXmlQueryHint_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_QUERY_HINT__VALUE = eINSTANCE.getXmlQueryHint_Value();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable <em>Xml Secondary Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSecondaryTable()
+ * @generated
+ */
+ public static final EClass XML_SECONDARY_TABLE = eINSTANCE.getXmlSecondaryTable();
+
+ /**
+ * 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 XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getXmlSecondaryTable_PrimaryKeyJoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator <em>Xml Sequence Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSequenceGenerator()
+ * @generated
+ */
+ public static final EClass XML_SEQUENCE_GENERATOR = eINSTANCE.getXmlSequenceGenerator();
+
+ /**
+ * 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 XML_SEQUENCE_GENERATOR__SEQUENCE_NAME = eINSTANCE.getXmlSequenceGenerator_SequenceName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping <em>Sql Result Set Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.XmlTable <em>Xml Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTable()
+ * @generated
+ */
+ public static final EClass XML_TABLE = eINSTANCE.getXmlTable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator <em>Xml Table Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator()
+ * @generated
+ */
+ public static final EClass XML_TABLE_GENERATOR = eINSTANCE.getXmlTableGenerator();
+
+ /**
+ * The meta object literal for the '<em><b>Table</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_TABLE_GENERATOR__TABLE = eINSTANCE.getXmlTableGenerator_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 XML_TABLE_GENERATOR__CATALOG = eINSTANCE.getXmlTableGenerator_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 XML_TABLE_GENERATOR__SCHEMA = eINSTANCE.getXmlTableGenerator_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 XML_TABLE_GENERATOR__PK_COLUMN_NAME = eINSTANCE.getXmlTableGenerator_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 XML_TABLE_GENERATOR__VALUE_COLUMN_NAME = eINSTANCE.getXmlTableGenerator_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 XML_TABLE_GENERATOR__PK_COLUMN_VALUE = eINSTANCE.getXmlTableGenerator_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 XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS = eINSTANCE.getXmlTableGenerator_UniqueConstraints();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTransient <em>Xml Transient</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTransient
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTransient()
+ * @generated
+ */
+ public static final EClass XML_TRANSIENT = eINSTANCE.getXmlTransient();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping <em>Xml Type Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping()
+ * @generated
+ */
+ public static final EClass XML_TYPE_MAPPING = eINSTANCE.getXmlTypeMapping();
+
+ /**
+ * 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 XML_TYPE_MAPPING__CLASS_NAME = eINSTANCE.getXmlTypeMapping_ClassName();
+
+ /**
+ * 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>Description</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_TYPE_MAPPING__DESCRIPTION = eINSTANCE.getXmlTypeMapping_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 XML_TYPE_MAPPING__ATTRIBUTES = eINSTANCE.getXmlTypeMapping_Attributes();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint <em>Xml Unique Constraint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlUniqueConstraint()
+ * @generated
+ */
+ public static final EClass XML_UNIQUE_CONSTRAINT = eINSTANCE.getXmlUniqueConstraint();
+
+ /**
+ * 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 XML_UNIQUE_CONSTRAINT__COLUMN_NAMES = eINSTANCE.getXmlUniqueConstraint_ColumnNames();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlVersion <em>Xml Version</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlVersion
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlVersion()
+ * @generated
+ */
+ public static final EClass XML_VERSION = eINSTANCE.getXmlVersion();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable <em>Xml Orderable</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderable()
+ * @generated
+ */
+ public static final EClass XML_ORDERABLE = eINSTANCE.getXmlOrderable();
+
+ /**
+ * 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 XML_ORDERABLE__ORDER_BY = eINSTANCE.getXmlOrderable_OrderBy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.AccessType <em>Access Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.AccessType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getAccessType()
+ * @generated
+ */
+ public static final EEnum ACCESS_TYPE = eINSTANCE.getAccessType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType <em>Discriminator Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getDiscriminatorType()
+ * @generated
+ */
+ public static final EEnum DISCRIMINATOR_TYPE = eINSTANCE.getDiscriminatorType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.EnumType <em>Enum Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getEnumType()
+ * @generated
+ */
+ public static final EEnum ENUM_TYPE = eINSTANCE.getEnumType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.FetchType <em>Fetch Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.FetchType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getFetchType()
+ * @generated
+ */
+ public static final EEnum FETCH_TYPE = eINSTANCE.getFetchType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.GenerationType <em>Generation Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.GenerationType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getGenerationType()
+ * @generated
+ */
+ public static final EEnum GENERATION_TYPE = eINSTANCE.getGenerationType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.InheritanceType <em>Inheritance Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.InheritanceType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getInheritanceType()
+ * @generated
+ */
+ public static final EEnum INHERITANCE_TYPE = eINSTANCE.getInheritanceType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType <em>Temporal Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getTemporalType()
+ * @generated
+ */
+ public static final EEnum TEMPORAL_TYPE = eINSTANCE.getTemporalType();
+
+ }
+
+} //OrmPackage
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java
new file mode 100644
index 0000000000..9703fbcae1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+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;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public class OrmXmlResourceFactory
+ extends TranslatorResourceFactory
+{
+ public OrmXmlResourceFactory() {
+ this(RendererFactory.getDefaultRendererFactory());
+ }
+
+ public OrmXmlResourceFactory(RendererFactory aRendererFactory) {
+ super(aRendererFactory);
+ }
+
+ public OrmXmlResourceFactory(RendererFactory aRendererFactory, boolean listeningForUpdates) {
+ super(aRendererFactory, listeningForUpdates);
+ }
+
+
+ @Override
+ protected TranslatorResource createResource(URI uri, Renderer renderer) {
+ return new JpaXmlResource(uri, renderer, JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, XmlEntityMappings.getRootTranslator());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostLoad.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostLoad.java
new file mode 100644
index 0000000000..9a5af1b685
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostLoad.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Post Load</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getPostLoad()
+ * @model kind="class"
+ * @generated
+ */
+public class PostLoad extends EventMethod
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PostLoad()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.POST_LOAD;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.POST_LOAD,
+ OrmPackage.eINSTANCE.getXmlEventMethodContainer_PostLoad());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostPersist.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostPersist.java
new file mode 100644
index 0000000000..5ce949ab65
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostPersist.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Post Persist</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.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;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.POST_PERSIST,
+ OrmPackage.eINSTANCE.getXmlEventMethodContainer_PostPersist());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostRemove.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostRemove.java
new file mode 100644
index 0000000000..f85d1507d6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostRemove.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Post Remove</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.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;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.POST_REMOVE,
+ OrmPackage.eINSTANCE.getXmlEventMethodContainer_PostRemove());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostUpdate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostUpdate.java
new file mode 100644
index 0000000000..b6591cac9e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostUpdate.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Post Update</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.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;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.POST_UPDATE,
+ OrmPackage.eINSTANCE.getXmlEventMethodContainer_PostUpdate());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PrePersist.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PrePersist.java
new file mode 100644
index 0000000000..b70cf6c4d7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PrePersist.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Pre Persist</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.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;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.PRE_PERSIST,
+ OrmPackage.eINSTANCE.getXmlEventMethodContainer_PrePersist());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreRemove.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreRemove.java
new file mode 100644
index 0000000000..9bf1e58790
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreRemove.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Pre Remove</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.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;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.PRE_REMOVE,
+ OrmPackage.eINSTANCE.getXmlEventMethodContainer_PreRemove());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreUpdate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreUpdate.java
new file mode 100644
index 0000000000..f3c5ff5dbe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreUpdate.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Pre Update</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.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;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ public static Translator buildTranslator() {
+ return buildTranslator(
+ JPA.PRE_UPDATE,
+ OrmPackage.eINSTANCE.getXmlEventMethodContainer_PreUpdate());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/SqlResultSetMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/SqlResultSetMapping.java
new file mode 100644
index 0000000000..d9db475f64
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/SqlResultSetMapping.java
@@ -0,0 +1,418 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Sql Result Set Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping#getEntityResults <em>Entity Results</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping#getColumnResults <em>Column Results</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getSqlResultSetMapping()
+ * @model kind="class"
+ * @generated
+ */
+public class SqlResultSetMapping extends AbstractJpaEObject implements XmlSqlResultSetMapping_2_0
+{
+ /**
+ * 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 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>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.jpa.core.resource.orm.OrmPackage#getXmlSqlResultSetMapping_2_0_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.jpa.core.resource.orm.SqlResultSetMapping#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.SQL_RESULT_SET_MAPPING__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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__DESCRIPTION:
+ return getDescription();
+ 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__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ 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__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ 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__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ 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(" (description: ");
+ result.append(description);
+ result.append(", name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildDescriptionTranslator(),
+ buildEntityResultTranslator(),
+ buildColumnResultTranslator()
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getSqlResultSetMapping_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlSqlResultSetMapping_2_0_Description());
+ }
+
+ protected static Translator buildEntityResultTranslator() {
+ return EntityResult.buildTranslator(JPA.ENTITY_RESULT, OrmPackage.eINSTANCE.getSqlResultSetMapping_EntityResults());
+ }
+
+ protected static Translator buildColumnResultTranslator() {
+ return ColumnResult.buildTranslator(JPA.COLUMN_RESULT, OrmPackage.eINSTANCE.getSqlResultSetMapping_ColumnResults());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/TemporalType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/TemporalType.java
new file mode 100644
index 0000000000..cd0da47bed
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/TemporalType.java
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * 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.jpa.core.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>Temporal Type</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getTemporalType()
+ * @model
+ * @generated
+ */
+public enum TemporalType implements Enumerator
+{
+ /**
+ * The '<em><b>DATE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #DATE_VALUE
+ * @generated
+ * @ordered
+ */
+ DATE(0, "DATE", "DATE"),
+
+ /**
+ * The '<em><b>TIME</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #TIME_VALUE
+ * @generated
+ * @ordered
+ */
+ TIME(1, "TIME", "TIME"),
+
+ /**
+ * The '<em><b>TIMESTAMP</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #TIMESTAMP_VALUE
+ * @generated
+ * @ordered
+ */
+ TIMESTAMP(2, "TIMESTAMP", "TIMESTAMP");
+
+ /**
+ * The '<em><b>DATE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>DATE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #DATE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int DATE_VALUE = 0;
+
+ /**
+ * The '<em><b>TIME</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>TIME</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #TIME
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int TIME_VALUE = 1;
+
+ /**
+ * The '<em><b>TIMESTAMP</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>TIMESTAMP</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #TIMESTAMP
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int TIMESTAMP_VALUE = 2;
+
+ /**
+ * An array of all the '<em><b>Temporal Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<TemporalType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Temporal Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Temporal Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Temporal Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ 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;
+ }
+
+ /**
+ * <!-- 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 TemporalType(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;
+ }
+
+} //TemporalType
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAccessHolder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAccessHolder.java
new file mode 100644
index 0000000000..5aca16c13f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAccessHolder.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Access Holder</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder#getAccess <em>Access</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlAccessHolder extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder_Access()
+ * @model
+ * @generated
+ */
+ AccessType getAccess();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder#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.jpa.core.resource.orm.AccessType
+ * @see #getAccess()
+ * @generated
+ */
+ void setAccess(AccessType value);
+
+} // XmlAccessHolder
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverride.java
new file mode 100644
index 0000000000..531c5a31a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverride.java
@@ -0,0 +1,521 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Association Override Impl</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverride()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlAssociationOverride extends AbstractJpaEObject implements XmlOverride, XmlJoinColumnContainer, XmlAssociationOverride_2_0
+{
+ /**
+ * 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 #getJoinColumns() <em>Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlJoinColumn> joinColumns;
+
+ /**
+ * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinTable()
+ * @generated
+ * @ordered
+ */
+ protected XmlJoinTable joinTable;
+
+ /**
+ * 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlAssociationOverride()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_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.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlJoinColumnContainer_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverride_2_0_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.jpa.core.resource.orm.XmlAssociationOverride#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.XML_ASSOCIATION_OVERRIDE__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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(XmlJoinTable)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTableContainer_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlJoinTable getJoinTable()
+ {
+ return joinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetJoinTable(XmlJoinTable newJoinTable, NotificationChain msgs)
+ {
+ XmlJoinTable oldJoinTable = joinTable;
+ joinTable = newJoinTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE, oldJoinTable, newJoinTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride#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(XmlJoinTable newJoinTable)
+ {
+ if (newJoinTable != joinTable)
+ {
+ NotificationChain msgs = null;
+ if (joinTable != null)
+ msgs = ((InternalEObject)joinTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE, null, msgs);
+ if (newJoinTable != null)
+ msgs = ((InternalEObject)newJoinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE, null, msgs);
+ msgs = basicSetJoinTable(newJoinTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE, newJoinTable, newJoinTable));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOverride_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.jpa.core.resource.orm.XmlAssociationOverride#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_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.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ return ((InternalEList<?>)getJoinColumns()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__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 OrmPackage.XML_ASSOCIATION_OVERRIDE__NAME:
+ return getName();
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ return getJoinColumns();
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE:
+ return getJoinTable();
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__DESCRIPTION:
+ return getDescription();
+ }
+ 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__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends XmlJoinColumn>)newValue);
+ return;
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE:
+ setJoinTable((XmlJoinTable)newValue);
+ return;
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__DESCRIPTION:
+ setDescription((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_ASSOCIATION_OVERRIDE__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE:
+ setJoinTable((XmlJoinTable)null);
+ return;
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE:
+ return joinTable != null;
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlJoinColumnContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS: return OrmPackage.XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlJoinTableContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE: return OrmPackage.XML_JOIN_TABLE_CONTAINER__JOIN_TABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverride_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE__DESCRIPTION: return OrmV2_0Package.XML_ASSOCIATION_OVERRIDE_20__DESCRIPTION;
+ 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 == XmlJoinColumnContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS: return OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlJoinTableContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_JOIN_TABLE_CONTAINER__JOIN_TABLE: return OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_TABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverride_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ASSOCIATION_OVERRIDE_20__DESCRIPTION: return OrmPackage.XML_ASSOCIATION_OVERRIDE__DESCRIPTION;
+ 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(", description: ");
+ result.append(description);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildDescriptionTranslator(),
+ buildJoinColumnTranslator(),
+ buildJoinTableTranslator()
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlOverride_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlAssociationOverride_2_0_Description());
+ }
+
+ protected static Translator buildJoinColumnTranslator() {
+ return XmlJoinColumn.buildTranslator(JPA.JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlJoinColumnContainer_JoinColumns());
+ }
+
+ protected static Translator buildJoinTableTranslator() {
+ return XmlJoinTable.buildTranslator(JPA.JOIN_TABLE, OrmPackage.eINSTANCE.getXmlJoinTableContainer_JoinTable());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverrideContainer.java
new file mode 100644
index 0000000000..e708bd3f21
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverrideContainer.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Association Override Container</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer#getAssociationOverrides <em>Association Overrides</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlAssociationOverrideContainer extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Association Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer_AssociationOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlAssociationOverride> getAssociationOverrides();
+
+} // XmlAssociationOverrideContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeMapping.java
new file mode 100644
index 0000000000..ba4995ae77
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeMapping.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeMapping_2_0;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Attribute Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlAttributeMapping extends XmlAttributeMapping_2_0
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping#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);
+
+ TextRange getNameTextRange();
+
+ //TODO unsure about this api, might change soon
+ String getMappingKey();
+
+} // XmlAttributeMapping
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverride.java
new file mode 100644
index 0000000000..b3bf1b2c12
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverride.java
@@ -0,0 +1,440 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Attribute Override</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride#getColumn <em>Column</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverride()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlAttributeOverride extends AbstractJpaEObject implements XmlOverride, XmlAttributeOverride_2_0
+{
+ /**
+ * 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 #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 #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlColumn column;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlAttributeOverride()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_ATTRIBUTE_OVERRIDE;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverride_2_0_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.jpa.core.resource.orm.XmlAttributeOverride#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.XML_ATTRIBUTE_OVERRIDE__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverride_Column()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ public XmlColumn getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(XmlColumn newColumn, NotificationChain msgs)
+ {
+ XmlColumn 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;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride#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(XmlColumn newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ATTRIBUTE_OVERRIDE__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.jpa.core.resource.orm.OrmPackage#getXmlOverride_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.jpa.core.resource.orm.XmlAttributeOverride#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_ATTRIBUTE_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.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__NAME:
+ return getName();
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__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.XML_ATTRIBUTE_OVERRIDE__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN:
+ setColumn((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__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN:
+ setColumn((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__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_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 == XmlAttributeOverride_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE__DESCRIPTION: return OrmV2_0Package.XML_ATTRIBUTE_OVERRIDE_20__DESCRIPTION;
+ 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 == XmlAttributeOverride_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ATTRIBUTE_OVERRIDE_20__DESCRIPTION: return OrmPackage.XML_ATTRIBUTE_OVERRIDE__DESCRIPTION;
+ 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(", description: ");
+ result.append(description);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildDescriptionTranslator(),
+ buildColumnTranslator()
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlOverride_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlAttributeOverride_2_0_Description());
+ }
+
+ protected static Translator buildColumnTranslator() {
+ return XmlColumn.buildTranslator(JPA.COLUMN, OrmPackage.eINSTANCE.getXmlAttributeOverride_Column());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverrideContainer.java
new file mode 100644
index 0000000000..db8605ea67
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverrideContainer.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Attribute Override Container</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer#getAttributeOverrides <em>Attribute Overrides</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlAttributeOverrideContainer extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlAttributeOverride> getAttributeOverrides();
+
+} // XmlAttributeOverrideContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlBasic.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlBasic.java
new file mode 100644
index 0000000000..584e5a3915
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlBasic.java
@@ -0,0 +1,687 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.BooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.EmptyTagBooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Basic Impl</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlBasic#getFetch <em>Fetch</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlBasic#getOptional <em>Optional</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlBasic()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlBasic extends AbstractXmlAttributeMapping implements ColumnMapping, XmlConvertibleMapping
+{
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlColumn 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;
+
+ /**
+ * 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;
+
+ /**
+ * 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlBasic()
+ {
+ super();
+ }
+
+ /**
+ * <!-- 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 #setColumn(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlColumn getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(XmlColumn newColumn, NotificationChain msgs)
+ {
+ XmlColumn 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;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlBasic#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(XmlColumn newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_BASIC__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_BASIC__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_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.jpa.core.resource.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.jpa.core.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.jpa.core.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getTemporal()
+ {
+ return temporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.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.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.jpa.core.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.jpa.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getEnumerated()
+ {
+ return enumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.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.XML_BASIC__ENUMERATED, oldEnumerated, enumerated));
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlBasic_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ public FetchType getFetch()
+ {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.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.XML_BASIC__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.jpa.core.resource.orm.OrmPackage#getXmlBasic_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.jpa.core.resource.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 #getOptional()
+ * @generated
+ */
+ public void setOptional(Boolean newOptional)
+ {
+ Boolean oldOptional = optional;
+ optional = newOptional;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__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_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__COLUMN:
+ return getColumn();
+ case OrmPackage.XML_BASIC__LOB:
+ return isLob();
+ case OrmPackage.XML_BASIC__TEMPORAL:
+ return getTemporal();
+ case OrmPackage.XML_BASIC__ENUMERATED:
+ return getEnumerated();
+ case OrmPackage.XML_BASIC__FETCH:
+ return getFetch();
+ case OrmPackage.XML_BASIC__OPTIONAL:
+ return getOptional();
+ }
+ 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__COLUMN:
+ setColumn((XmlColumn)newValue);
+ return;
+ case OrmPackage.XML_BASIC__LOB:
+ setLob((Boolean)newValue);
+ return;
+ case OrmPackage.XML_BASIC__TEMPORAL:
+ setTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.XML_BASIC__ENUMERATED:
+ setEnumerated((EnumType)newValue);
+ return;
+ case OrmPackage.XML_BASIC__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.XML_BASIC__OPTIONAL:
+ setOptional((Boolean)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__COLUMN:
+ setColumn((XmlColumn)null);
+ 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__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.XML_BASIC__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_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__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.XML_BASIC__OPTIONAL:
+ return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
+ }
+ 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.XML_BASIC__COLUMN: return OrmPackage.COLUMN_MAPPING__COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_BASIC__LOB: return OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+ case OrmPackage.XML_BASIC__TEMPORAL: return OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+ case OrmPackage.XML_BASIC__ENUMERATED: return OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+ 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.XML_BASIC__COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__LOB: return OrmPackage.XML_BASIC__LOB;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL: return OrmPackage.XML_BASIC__TEMPORAL;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED: return OrmPackage.XML_BASIC__ENUMERATED;
+ 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(" (lob: ");
+ result.append(lob);
+ result.append(", temporal: ");
+ result.append(temporal);
+ result.append(", enumerated: ");
+ result.append(enumerated);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", optional: ");
+ result.append(optional);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getEnumeratedTextRange() {
+ return getAttributeTextRange(JPA.ENUMERATED);
+ }
+
+ public TextRange getLobTextRange() {
+ return getAttributeTextRange(JPA.LOB);
+ }
+
+ public TextRange getTemporalTextRange() {
+ return getAttributeTextRange(JPA.TEMPORAL);
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildFetchTranslator(),
+ buildOptionalTranslator(),
+ buildAccessTranslator(),
+ buildColumnTranslator(),
+ buildLobTranslator(),
+ buildTemporalTranslator(),
+ buildEnumeratedTranslator()
+ };
+ }
+
+ protected static Translator buildFetchTranslator() {
+ return new Translator(JPA.FETCH, OrmPackage.eINSTANCE.getXmlBasic_Fetch(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildOptionalTranslator() {
+ return new BooleanTranslator(JPA.OPTIONAL, OrmPackage.eINSTANCE.getXmlBasic_Optional(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildColumnTranslator() {
+ return XmlColumn.buildTranslator(JPA.COLUMN, OrmPackage.eINSTANCE.getColumnMapping_Column());
+ }
+
+ protected static Translator buildLobTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.LOB, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Lob());
+ }
+
+ protected static Translator buildTemporalTranslator() {
+ return new Translator(JPA.TEMPORAL, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Temporal());
+ }
+
+ protected static Translator buildEnumeratedTranslator() {
+ return new Translator(JPA.ENUMERATED, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Enumerated());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java
new file mode 100644
index 0000000000..bfb459df82
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Class Reference</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference#getClassName <em>Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlClassReference()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class XmlClassReference extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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 XmlClassReference()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_CLASS_REFERENCE;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlClassReference_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.jpa.core.resource.orm.XmlClassReference#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.XML_CLASS_REFERENCE__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.XML_CLASS_REFERENCE__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.XML_CLASS_REFERENCE__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.XML_CLASS_REFERENCE__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.XML_CLASS_REFERENCE__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();
+ }
+
+
+ // **************** validation ********************************************
+
+ public TextRange getClassNameTextRange() {
+ return getAttributeTextRange(JPA.CLASS);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildClassTranslator()};
+ }
+
+ private static Translator buildClassTranslator() {
+ return new Translator(JPA.CLASS, OrmPackage.eINSTANCE.getXmlClassReference_ClassName(), Translator.DOM_ATTRIBUTE);
+ }
+
+ public ReplaceEdit createRenameEdit(IType originalType, String newName) {
+ String originalName = originalType.getTypeQualifiedName();
+ int nameIndex = this.className.lastIndexOf(originalName);
+
+ int offset = getAttributeNode(JPA.CLASS).getValueRegionStartOffset() + 1;
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createRenamePackageEdit(String newName) {
+ int packageLength = this.className.lastIndexOf('.');
+ int offset = getAttributeNode(JPA.CLASS).getValueRegionStartOffset() + 1; // +1 = opening double quote
+ return new ReplaceEdit(offset, packageLength, newName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlCollectionTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlCollectionTable.java
new file mode 100644
index 0000000000..7326309a2a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlCollectionTable.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCollectionTable_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Collection Table</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlCollectionTable()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlCollectionTable extends AbstractXmlReferenceTable implements XmlCollectionTable_2_0
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlCollectionTable()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_COLLECTION_TABLE;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildCatalogTranslator(),
+ buildSchemaTranslator(),
+ buildJoinColumnTranslator(),
+ buildUniqueConstraintTranslator()
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlColumn.java
new file mode 100644
index 0000000000..95a8f698e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlColumn.java
@@ -0,0 +1,375 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Column Impl</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getLength <em>Length</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getPrecision <em>Precision</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlColumn#getScale <em>Scale</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlColumn()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlColumn extends AbstractXmlColumn
+{
+ /**
+ * 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 XmlColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_COLUMN;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlColumn_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.jpa.core.resource.orm.XmlColumn#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.XML_COLUMN__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.jpa.core.resource.orm.OrmPackage#getXmlColumn_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.jpa.core.resource.orm.XmlColumn#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.XML_COLUMN__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.jpa.core.resource.orm.OrmPackage#getXmlColumn_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.jpa.core.resource.orm.XmlColumn#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.XML_COLUMN__SCALE, oldScale, 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 getLength();
+ case OrmPackage.XML_COLUMN__PRECISION:
+ return getPrecision();
+ case OrmPackage.XML_COLUMN__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.XML_COLUMN__LENGTH:
+ setLength((Integer)newValue);
+ return;
+ case OrmPackage.XML_COLUMN__PRECISION:
+ setPrecision((Integer)newValue);
+ return;
+ case OrmPackage.XML_COLUMN__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.XML_COLUMN__LENGTH:
+ setLength(LENGTH_EDEFAULT);
+ return;
+ case OrmPackage.XML_COLUMN__PRECISION:
+ setPrecision(PRECISION_EDEFAULT);
+ return;
+ case OrmPackage.XML_COLUMN__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.XML_COLUMN__LENGTH:
+ return LENGTH_EDEFAULT == null ? length != null : !LENGTH_EDEFAULT.equals(length);
+ case OrmPackage.XML_COLUMN__PRECISION:
+ return PRECISION_EDEFAULT == null ? precision != null : !PRECISION_EDEFAULT.equals(precision);
+ case OrmPackage.XML_COLUMN__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(" (length: ");
+ result.append(length);
+ result.append(", precision: ");
+ result.append(precision);
+ result.append(", scale: ");
+ result.append(scale);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildUniqueTranslator(),
+ buildNullableTranslator(),
+ buildInsertableTranslator(),
+ buildUpdatableTranslator(),
+ buildColumnDefinitionTranslator(),
+ buildTableTranslator(),
+ buildLengthTranslator(),
+ buildPrecisionTranslator(),
+ buildScaleTranslator(),
+ };
+ }
+
+ protected static Translator buildLengthTranslator() {
+ return new Translator(JPA.LENGTH, OrmPackage.eINSTANCE.getXmlColumn_Length(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildPrecisionTranslator() {
+ return new Translator(JPA.PRECISION, OrmPackage.eINSTANCE.getXmlColumn_Precision(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildScaleTranslator() {
+ return new Translator(JPA.SCALE, OrmPackage.eINSTANCE.getXmlColumn_Scale(), Translator.DOM_ATTRIBUTE);
+ }
+} // ColumnImpl
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlConvertibleMapping.java
new file mode 100644
index 0000000000..c15adb817e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlConvertibleMapping.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Convertible Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#isLob <em>Lob</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#getTemporal <em>Temporal</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#getEnumerated <em>Enumerated</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlConvertibleMapping extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Lob()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isLob();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#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
+ */
+ void setLob(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
+ * @model
+ * @generated
+ */
+ TemporalType getTemporal();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#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.jpa.core.resource.orm.TemporalType
+ * @see #getTemporal()
+ * @generated
+ */
+ void setTemporal(TemporalType value);
+
+ /**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ EnumType getEnumerated();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping#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.jpa.core.resource.orm.EnumType
+ * @see #getEnumerated()
+ * @generated
+ */
+ void setEnumerated(EnumType value);
+
+ /**
+ * Return the {@link TextRange} for the enumerated element. If the enumerated element
+ * does not exist return the {@link TextRange} for the basic element.
+ */
+ TextRange getEnumeratedTextRange();
+
+ /**
+ * Return the {@link TextRange} for the temporal element. If the temporal element
+ * does not exist return the {@link TextRange} for the basic element.
+ */
+ TextRange getTemporalTextRange();
+
+ /**
+ * Return the {@link TextRange} for the lob element. If the lob element
+ * does not exist return the {@link TextRange} for the basic element.
+ */
+ TextRange getLobTextRange();
+
+} // ConvertableMapping
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlDiscriminatorColumn.java
new file mode 100644
index 0000000000..232218a983
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlDiscriminatorColumn.java
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Discriminator Column</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn#getLength <em>Length</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlDiscriminatorColumn extends AbstractXmlNamedColumn
+{
+ /**
+ * 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 XmlDiscriminatorColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_DISCRIMINATOR_COLUMN;
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.resource.orm.DiscriminatorType
+ * @see #setDiscriminatorType(DiscriminatorType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn_DiscriminatorType()
+ * @model default="STRING"
+ * @generated
+ */
+ public DiscriminatorType getDiscriminatorType()
+ {
+ return discriminatorType;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlDiscriminatorColumn_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.jpa.core.resource.orm.XmlDiscriminatorColumn#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.XML_DISCRIMINATOR_COLUMN__LENGTH, oldLength, length));
+ }
+
+ /**
+ * <!-- 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__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.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE:
+ setDiscriminatorType((DiscriminatorType)newValue);
+ return;
+ case OrmPackage.XML_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.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE:
+ setDiscriminatorType(DISCRIMINATOR_TYPE_EDEFAULT);
+ return;
+ case OrmPackage.XML_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.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE:
+ return discriminatorType != DISCRIMINATOR_TYPE_EDEFAULT;
+ case OrmPackage.XML_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(" (discriminatorType: ");
+ result.append(discriminatorType);
+ result.append(", length: ");
+ result.append(length);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildDiscrminiatorTypeTranslator(),
+ buildColumnDefinitionTranslator(),
+ buildLengthTranslator()
+ };
+ }
+
+ protected static Translator buildDiscrminiatorTypeTranslator() {
+ return new Translator(JPA.DISCRIMINATOR_TYPE, OrmPackage.eINSTANCE.getXmlDiscriminatorColumn_DiscriminatorType(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildLengthTranslator() {
+ return new Translator(JPA.LENGTH, OrmPackage.eINSTANCE.getXmlDiscriminatorColumn_Length(), Translator.DOM_ATTRIBUTE);
+ }
+} // DiscriminatorColumn
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java
new file mode 100644
index 0000000000..ad33f6c53b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java
@@ -0,0 +1,1660 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.IType;
+import org.eclipse.jpt.common.core.internal.utility.translators.EmptyTagBooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Element Collection</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlElementCollection extends AbstractXmlAttributeMapping implements XmlElementCollection_2_0
+{
+ /**
+ * 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;
+
+ /**
+ * The cached value of the '{@link #getOrderColumn() <em>Order Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrderColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlOrderColumn orderColumn;
+
+ /**
+ * 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 #getAttributeOverrides() <em>Attribute Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAttributeOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlAttributeOverride> 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<XmlAssociationOverride> associationOverrides;
+
+ /**
+ * The cached value of the '{@link #getMapKeyAttributeOverrides() <em>Map Key Attribute Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyAttributeOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlAttributeOverride> mapKeyAttributeOverrides;
+
+ /**
+ * The default value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetClass()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_CLASS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetClass() <em>Target Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetClass()
+ * @generated
+ * @ordered
+ */
+ protected String targetClass = TARGET_CLASS_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 #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 #getMapKeyClass() <em>Map Key Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyClass()
+ * @generated
+ * @ordered
+ */
+ protected XmlClassReference mapKeyClass;
+
+ /**
+ * 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 MAP_KEY_TEMPORAL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMapKeyTemporal() <em>Map Key Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyTemporal()
+ * @generated
+ * @ordered
+ */
+ protected TemporalType mapKeyTemporal = MAP_KEY_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 MAP_KEY_ENUMERATED_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMapKeyEnumerated() <em>Map Key Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyEnumerated()
+ * @generated
+ * @ordered
+ */
+ protected EnumType mapKeyEnumerated = MAP_KEY_ENUMERATED_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getMapKeyColumn() <em>Map Key Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlColumn mapKeyColumn;
+
+ /**
+ * The cached value of the '{@link #getMapKeyJoinColumns() <em>Map Key Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKeyJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlJoinColumn> mapKeyJoinColumns;
+
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlColumn column;
+
+ /**
+ * The cached value of the '{@link #getCollectionTable() <em>Collection Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCollectionTable()
+ * @generated
+ * @ordered
+ */
+ protected XmlCollectionTable collectionTable;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlElementCollection()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_ELEMENT_COLLECTION;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_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.jpa.core.resource.orm.XmlElementCollection#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_ELEMENT_COLLECTION__LOB, oldLob, lob));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getTemporal()
+ {
+ return temporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#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.jpa.core.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.XML_ELEMENT_COLLECTION__TEMPORAL, oldTemporal, temporal));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getEnumerated()
+ {
+ return enumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#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.jpa.core.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.XML_ELEMENT_COLLECTION__ENUMERATED, oldEnumerated, enumerated));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Target Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target 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>Target Class</em>' attribute.
+ * @see #setTargetClass(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_TargetClass()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTargetClass()
+ {
+ return targetClass;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#getTargetClass <em>Target Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Class</em>' attribute.
+ * @see #getTargetClass()
+ * @generated
+ */
+ public void setTargetClass(String newTargetClass)
+ {
+ String oldTargetClass = targetClass;
+ targetClass = newTargetClass;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS, oldTargetClass, targetClass));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_Fetch()
+ * @model
+ * @generated
+ */
+ public FetchType getFetch()
+ {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#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.jpa.core.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.XML_ELEMENT_COLLECTION__FETCH, oldFetch, fetch));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOrderable_OrderBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getOrderBy()
+ {
+ return orderBy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#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_ELEMENT_COLLECTION__ORDER_BY, oldOrderBy, orderBy));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAttributeOverride> getAttributeOverrides()
+ {
+ if (attributeOverrides == null)
+ {
+ attributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.XML_ELEMENT_COLLECTION__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.jpa.core.resource.orm.XmlAssociationOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer_AssociationOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAssociationOverride> getAssociationOverrides()
+ {
+ if (associationOverrides == null)
+ {
+ associationOverrides = new EObjectContainmentEList<XmlAssociationOverride>(XmlAssociationOverride.class, this, OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES);
+ }
+ return associationOverrides;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAttributeOverride> getMapKeyAttributeOverrides()
+ {
+ if (mapKeyAttributeOverrides == null)
+ {
+ mapKeyAttributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES);
+ }
+ return mapKeyAttributeOverrides;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order 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>Order Column</em>' containment reference.
+ * @see #setOrderColumn(XmlOrderColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderable_2_0_OrderColumn()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlOrderColumn getOrderColumn()
+ {
+ return orderColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetOrderColumn(XmlOrderColumn newOrderColumn, NotificationChain msgs)
+ {
+ XmlOrderColumn oldOrderColumn = orderColumn;
+ orderColumn = newOrderColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN, oldOrderColumn, newOrderColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#getOrderColumn <em>Order Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Order Column</em>' containment reference.
+ * @see #getOrderColumn()
+ * @generated
+ */
+ public void setOrderColumn(XmlOrderColumn newOrderColumn)
+ {
+ if (newOrderColumn != orderColumn)
+ {
+ NotificationChain msgs = null;
+ if (orderColumn != null)
+ msgs = ((InternalEObject)orderColumn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN, null, msgs);
+ if (newOrderColumn != null)
+ msgs = ((InternalEObject)newOrderColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN, null, msgs);
+ msgs = basicSetOrderColumn(newOrderColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN, newOrderColumn, newOrderColumn));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_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.XML_ELEMENT_COLLECTION__MAP_KEY, oldMapKey, newMapKey);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#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.XML_ELEMENT_COLLECTION__MAP_KEY, null, msgs);
+ if (newMapKey != null)
+ msgs = ((InternalEObject)newMapKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY, null, msgs);
+ msgs = basicSetMapKey(newMapKey, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY, newMapKey, newMapKey));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Class</em>' containment reference.
+ * @see #setMapKeyClass(XmlClassReference)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_MapKeyClass()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlClassReference getMapKeyClass()
+ {
+ return mapKeyClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetMapKeyClass(XmlClassReference newMapKeyClass, NotificationChain msgs)
+ {
+ XmlClassReference oldMapKeyClass = mapKeyClass;
+ mapKeyClass = newMapKeyClass;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS, oldMapKeyClass, newMapKeyClass);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#getMapKeyClass <em>Map Key Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Class</em>' containment reference.
+ * @see #getMapKeyClass()
+ * @generated
+ */
+ public void setMapKeyClass(XmlClassReference newMapKeyClass)
+ {
+ if (newMapKeyClass != mapKeyClass)
+ {
+ NotificationChain msgs = null;
+ if (mapKeyClass != null)
+ msgs = ((InternalEObject)mapKeyClass).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS, null, msgs);
+ if (newMapKeyClass != null)
+ msgs = ((InternalEObject)newMapKeyClass).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS, null, msgs);
+ msgs = basicSetMapKeyClass(newMapKeyClass, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS, newMapKeyClass, newMapKeyClass));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #setMapKeyTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_MapKeyTemporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getMapKeyTemporal()
+ {
+ return mapKeyTemporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#getMapKeyTemporal <em>Map Key Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #getMapKeyTemporal()
+ * @generated
+ */
+ public void setMapKeyTemporal(TemporalType newMapKeyTemporal)
+ {
+ TemporalType oldMapKeyTemporal = mapKeyTemporal;
+ mapKeyTemporal = newMapKeyTemporal == null ? MAP_KEY_TEMPORAL_EDEFAULT : newMapKeyTemporal;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL, oldMapKeyTemporal, mapKeyTemporal));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #setMapKeyEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_MapKeyEnumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getMapKeyEnumerated()
+ {
+ return mapKeyEnumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#getMapKeyEnumerated <em>Map Key Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #getMapKeyEnumerated()
+ * @generated
+ */
+ public void setMapKeyEnumerated(EnumType newMapKeyEnumerated)
+ {
+ EnumType oldMapKeyEnumerated = mapKeyEnumerated;
+ mapKeyEnumerated = newMapKeyEnumerated == null ? MAP_KEY_ENUMERATED_EDEFAULT : newMapKeyEnumerated;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED, oldMapKeyEnumerated, mapKeyEnumerated));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Column</em>' containment reference.
+ * @see #setMapKeyColumn(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_MapKeyColumn()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlColumn getMapKeyColumn()
+ {
+ return mapKeyColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetMapKeyColumn(XmlColumn newMapKeyColumn, NotificationChain msgs)
+ {
+ XmlColumn oldMapKeyColumn = mapKeyColumn;
+ mapKeyColumn = newMapKeyColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN, oldMapKeyColumn, newMapKeyColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#getMapKeyColumn <em>Map Key Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Column</em>' containment reference.
+ * @see #getMapKeyColumn()
+ * @generated
+ */
+ public void setMapKeyColumn(XmlColumn newMapKeyColumn)
+ {
+ if (newMapKeyColumn != mapKeyColumn)
+ {
+ NotificationChain msgs = null;
+ if (mapKeyColumn != null)
+ msgs = ((InternalEObject)mapKeyColumn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN, null, msgs);
+ if (newMapKeyColumn != null)
+ msgs = ((InternalEObject)newMapKeyColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN, null, msgs);
+ msgs = basicSetMapKeyColumn(newMapKeyColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN, newMapKeyColumn, newMapKeyColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map 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>Map Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_MapKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJoinColumn> getMapKeyJoinColumns()
+ {
+ if (mapKeyJoinColumns == null)
+ {
+ mapKeyJoinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS);
+ }
+ return mapKeyJoinColumns;
+ }
+
+ /**
+ * 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(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_Column()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlColumn getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(XmlColumn newColumn, NotificationChain msgs)
+ {
+ XmlColumn oldColumn = column;
+ column = newColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__COLUMN, oldColumn, newColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#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(XmlColumn newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Collection Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Collection 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>Collection Table</em>' containment reference.
+ * @see #setCollectionTable(XmlCollectionTable)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlElementCollection_2_0_CollectionTable()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlCollectionTable getCollectionTable()
+ {
+ return collectionTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetCollectionTable(XmlCollectionTable newCollectionTable, NotificationChain msgs)
+ {
+ XmlCollectionTable oldCollectionTable = collectionTable;
+ collectionTable = newCollectionTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE, oldCollectionTable, newCollectionTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection#getCollectionTable <em>Collection Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Collection Table</em>' containment reference.
+ * @see #getCollectionTable()
+ * @generated
+ */
+ public void setCollectionTable(XmlCollectionTable newCollectionTable)
+ {
+ if (newCollectionTable != collectionTable)
+ {
+ NotificationChain msgs = null;
+ if (collectionTable != null)
+ msgs = ((InternalEObject)collectionTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE, null, msgs);
+ if (newCollectionTable != null)
+ msgs = ((InternalEObject)newCollectionTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE, null, msgs);
+ msgs = basicSetCollectionTable(newCollectionTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE, newCollectionTable, newCollectionTable));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN:
+ return basicSetOrderColumn(null, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getAttributeOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ return ((InternalEList<?>)getAssociationOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getMapKeyAttributeOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY:
+ return basicSetMapKey(null, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS:
+ return basicSetMapKeyClass(null, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN:
+ return basicSetMapKeyColumn(null, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS:
+ return ((InternalEList<?>)getMapKeyJoinColumns()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
+ return basicSetColumn(null, msgs);
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
+ return basicSetCollectionTable(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_ELEMENT_COLLECTION__LOB:
+ return isLob();
+ case OrmPackage.XML_ELEMENT_COLLECTION__TEMPORAL:
+ return getTemporal();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ENUMERATED:
+ return getEnumerated();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN:
+ return getOrderColumn();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
+ return getOrderBy();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ return getAttributeOverrides();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ return getAssociationOverrides();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ return getMapKeyAttributeOverrides();
+ case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS:
+ return getTargetClass();
+ case OrmPackage.XML_ELEMENT_COLLECTION__FETCH:
+ return getFetch();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY:
+ return getMapKey();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS:
+ return getMapKeyClass();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL:
+ return getMapKeyTemporal();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED:
+ return getMapKeyEnumerated();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN:
+ return getMapKeyColumn();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS:
+ return getMapKeyJoinColumns();
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
+ return getColumn();
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
+ return getCollectionTable();
+ }
+ 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_ELEMENT_COLLECTION__LOB:
+ setLob((Boolean)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__TEMPORAL:
+ setTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ENUMERATED:
+ setEnumerated((EnumType)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN:
+ setOrderColumn((XmlOrderColumn)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
+ setOrderBy((String)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ getAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ getAssociationOverrides().addAll((Collection<? extends XmlAssociationOverride>)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ getMapKeyAttributeOverrides().clear();
+ getMapKeyAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS:
+ setTargetClass((String)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY:
+ setMapKey((MapKey)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS:
+ setMapKeyClass((XmlClassReference)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL:
+ setMapKeyTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED:
+ setMapKeyEnumerated((EnumType)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN:
+ setMapKeyColumn((XmlColumn)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS:
+ getMapKeyJoinColumns().clear();
+ getMapKeyJoinColumns().addAll((Collection<? extends XmlJoinColumn>)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
+ setColumn((XmlColumn)newValue);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
+ setCollectionTable((XmlCollectionTable)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__LOB:
+ setLob(LOB_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__TEMPORAL:
+ setTemporal(TEMPORAL_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ENUMERATED:
+ setEnumerated(ENUMERATED_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN:
+ setOrderColumn((XmlOrderColumn)null);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
+ setOrderBy(ORDER_BY_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ getMapKeyAttributeOverrides().clear();
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS:
+ setTargetClass(TARGET_CLASS_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY:
+ setMapKey((MapKey)null);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS:
+ setMapKeyClass((XmlClassReference)null);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL:
+ setMapKeyTemporal(MAP_KEY_TEMPORAL_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED:
+ setMapKeyEnumerated(MAP_KEY_ENUMERATED_EDEFAULT);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN:
+ setMapKeyColumn((XmlColumn)null);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS:
+ getMapKeyJoinColumns().clear();
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
+ setColumn((XmlColumn)null);
+ return;
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
+ setCollectionTable((XmlCollectionTable)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__LOB:
+ return lob != LOB_EDEFAULT;
+ case OrmPackage.XML_ELEMENT_COLLECTION__TEMPORAL:
+ return temporal != TEMPORAL_EDEFAULT;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ENUMERATED:
+ return enumerated != ENUMERATED_EDEFAULT;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN:
+ return orderColumn != null;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY:
+ return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy);
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES:
+ return attributeOverrides != null && !attributeOverrides.isEmpty();
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES:
+ return associationOverrides != null && !associationOverrides.isEmpty();
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES:
+ return mapKeyAttributeOverrides != null && !mapKeyAttributeOverrides.isEmpty();
+ case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS:
+ return TARGET_CLASS_EDEFAULT == null ? targetClass != null : !TARGET_CLASS_EDEFAULT.equals(targetClass);
+ case OrmPackage.XML_ELEMENT_COLLECTION__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY:
+ return mapKey != null;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS:
+ return mapKeyClass != null;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL:
+ return mapKeyTemporal != MAP_KEY_TEMPORAL_EDEFAULT;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED:
+ return mapKeyEnumerated != MAP_KEY_ENUMERATED_EDEFAULT;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN:
+ return mapKeyColumn != null;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS:
+ return mapKeyJoinColumns != null && !mapKeyJoinColumns.isEmpty();
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN:
+ return column != null;
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE:
+ return collectionTable != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__LOB: return OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+ case OrmPackage.XML_ELEMENT_COLLECTION__TEMPORAL: return OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+ case OrmPackage.XML_ELEMENT_COLLECTION__ENUMERATED: return OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN: return OrmV2_0Package.XML_ORDERABLE_20__ORDER_COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY: return OrmPackage.XML_ORDERABLE__ORDER_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAttributeOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMapKeyAttributeOverrideContainer_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES: return OrmV2_0Package.XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlElementCollection_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__TARGET_CLASS;
+ case OrmPackage.XML_ELEMENT_COLLECTION__FETCH: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__FETCH;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN;
+ case OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS;
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLUMN: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLUMN;
+ case OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_TABLE: return OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLLECTION_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 == XmlConvertibleMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__LOB: return OrmPackage.XML_ELEMENT_COLLECTION__LOB;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL: return OrmPackage.XML_ELEMENT_COLLECTION__TEMPORAL;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED: return OrmPackage.XML_ELEMENT_COLLECTION__ENUMERATED;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ORDERABLE_20__ORDER_COLUMN: return OrmPackage.XML_ELEMENT_COLLECTION__ORDER_COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrderable.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ORDERABLE__ORDER_BY: return OrmPackage.XML_ELEMENT_COLLECTION__ORDER_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAttributeOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ELEMENT_COLLECTION__ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ELEMENT_COLLECTION__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlMapKeyAttributeOverrideContainer_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlElementCollection_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__TARGET_CLASS: return OrmPackage.XML_ELEMENT_COLLECTION__TARGET_CLASS;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__FETCH: return OrmPackage.XML_ELEMENT_COLLECTION__FETCH;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_CLASS;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_TEMPORAL;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_ENUMERATED;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_COLUMN;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS: return OrmPackage.XML_ELEMENT_COLLECTION__MAP_KEY_JOIN_COLUMNS;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLUMN: return OrmPackage.XML_ELEMENT_COLLECTION__COLUMN;
+ case OrmV2_0Package.XML_ELEMENT_COLLECTION_20__COLLECTION_TABLE: return OrmPackage.XML_ELEMENT_COLLECTION__COLLECTION_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(" (lob: ");
+ result.append(lob);
+ result.append(", temporal: ");
+ result.append(temporal);
+ result.append(", enumerated: ");
+ result.append(enumerated);
+ result.append(", orderBy: ");
+ result.append(orderBy);
+ result.append(", targetClass: ");
+ result.append(targetClass);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", mapKeyTemporal: ");
+ result.append(mapKeyTemporal);
+ result.append(", mapKeyEnumerated: ");
+ result.append(mapKeyEnumerated);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // **************** XmlAttributeMapping impl ******************************
+
+ public String getMappingKey() {
+ return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+
+ // **************** validation support ************************************
+
+ public TextRange getEnumeratedTextRange() {
+ return getAttributeTextRange(JPA2_0.ENUMERATED);
+ }
+
+ public TextRange getLobTextRange() {
+ return getAttributeTextRange(JPA2_0.LOB);
+ }
+
+ public TextRange getTemporalTextRange() {
+ return getAttributeTextRange(JPA2_0.TEMPORAL);
+ }
+
+ public TextRange getTargetClassTextRange() {
+ return getAttributeTextRange(JPA2_0.TARGET_CLASS);
+ }
+
+ // **************** translators *******************************************
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildTargetClassTranslator(),
+ buildFetchTranslator(),
+ buildAccessTranslator(),
+ buildOrderByTranslator(),
+ buildOrderColumnTranslator(),
+ buildMapKeyTranslator(),
+ buildMapKeyClassTranslator(),
+ buildMapKeyTemporalTranslator(),
+ buildMapKeyEnumeratedTranslator(),
+ buildMapKeyAttributeOverrideTranslator(),
+ XmlColumn.buildTranslator(JPA2_0.MAP_KEY_COLUMN, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyColumn()),
+ XmlJoinColumn.buildTranslator(JPA2_0.MAP_KEY_JOIN_COLUMN, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyJoinColumns()),
+ XmlColumn.buildTranslator(JPA.COLUMN, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_Column()),
+ buildTemporalTranslator(),
+ buildEnumeratedTranslator(),
+ buildLobTranslator(),
+ buildAttributeOverrideTranslator(),
+ buildAssociationOverrideTranslator(),
+ XmlCollectionTable.buildTranslator(JPA2_0.COLLECTION_TABLE, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_CollectionTable())
+ };
+ }
+
+ protected static Translator buildTargetClassTranslator() {
+ return new Translator(JPA2_0.TARGET_CLASS, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_TargetClass(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildFetchTranslator() {
+ return new Translator(JPA.FETCH, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_Fetch(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildOrderByTranslator() {
+ return new Translator(JPA.ORDER_BY, OrmPackage.eINSTANCE.getXmlOrderable_OrderBy());
+ }
+
+ protected static Translator buildOrderColumnTranslator() {
+ return XmlOrderColumn.buildTranslator(JPA2_0.ORDER_COLUMN, OrmV2_0Package.eINSTANCE.getXmlOrderable_2_0_OrderColumn());
+ }
+
+ protected static Translator buildColumnTranslator() {
+ return XmlColumn.buildTranslator(JPA.COLUMN, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_Column());
+ }
+
+ protected static Translator buildLobTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.LOB, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Lob());
+ }
+
+ protected static Translator buildTemporalTranslator() {
+ return new Translator(JPA.TEMPORAL, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Temporal());
+ }
+
+ protected static Translator buildEnumeratedTranslator() {
+ return new Translator(JPA.ENUMERATED, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Enumerated());
+ }
+
+ protected static Translator buildMapKeyTranslator() {
+ return MapKey.buildTranslator(JPA.MAP_KEY, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKey());
+ }
+
+ protected static Translator buildMapKeyClassTranslator() {
+ return XmlClassReference.buildTranslator(JPA2_0.MAP_KEY_CLASS, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyClass());
+ }
+
+ protected static Translator buildMapKeyTemporalTranslator() {
+ return new Translator(JPA2_0.MAP_KEY_TEMPORAL, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyTemporal());
+ }
+
+ protected static Translator buildMapKeyEnumeratedTranslator() {
+ return new Translator(JPA2_0.MAP_KEY_ENUMERATED, OrmV2_0Package.eINSTANCE.getXmlElementCollection_2_0_MapKeyEnumerated());
+ }
+
+ protected static Translator buildAttributeOverrideTranslator() {
+ return XmlAttributeOverride.buildTranslator(JPA.ATTRIBUTE_OVERRIDE, OrmPackage.eINSTANCE.getXmlAttributeOverrideContainer_AttributeOverrides());
+ }
+
+ protected static Translator buildAssociationOverrideTranslator() {
+ return XmlAssociationOverride.buildTranslator(JPA.ASSOCIATION_OVERRIDE, OrmPackage.eINSTANCE.getXmlAssociationOverrideContainer_AssociationOverrides());
+ }
+
+ protected static Translator buildMapKeyAttributeOverrideTranslator() {
+ return XmlAttributeOverride.buildTranslator(JPA2_0.MAP_KEY_ATTRIBUTE_OVERRIDE, OrmV2_0Package.eINSTANCE.getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides());
+ }
+
+
+ // ********** refactoring **********
+
+ public ReplaceEdit createRenameTargetClassEdit(IType originalType, String newName) {
+ String originalName = originalType.getElementName();
+ int nameIndex = this.targetClass.lastIndexOf(originalName);
+ int offset = getAttributeNode(JPA2_0.TARGET_CLASS).getValueRegionStartOffset() + 1;
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createRenameMapKeyClassEdit(IType originalType, String newName) {
+ return getMapKeyClass().createRenameEdit(originalType, newName);
+ }
+
+ public ReplaceEdit createRenameTargetClassPackageEdit(String newName) {
+ int packageLength = this.targetClass.lastIndexOf('.');
+ int offset = getAttributeNode(JPA2_0.TARGET_CLASS).getValueRegionStartOffset() + 1; // +1 = opening double quote
+ return new ReplaceEdit(offset, packageLength, newName);
+ }
+
+ public ReplaceEdit createRenameMapKeyClassPackageEdit(String newName) {
+ return getMapKeyClass().createRenamePackageEdit(newName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddable.java
new file mode 100644
index 0000000000..d5068865a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddable.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Embeddable</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbeddable()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlEmbeddable extends AbstractXmlTypeMapping
+{
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlEmbeddable()
+ {
+ super();
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+ public XmlEntityMappings getEntityMappings() {
+ return (XmlEntityMappings) eContainer();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_EMBEDDABLE;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildClassTranslator(),
+ buildAccessTranslator(),
+ buildMetadataCompleteTranslator(),
+ buildDescriptionTranslator(),
+ buildAttributesTranslator()
+ };
+ }
+
+ protected static Translator buildAccessTranslator() {
+ return new Translator(JPA.ACCESS, OrmPackage.eINSTANCE.getXmlAccessHolder_Access(), Translator.DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbedded.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbedded.java
new file mode 100644
index 0000000000..486eb8e4a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbedded.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEmbedded_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Embedded</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbedded()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlEmbedded extends AbstractXmlEmbedded implements XmlEmbedded_2_0
+{
+ /**
+ * 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<XmlAssociationOverride> associationOverrides;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlEmbedded()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_EMBEDDED;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Association Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer_AssociationOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAssociationOverride> getAssociationOverrides()
+ {
+ if (associationOverrides == null)
+ {
+ associationOverrides = new EObjectContainmentEList<XmlAssociationOverride>(XmlAssociationOverride.class, this, OrmPackage.XML_EMBEDDED__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.XML_EMBEDDED__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.XML_EMBEDDED__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.XML_EMBEDDED__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ getAssociationOverrides().addAll((Collection<? extends XmlAssociationOverride>)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__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.XML_EMBEDDED__ASSOCIATION_OVERRIDES:
+ return associationOverrides != null && !associationOverrides.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlAssociationOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_EMBEDDED__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlEmbedded_2_0.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 == XmlAssociationOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES: return OrmPackage.XML_EMBEDDED__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlEmbedded_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildAccessTranslator(),
+ buildAttributeOverrideTranslator(),
+ buildAssociationOverrideTranslator()
+ };
+ }
+
+ protected static Translator buildAssociationOverrideTranslator() {
+ return XmlAssociationOverride.buildTranslator(JPA.ASSOCIATION_OVERRIDE, OrmPackage.eINSTANCE.getXmlAssociationOverrideContainer_AssociationOverrides());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddedId.java
new file mode 100644
index 0000000000..865eea2dab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddedId.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Embedded Id</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEmbeddedId()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlEmbeddedId extends AbstractXmlEmbedded
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlEmbeddedId()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_EMBEDDED_ID;
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildAccessTranslator(),
+ buildAttributeOverrideTranslator()
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntity.java
new file mode 100644
index 0000000000..7836b2a1eb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntity.java
@@ -0,0 +1,2312 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.EmptyTagBooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntity_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getTable <em>Table</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getSecondaryTables <em>Secondary Tables</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getInheritance <em>Inheritance</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getDiscriminatorValue <em>Discriminator Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getDiscriminatorColumn <em>Discriminator Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getSqlResultSetMappings <em>Sql Result Set Mappings</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getEntityListeners <em>Entity Listeners</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntity()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlEntity extends AbstractXmlTypeMapping implements XmlQueryContainer, XmlGeneratorContainer, XmlEventMethodContainer, XmlAttributeOverrideContainer, XmlAssociationOverrideContainer, XmlEntity_2_0, XmlIdClassContainer
+{
+
+ /**
+ * 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;
+
+ /**
+ * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSequenceGenerator()
+ * @generated
+ * @ordered
+ */
+ protected XmlSequenceGenerator 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 XmlTableGenerator tableGenerator;
+
+ /**
+ * 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<XmlAttributeOverride> 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<XmlAssociationOverride> associationOverrides;
+
+ /**
+ * The default value of the '{@link #getCacheable() <em>Cacheable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCacheable()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean CACHEABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCacheable() <em>Cacheable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCacheable()
+ * @generated
+ * @ordered
+ */
+ protected Boolean cacheable = CACHEABLE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIdClass()
+ * @generated
+ * @ordered
+ */
+ protected XmlClassReference idClass;
+
+ /**
+ * 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 XmlTable 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<XmlSecondaryTable> 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<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns;
+
+ /**
+ * 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 XmlDiscriminatorColumn discriminatorColumn;
+
+ /**
+ * 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlEntity()
+ {
+ super();
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ public XmlEntityMappings entityMappings() {
+ return (XmlEntityMappings) eContainer();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntity_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.jpa.core.resource.orm.XmlEntity#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_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(XmlTable)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntity_Table()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlTable getTable()
+ {
+ return table;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTable(XmlTable newTable, NotificationChain msgs)
+ {
+ XmlTable oldTable = table;
+ table = newTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY__TABLE, oldTable, newTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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(XmlTable newTable)
+ {
+ if (newTable != table)
+ {
+ NotificationChain msgs = null;
+ if (table != null)
+ msgs = ((InternalEObject)table).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__TABLE, null, msgs);
+ if (newTable != null)
+ msgs = ((InternalEObject)newTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__TABLE, null, msgs);
+ msgs = basicSetTable(newTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlSecondaryTable}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlEntity_SecondaryTables()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlSecondaryTable> getSecondaryTables()
+ {
+ if (secondaryTables == null)
+ {
+ secondaryTables = new EObjectContainmentEList<XmlSecondaryTable>(XmlSecondaryTable.class, this, OrmPackage.XML_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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlEntity_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns()
+ {
+ if (primaryKeyJoinColumns == null)
+ {
+ primaryKeyJoinColumns = new EObjectContainmentEList<XmlPrimaryKeyJoinColumn>(XmlPrimaryKeyJoinColumn.class, this, OrmPackage.XML_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(XmlClassReference)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlIdClassContainer_IdClass()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlClassReference getIdClass()
+ {
+ return idClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetIdClass(XmlClassReference newIdClass, NotificationChain msgs)
+ {
+ XmlClassReference oldIdClass = idClass;
+ idClass = newIdClass;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlEntity#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(XmlClassReference newIdClass)
+ {
+ if (newIdClass != idClass)
+ {
+ NotificationChain msgs = null;
+ if (idClass != null)
+ msgs = ((InternalEObject)idClass).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__ID_CLASS, null, msgs);
+ if (newIdClass != null)
+ msgs = ((InternalEObject)newIdClass).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__ID_CLASS, null, msgs);
+ msgs = basicSetIdClass(newIdClass, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntity_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.XML_ENTITY__INHERITANCE, oldInheritance, newInheritance);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__INHERITANCE, null, msgs);
+ if (newInheritance != null)
+ msgs = ((InternalEObject)newInheritance).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__INHERITANCE, null, msgs);
+ msgs = basicSetInheritance(newInheritance, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntity_DiscriminatorValue()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getDiscriminatorValue()
+ {
+ return discriminatorValue;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#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.XML_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(XmlDiscriminatorColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntity_DiscriminatorColumn()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlDiscriminatorColumn getDiscriminatorColumn()
+ {
+ return discriminatorColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetDiscriminatorColumn(XmlDiscriminatorColumn newDiscriminatorColumn, NotificationChain msgs)
+ {
+ XmlDiscriminatorColumn oldDiscriminatorColumn = discriminatorColumn;
+ discriminatorColumn = newDiscriminatorColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlEntity#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(XmlDiscriminatorColumn newDiscriminatorColumn)
+ {
+ if (newDiscriminatorColumn != discriminatorColumn)
+ {
+ NotificationChain msgs = null;
+ if (discriminatorColumn != null)
+ msgs = ((InternalEObject)discriminatorColumn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__DISCRIMINATOR_COLUMN, null, msgs);
+ if (newDiscriminatorColumn != null)
+ msgs = ((InternalEObject)newDiscriminatorColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__DISCRIMINATOR_COLUMN, null, msgs);
+ msgs = basicSetDiscriminatorColumn(newDiscriminatorColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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(XmlSequenceGenerator)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer_SequenceGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlSequenceGenerator getSequenceGenerator()
+ {
+ return sequenceGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSequenceGenerator(XmlSequenceGenerator newSequenceGenerator, NotificationChain msgs)
+ {
+ XmlSequenceGenerator oldSequenceGenerator = sequenceGenerator;
+ sequenceGenerator = newSequenceGenerator;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlEntity#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(XmlSequenceGenerator newSequenceGenerator)
+ {
+ if (newSequenceGenerator != sequenceGenerator)
+ {
+ NotificationChain msgs = null;
+ if (sequenceGenerator != null)
+ msgs = ((InternalEObject)sequenceGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR, null, msgs);
+ if (newSequenceGenerator != null)
+ msgs = ((InternalEObject)newSequenceGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__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__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(XmlTableGenerator)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer_TableGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlTableGenerator getTableGenerator()
+ {
+ return tableGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTableGenerator(XmlTableGenerator newTableGenerator, NotificationChain msgs)
+ {
+ XmlTableGenerator oldTableGenerator = tableGenerator;
+ tableGenerator = newTableGenerator;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlEntity#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(XmlTableGenerator newTableGenerator)
+ {
+ if (newTableGenerator != tableGenerator)
+ {
+ NotificationChain msgs = null;
+ if (tableGenerator != null)
+ msgs = ((InternalEObject)tableGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__TABLE_GENERATOR, null, msgs);
+ if (newTableGenerator != null)
+ msgs = ((InternalEObject)newTableGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__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__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.jpa.core.resource.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.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer_NamedQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlNamedQuery> getNamedQueries()
+ {
+ if (namedQueries == null)
+ {
+ namedQueries = new EObjectContainmentEList<XmlNamedQuery>(XmlNamedQuery.class, this, OrmPackage.XML_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.jpa.core.resource.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.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer_NamedNativeQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlNamedNativeQuery> getNamedNativeQueries()
+ {
+ if (namedNativeQueries == null)
+ {
+ namedNativeQueries = new EObjectContainmentEList<XmlNamedNativeQuery>(XmlNamedNativeQuery.class, this, OrmPackage.XML_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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEntity_SqlResultSetMappings()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<SqlResultSetMapping> getSqlResultSetMappings()
+ {
+ if (sqlResultSetMappings == null)
+ {
+ sqlResultSetMappings = new EObjectContainmentEList<SqlResultSetMapping>(SqlResultSetMapping.class, this, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntity_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.jpa.core.resource.orm.XmlEntity#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntity_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.jpa.core.resource.orm.XmlEntity#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntity_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__ENTITY_LISTENERS, null, msgs);
+ if (newEntityListeners != null)
+ msgs = ((InternalEObject)newEntityListeners).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__ENTITY_LISTENERS, null, msgs);
+ msgs = basicSetEntityListeners(newEntityListeners, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__PRE_PERSIST, null, msgs);
+ if (newPrePersist != null)
+ msgs = ((InternalEObject)newPrePersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__PRE_PERSIST, null, msgs);
+ msgs = basicSetPrePersist(newPrePersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__POST_PERSIST, null, msgs);
+ if (newPostPersist != null)
+ msgs = ((InternalEObject)newPostPersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__POST_PERSIST, null, msgs);
+ msgs = basicSetPostPersist(newPostPersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__PRE_REMOVE, null, msgs);
+ if (newPreRemove != null)
+ msgs = ((InternalEObject)newPreRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__PRE_REMOVE, null, msgs);
+ msgs = basicSetPreRemove(newPreRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__POST_REMOVE, null, msgs);
+ if (newPostRemove != null)
+ msgs = ((InternalEObject)newPostRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__POST_REMOVE, null, msgs);
+ msgs = basicSetPostRemove(newPostRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__PRE_UPDATE, null, msgs);
+ if (newPreUpdate != null)
+ msgs = ((InternalEObject)newPreUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__PRE_UPDATE, null, msgs);
+ msgs = basicSetPreUpdate(newPreUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__POST_UPDATE, null, msgs);
+ if (newPostUpdate != null)
+ msgs = ((InternalEObject)newPostUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__POST_UPDATE, null, msgs);
+ msgs = basicSetPostUpdate(newPostUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_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.XML_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.jpa.core.resource.orm.XmlEntity#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.XML_ENTITY__POST_LOAD, null, msgs);
+ if (newPostLoad != null)
+ msgs = ((InternalEObject)newPostLoad).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY__POST_LOAD, null, msgs);
+ msgs = basicSetPostLoad(newPostLoad, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlAttributeOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAttributeOverrideContainer_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAttributeOverride> getAttributeOverrides()
+ {
+ if (attributeOverrides == null)
+ {
+ attributeOverrides = new EObjectContainmentEList<XmlAttributeOverride>(XmlAttributeOverride.class, this, OrmPackage.XML_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.jpa.core.resource.orm.XmlAssociationOverride}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlAssociationOverrideContainer_AssociationOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlAssociationOverride> getAssociationOverrides()
+ {
+ if (associationOverrides == null)
+ {
+ associationOverrides = new EObjectContainmentEList<XmlAssociationOverride>(XmlAssociationOverride.class, this, OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES);
+ }
+ return associationOverrides;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cacheable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cacheable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cacheable</em>' attribute.
+ * @see #setCacheable(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlCacheable_2_0_Cacheable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getCacheable()
+ {
+ return cacheable;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntity#getCacheable <em>Cacheable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cacheable</em>' attribute.
+ * @see #getCacheable()
+ * @generated
+ */
+ public void setCacheable(Boolean newCacheable)
+ {
+ Boolean oldCacheable = cacheable;
+ cacheable = newCacheable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY__CACHEABLE, oldCacheable, cacheable));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ENTITY__NAMED_QUERIES:
+ return ((InternalEList<?>)getNamedQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY__NAMED_NATIVE_QUERIES:
+ return ((InternalEList<?>)getNamedNativeQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR:
+ return basicSetSequenceGenerator(null, msgs);
+ case OrmPackage.XML_ENTITY__TABLE_GENERATOR:
+ return basicSetTableGenerator(null, msgs);
+ case OrmPackage.XML_ENTITY__PRE_PERSIST:
+ return basicSetPrePersist(null, msgs);
+ case OrmPackage.XML_ENTITY__POST_PERSIST:
+ return basicSetPostPersist(null, msgs);
+ case OrmPackage.XML_ENTITY__PRE_REMOVE:
+ return basicSetPreRemove(null, msgs);
+ case OrmPackage.XML_ENTITY__POST_REMOVE:
+ return basicSetPostRemove(null, msgs);
+ case OrmPackage.XML_ENTITY__PRE_UPDATE:
+ return basicSetPreUpdate(null, msgs);
+ case OrmPackage.XML_ENTITY__POST_UPDATE:
+ return basicSetPostUpdate(null, msgs);
+ case OrmPackage.XML_ENTITY__POST_LOAD:
+ return basicSetPostLoad(null, msgs);
+ case OrmPackage.XML_ENTITY__ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getAttributeOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES:
+ return ((InternalEList<?>)getAssociationOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY__ID_CLASS:
+ return basicSetIdClass(null, msgs);
+ case OrmPackage.XML_ENTITY__TABLE:
+ return basicSetTable(null, msgs);
+ case OrmPackage.XML_ENTITY__SECONDARY_TABLES:
+ return ((InternalEList<?>)getSecondaryTables()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ return ((InternalEList<?>)getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY__INHERITANCE:
+ return basicSetInheritance(null, msgs);
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_COLUMN:
+ return basicSetDiscriminatorColumn(null, msgs);
+ case OrmPackage.XML_ENTITY__SQL_RESULT_SET_MAPPINGS:
+ return ((InternalEList<?>)getSqlResultSetMappings()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY__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.XML_ENTITY__NAMED_QUERIES:
+ return getNamedQueries();
+ case OrmPackage.XML_ENTITY__NAMED_NATIVE_QUERIES:
+ return getNamedNativeQueries();
+ case OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR:
+ return getSequenceGenerator();
+ case OrmPackage.XML_ENTITY__TABLE_GENERATOR:
+ return getTableGenerator();
+ case OrmPackage.XML_ENTITY__PRE_PERSIST:
+ return getPrePersist();
+ case OrmPackage.XML_ENTITY__POST_PERSIST:
+ return getPostPersist();
+ case OrmPackage.XML_ENTITY__PRE_REMOVE:
+ return getPreRemove();
+ case OrmPackage.XML_ENTITY__POST_REMOVE:
+ return getPostRemove();
+ case OrmPackage.XML_ENTITY__PRE_UPDATE:
+ return getPreUpdate();
+ case OrmPackage.XML_ENTITY__POST_UPDATE:
+ return getPostUpdate();
+ case OrmPackage.XML_ENTITY__POST_LOAD:
+ return getPostLoad();
+ case OrmPackage.XML_ENTITY__ATTRIBUTE_OVERRIDES:
+ return getAttributeOverrides();
+ case OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES:
+ return getAssociationOverrides();
+ case OrmPackage.XML_ENTITY__CACHEABLE:
+ return getCacheable();
+ case OrmPackage.XML_ENTITY__ID_CLASS:
+ return getIdClass();
+ case OrmPackage.XML_ENTITY__NAME:
+ return getName();
+ case OrmPackage.XML_ENTITY__TABLE:
+ return getTable();
+ case OrmPackage.XML_ENTITY__SECONDARY_TABLES:
+ return getSecondaryTables();
+ case OrmPackage.XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ return getPrimaryKeyJoinColumns();
+ case OrmPackage.XML_ENTITY__INHERITANCE:
+ return getInheritance();
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_VALUE:
+ return getDiscriminatorValue();
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_COLUMN:
+ return getDiscriminatorColumn();
+ case OrmPackage.XML_ENTITY__SQL_RESULT_SET_MAPPINGS:
+ return getSqlResultSetMappings();
+ case OrmPackage.XML_ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ return isExcludeDefaultListeners();
+ case OrmPackage.XML_ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ return isExcludeSuperclassListeners();
+ case OrmPackage.XML_ENTITY__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.XML_ENTITY__NAMED_QUERIES:
+ getNamedQueries().clear();
+ getNamedQueries().addAll((Collection<? extends XmlNamedQuery>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ getNamedNativeQueries().addAll((Collection<? extends XmlNamedNativeQuery>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR:
+ setSequenceGenerator((XmlSequenceGenerator)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__TABLE_GENERATOR:
+ setTableGenerator((XmlTableGenerator)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__PRE_PERSIST:
+ setPrePersist((PrePersist)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__POST_PERSIST:
+ setPostPersist((PostPersist)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__PRE_REMOVE:
+ setPreRemove((PreRemove)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__POST_REMOVE:
+ setPostRemove((PostRemove)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__PRE_UPDATE:
+ setPreUpdate((PreUpdate)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__POST_UPDATE:
+ setPostUpdate((PostUpdate)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__POST_LOAD:
+ setPostLoad((PostLoad)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ getAttributeOverrides().addAll((Collection<? extends XmlAttributeOverride>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ getAssociationOverrides().addAll((Collection<? extends XmlAssociationOverride>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__CACHEABLE:
+ setCacheable((Boolean)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__ID_CLASS:
+ setIdClass((XmlClassReference)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__TABLE:
+ setTable((XmlTable)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__SECONDARY_TABLES:
+ getSecondaryTables().clear();
+ getSecondaryTables().addAll((Collection<? extends XmlSecondaryTable>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ getPrimaryKeyJoinColumns().addAll((Collection<? extends XmlPrimaryKeyJoinColumn>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__INHERITANCE:
+ setInheritance((Inheritance)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_VALUE:
+ setDiscriminatorValue((String)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_COLUMN:
+ setDiscriminatorColumn((XmlDiscriminatorColumn)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ getSqlResultSetMappings().addAll((Collection<? extends SqlResultSetMapping>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners((Boolean)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners((Boolean)newValue);
+ return;
+ case OrmPackage.XML_ENTITY__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.XML_ENTITY__NAMED_QUERIES:
+ getNamedQueries().clear();
+ return;
+ case OrmPackage.XML_ENTITY__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ return;
+ case OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR:
+ setSequenceGenerator((XmlSequenceGenerator)null);
+ return;
+ case OrmPackage.XML_ENTITY__TABLE_GENERATOR:
+ setTableGenerator((XmlTableGenerator)null);
+ return;
+ case OrmPackage.XML_ENTITY__PRE_PERSIST:
+ setPrePersist((PrePersist)null);
+ return;
+ case OrmPackage.XML_ENTITY__POST_PERSIST:
+ setPostPersist((PostPersist)null);
+ return;
+ case OrmPackage.XML_ENTITY__PRE_REMOVE:
+ setPreRemove((PreRemove)null);
+ return;
+ case OrmPackage.XML_ENTITY__POST_REMOVE:
+ setPostRemove((PostRemove)null);
+ return;
+ case OrmPackage.XML_ENTITY__PRE_UPDATE:
+ setPreUpdate((PreUpdate)null);
+ return;
+ case OrmPackage.XML_ENTITY__POST_UPDATE:
+ setPostUpdate((PostUpdate)null);
+ return;
+ case OrmPackage.XML_ENTITY__POST_LOAD:
+ setPostLoad((PostLoad)null);
+ return;
+ case OrmPackage.XML_ENTITY__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ return;
+ case OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ return;
+ case OrmPackage.XML_ENTITY__CACHEABLE:
+ setCacheable(CACHEABLE_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY__ID_CLASS:
+ setIdClass((XmlClassReference)null);
+ return;
+ case OrmPackage.XML_ENTITY__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY__TABLE:
+ setTable((XmlTable)null);
+ return;
+ case OrmPackage.XML_ENTITY__SECONDARY_TABLES:
+ getSecondaryTables().clear();
+ return;
+ case OrmPackage.XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ return;
+ case OrmPackage.XML_ENTITY__INHERITANCE:
+ setInheritance((Inheritance)null);
+ return;
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_VALUE:
+ setDiscriminatorValue(DISCRIMINATOR_VALUE_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_COLUMN:
+ setDiscriminatorColumn((XmlDiscriminatorColumn)null);
+ return;
+ case OrmPackage.XML_ENTITY__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ return;
+ case OrmPackage.XML_ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners(EXCLUDE_DEFAULT_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners(EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY__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.XML_ENTITY__NAMED_QUERIES:
+ return namedQueries != null && !namedQueries.isEmpty();
+ case OrmPackage.XML_ENTITY__NAMED_NATIVE_QUERIES:
+ return namedNativeQueries != null && !namedNativeQueries.isEmpty();
+ case OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR:
+ return sequenceGenerator != null;
+ case OrmPackage.XML_ENTITY__TABLE_GENERATOR:
+ return tableGenerator != null;
+ case OrmPackage.XML_ENTITY__PRE_PERSIST:
+ return prePersist != null;
+ case OrmPackage.XML_ENTITY__POST_PERSIST:
+ return postPersist != null;
+ case OrmPackage.XML_ENTITY__PRE_REMOVE:
+ return preRemove != null;
+ case OrmPackage.XML_ENTITY__POST_REMOVE:
+ return postRemove != null;
+ case OrmPackage.XML_ENTITY__PRE_UPDATE:
+ return preUpdate != null;
+ case OrmPackage.XML_ENTITY__POST_UPDATE:
+ return postUpdate != null;
+ case OrmPackage.XML_ENTITY__POST_LOAD:
+ return postLoad != null;
+ case OrmPackage.XML_ENTITY__ATTRIBUTE_OVERRIDES:
+ return attributeOverrides != null && !attributeOverrides.isEmpty();
+ case OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES:
+ return associationOverrides != null && !associationOverrides.isEmpty();
+ case OrmPackage.XML_ENTITY__CACHEABLE:
+ return CACHEABLE_EDEFAULT == null ? cacheable != null : !CACHEABLE_EDEFAULT.equals(cacheable);
+ case OrmPackage.XML_ENTITY__ID_CLASS:
+ return idClass != null;
+ case OrmPackage.XML_ENTITY__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_ENTITY__TABLE:
+ return table != null;
+ case OrmPackage.XML_ENTITY__SECONDARY_TABLES:
+ return secondaryTables != null && !secondaryTables.isEmpty();
+ case OrmPackage.XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ return primaryKeyJoinColumns != null && !primaryKeyJoinColumns.isEmpty();
+ case OrmPackage.XML_ENTITY__INHERITANCE:
+ return inheritance != null;
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_VALUE:
+ return DISCRIMINATOR_VALUE_EDEFAULT == null ? discriminatorValue != null : !DISCRIMINATOR_VALUE_EDEFAULT.equals(discriminatorValue);
+ case OrmPackage.XML_ENTITY__DISCRIMINATOR_COLUMN:
+ return discriminatorColumn != null;
+ case OrmPackage.XML_ENTITY__SQL_RESULT_SET_MAPPINGS:
+ return sqlResultSetMappings != null && !sqlResultSetMappings.isEmpty();
+ case OrmPackage.XML_ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ return excludeDefaultListeners != EXCLUDE_DEFAULT_LISTENERS_EDEFAULT;
+ case OrmPackage.XML_ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ return excludeSuperclassListeners != EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT;
+ case OrmPackage.XML_ENTITY__ENTITY_LISTENERS:
+ return entityListeners != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlQueryContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY__NAMED_QUERIES: return OrmPackage.XML_QUERY_CONTAINER__NAMED_QUERIES;
+ case OrmPackage.XML_ENTITY__NAMED_NATIVE_QUERIES: return OrmPackage.XML_QUERY_CONTAINER__NAMED_NATIVE_QUERIES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlGeneratorContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR: return OrmPackage.XML_GENERATOR_CONTAINER__SEQUENCE_GENERATOR;
+ case OrmPackage.XML_ENTITY__TABLE_GENERATOR: return OrmPackage.XML_GENERATOR_CONTAINER__TABLE_GENERATOR;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlEventMethodContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY__PRE_PERSIST: return OrmPackage.XML_EVENT_METHOD_CONTAINER__PRE_PERSIST;
+ case OrmPackage.XML_ENTITY__POST_PERSIST: return OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_PERSIST;
+ case OrmPackage.XML_ENTITY__PRE_REMOVE: return OrmPackage.XML_EVENT_METHOD_CONTAINER__PRE_REMOVE;
+ case OrmPackage.XML_ENTITY__POST_REMOVE: return OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_REMOVE;
+ case OrmPackage.XML_ENTITY__PRE_UPDATE: return OrmPackage.XML_EVENT_METHOD_CONTAINER__PRE_UPDATE;
+ case OrmPackage.XML_ENTITY__POST_UPDATE: return OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_UPDATE;
+ case OrmPackage.XML_ENTITY__POST_LOAD: return OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_LOAD;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAttributeOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverrideContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlCacheable_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY__CACHEABLE: return OrmV2_0Package.XML_CACHEABLE_20__CACHEABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlEntity_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlIdClassContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY__ID_CLASS: return OrmPackage.XML_ID_CLASS_CONTAINER__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 == XmlQueryContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_QUERY_CONTAINER__NAMED_QUERIES: return OrmPackage.XML_ENTITY__NAMED_QUERIES;
+ case OrmPackage.XML_QUERY_CONTAINER__NAMED_NATIVE_QUERIES: return OrmPackage.XML_ENTITY__NAMED_NATIVE_QUERIES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlGeneratorContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_GENERATOR_CONTAINER__SEQUENCE_GENERATOR: return OrmPackage.XML_ENTITY__SEQUENCE_GENERATOR;
+ case OrmPackage.XML_GENERATOR_CONTAINER__TABLE_GENERATOR: return OrmPackage.XML_ENTITY__TABLE_GENERATOR;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlEventMethodContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_EVENT_METHOD_CONTAINER__PRE_PERSIST: return OrmPackage.XML_ENTITY__PRE_PERSIST;
+ case OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_PERSIST: return OrmPackage.XML_ENTITY__POST_PERSIST;
+ case OrmPackage.XML_EVENT_METHOD_CONTAINER__PRE_REMOVE: return OrmPackage.XML_ENTITY__PRE_REMOVE;
+ case OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_REMOVE: return OrmPackage.XML_ENTITY__POST_REMOVE;
+ case OrmPackage.XML_EVENT_METHOD_CONTAINER__PRE_UPDATE: return OrmPackage.XML_ENTITY__PRE_UPDATE;
+ case OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_UPDATE: return OrmPackage.XML_ENTITY__POST_UPDATE;
+ case OrmPackage.XML_EVENT_METHOD_CONTAINER__POST_LOAD: return OrmPackage.XML_ENTITY__POST_LOAD;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAttributeOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ATTRIBUTE_OVERRIDE_CONTAINER__ATTRIBUTE_OVERRIDES: return OrmPackage.XML_ENTITY__ATTRIBUTE_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAssociationOverrideContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES: return OrmPackage.XML_ENTITY__ASSOCIATION_OVERRIDES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlCacheable_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_CACHEABLE_20__CACHEABLE: return OrmPackage.XML_ENTITY__CACHEABLE;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlEntity_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlIdClassContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ID_CLASS_CONTAINER__ID_CLASS: return OrmPackage.XML_ENTITY__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(" (cacheable: ");
+ result.append(cacheable);
+ 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();
+ }
+
+ public TextRange getDiscriminatorValueTextRange() {
+ return getElementTextRange(JPA.DISCRIMINATOR_VALUE);
+ }
+
+ public TextRange getInheritanceStrategyTextRange() {
+ return getInheritance() != null ? getInheritance().getStrategyTextRange() : getValidationTextRange();
+ }
+
+ public TextRange getCacheableTextRange() {
+ return getAttributeTextRange(JPA2_0.CACHEABLE);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildClassTranslator(),
+ buildAccessTranslator(),
+ buildCacheableTranslator(),
+ buildMetadataCompleteTranslator(),
+ buildDescriptionTranslator(),
+ buildTableTranslator(),
+ buildSecondaryTableTranslator(),
+ buildPrimaryKeyJoinColumnTranslator(),
+ buildIdClassTranslator(),
+ buildInheritanceTranslator(),
+ buildDiscriminatorValueTranslator(),
+ buildDiscriminatorColumnTranslator(),
+ buildSequenceGeneratorTranslator(),
+ buildTableGeneratorTranslator(),
+ buildNamedQueryTranslator(),
+ buildNamedNativeQueryTranslator(),
+ buildSqlResultSetMappingTranslator(),
+ buildExcludeDefaultListenersTranslator(),
+ buildExcludeSuperclassListenersTranslator(),
+ buildEntityListenersTranslator(),
+ PrePersist.buildTranslator(),
+ PostPersist.buildTranslator(),
+ PreRemove.buildTranslator(),
+ PostRemove.buildTranslator(),
+ PreUpdate.buildTranslator(),
+ PostUpdate.buildTranslator(),
+ PostLoad.buildTranslator(),
+ buildAttributeOverrideTranslator(),
+ buildAssociationOverrideTranslator(),
+ Attributes.buildTranslator()
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlEntity_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildAccessTranslator() {
+ return new Translator(JPA.ACCESS, OrmPackage.eINSTANCE.getXmlAccessHolder_Access(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildCacheableTranslator() {
+ return new Translator(JPA2_0.CACHEABLE, OrmV2_0Package.eINSTANCE.getXmlCacheable_2_0_Cacheable(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildTableTranslator() {
+ return XmlTable.buildTranslator(JPA.TABLE, OrmPackage.eINSTANCE.getXmlEntity_Table());
+ }
+
+ protected static Translator buildSecondaryTableTranslator() {
+ return XmlSecondaryTable.buildTranslator(JPA.SECONDARY_TABLE, OrmPackage.eINSTANCE.getXmlEntity_SecondaryTables());
+ }
+
+ protected static Translator buildPrimaryKeyJoinColumnTranslator() {
+ return XmlPrimaryKeyJoinColumn.buildTranslator(JPA.PRIMARY_KEY_JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlEntity_PrimaryKeyJoinColumns());
+ }
+
+ protected static Translator buildIdClassTranslator() {
+ return XmlClassReference.buildTranslator(JPA.ID_CLASS, OrmPackage.eINSTANCE.getXmlIdClassContainer_IdClass());
+ }
+
+ protected static Translator buildInheritanceTranslator() {
+ return Inheritance.buildTranslator(JPA.INHERITANCE, OrmPackage.eINSTANCE.getXmlEntity_Inheritance());
+ }
+
+ protected static Translator buildDiscriminatorValueTranslator() {
+ return new Translator(JPA.DISCRIMINATOR_VALUE, OrmPackage.eINSTANCE.getXmlEntity_DiscriminatorValue());
+ }
+
+ protected static Translator buildDiscriminatorColumnTranslator() {
+ return XmlDiscriminatorColumn.buildTranslator(JPA.DISCRIMINATOR_COLUMN, OrmPackage.eINSTANCE.getXmlEntity_DiscriminatorColumn());
+ }
+
+ protected static Translator buildSequenceGeneratorTranslator() {
+ return XmlSequenceGenerator.buildTranslator(JPA.SEQUENCE_GENERATOR, OrmPackage.eINSTANCE.getXmlGeneratorContainer_SequenceGenerator());
+ }
+
+ protected static Translator buildTableGeneratorTranslator() {
+ return XmlTableGenerator.buildTranslator(JPA.TABLE_GENERATOR, OrmPackage.eINSTANCE.getXmlGeneratorContainer_TableGenerator());
+ }
+
+ protected static Translator buildNamedQueryTranslator() {
+ return XmlNamedQuery.buildTranslator(JPA.NAMED_QUERY, OrmPackage.eINSTANCE.getXmlQueryContainer_NamedQueries());
+ }
+
+ protected static Translator buildNamedNativeQueryTranslator() {
+ return XmlNamedNativeQuery.buildTranslator(JPA.NAMED_NATIVE_QUERY, OrmPackage.eINSTANCE.getXmlQueryContainer_NamedNativeQueries());
+ }
+
+ protected static Translator buildSqlResultSetMappingTranslator() {
+ return SqlResultSetMapping.buildTranslator(JPA.SQL_RESULT_SET_MAPPING, OrmPackage.eINSTANCE.getXmlEntity_SqlResultSetMappings());
+ }
+
+ protected static Translator buildExcludeDefaultListenersTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.EXCLUDE_DEFAULT_LISTENERS, OrmPackage.eINSTANCE.getXmlEntity_ExcludeDefaultListeners());
+ }
+
+ protected static Translator buildExcludeSuperclassListenersTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.EXCLUDE_SUPERCLASS_LISTENERS, OrmPackage.eINSTANCE.getXmlEntity_ExcludeSuperclassListeners());
+ }
+
+ protected static Translator buildEntityListenersTranslator() {
+ return EntityListeners.buildTranslator(JPA.ENTITY_LISTENERS, OrmPackage.eINSTANCE.getXmlEntity_EntityListeners());
+ }
+
+ protected static Translator buildPrePersistTranslator() {
+ return PrePersist.buildTranslator();
+ }
+
+ protected static Translator buildPostPersistTranslator() {
+ return PostPersist.buildTranslator();
+ }
+
+ protected static Translator buildPreRemoveTranslator() {
+ return PreRemove.buildTranslator();
+ }
+
+ protected static Translator buildPostRemoveTranslator() {
+ return PostRemove.buildTranslator();
+ }
+
+ protected static Translator buildPreUpdateTranslator() {
+ return PreUpdate.buildTranslator();
+ }
+
+ protected static Translator buildPostUpdateTranslator() {
+ return PostUpdate.buildTranslator();
+ }
+
+ protected static Translator buildPostLoadTranslator() {
+ return PostLoad.buildTranslator();
+ }
+
+ protected static Translator buildAttributeOverrideTranslator() {
+ return XmlAttributeOverride.buildTranslator(JPA.ATTRIBUTE_OVERRIDE, OrmPackage.eINSTANCE.getXmlAttributeOverrideContainer_AttributeOverrides());
+ }
+
+ protected static Translator buildAssociationOverrideTranslator() {
+ return XmlAssociationOverride.buildTranslator(JPA.ASSOCIATION_OVERRIDE, OrmPackage.eINSTANCE.getXmlAssociationOverrideContainer_AssociationOverrides());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java
new file mode 100644
index 0000000000..ed2510b5b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java
@@ -0,0 +1,1118 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+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.common.core.internal.utility.translators.SimpleRootTranslator;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Mappings</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getPersistenceUnitMetadata <em>Persistence Unit Metadata</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getPackage <em>Package</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getSequenceGenerators <em>Sequence Generators</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getTableGenerators <em>Table Generators</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getSqlResultSetMappings <em>Sql Result Set Mappings</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getMappedSuperclasses <em>Mapped Superclasses</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getEntities <em>Entities</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#getEmbeddables <em>Embeddables</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlEntityMappings extends AbstractJpaRootEObject implements XmlQueryContainer, XmlAccessHolder
+{
+ /**
+ * 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;
+
+ /**
+ * 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 #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 XmlPersistenceUnitMetadata 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;
+
+ /**
+ * 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 #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<XmlMappedSuperclass> 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<XmlEntity> 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<XmlEmbeddable> embeddables;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlEntityMappings()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_ENTITY_MAPPINGS;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer_NamedQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlNamedQuery> getNamedQueries()
+ {
+ if (namedQueries == null)
+ {
+ namedQueries = new EObjectContainmentEList<XmlNamedQuery>(XmlNamedQuery.class, this, OrmPackage.XML_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.jpa.core.resource.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.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer_NamedNativeQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlNamedNativeQuery> getNamedNativeQueries()
+ {
+ if (namedNativeQueries == null)
+ {
+ namedNativeQueries = new EObjectContainmentEList<XmlNamedNativeQuery>(XmlNamedNativeQuery.class, this, OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES);
+ }
+ return namedNativeQueries;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_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.jpa.core.resource.orm.XmlEntityMappings#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.XML_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(XmlPersistenceUnitMetadata)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_PersistenceUnitMetadata()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlPersistenceUnitMetadata getPersistenceUnitMetadata()
+ {
+ return persistenceUnitMetadata;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPersistenceUnitMetadata(XmlPersistenceUnitMetadata newPersistenceUnitMetadata, NotificationChain msgs)
+ {
+ XmlPersistenceUnitMetadata oldPersistenceUnitMetadata = persistenceUnitMetadata;
+ persistenceUnitMetadata = newPersistenceUnitMetadata;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlEntityMappings#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(XmlPersistenceUnitMetadata newPersistenceUnitMetadata)
+ {
+ if (newPersistenceUnitMetadata != persistenceUnitMetadata)
+ {
+ NotificationChain msgs = null;
+ if (persistenceUnitMetadata != null)
+ msgs = ((InternalEObject)persistenceUnitMetadata).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA, null, msgs);
+ if (newPersistenceUnitMetadata != null)
+ msgs = ((InternalEObject)newPersistenceUnitMetadata).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_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.jpa.core.resource.orm.XmlEntityMappings#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_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.jpa.core.resource.orm.XmlEntityMappings#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_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.jpa.core.resource.orm.XmlEntityMappings#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.XML_ENTITY_MAPPINGS__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder_Access()
+ * @model
+ * @generated
+ */
+ public AccessType getAccess()
+ {
+ return access;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings#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.jpa.core.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.XML_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.jpa.core.resource.orm.XmlSequenceGenerator}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_SequenceGenerators()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlSequenceGenerator> getSequenceGenerators()
+ {
+ if (sequenceGenerators == null)
+ {
+ sequenceGenerators = new EObjectContainmentEList<XmlSequenceGenerator>(XmlSequenceGenerator.class, this, OrmPackage.XML_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.jpa.core.resource.orm.XmlTableGenerator}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_TableGenerators()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlTableGenerator> getTableGenerators()
+ {
+ if (tableGenerators == null)
+ {
+ tableGenerators = new EObjectContainmentEList<XmlTableGenerator>(XmlTableGenerator.class, this, OrmPackage.XML_ENTITY_MAPPINGS__TABLE_GENERATORS);
+ }
+ return tableGenerators;
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_SqlResultSetMappings()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<SqlResultSetMapping> getSqlResultSetMappings()
+ {
+ if (sqlResultSetMappings == null)
+ {
+ sqlResultSetMappings = new EObjectContainmentEList<SqlResultSetMapping>(SqlResultSetMapping.class, this, OrmPackage.XML_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.jpa.core.resource.orm.XmlMappedSuperclass}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_MappedSuperclasses()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlMappedSuperclass> getMappedSuperclasses()
+ {
+ if (mappedSuperclasses == null)
+ {
+ mappedSuperclasses = new EObjectContainmentEList<XmlMappedSuperclass>(XmlMappedSuperclass.class, this, OrmPackage.XML_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.jpa.core.resource.orm.XmlEntity}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_Entities()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlEntity> getEntities()
+ {
+ if (entities == null)
+ {
+ entities = new EObjectContainmentEList<XmlEntity>(XmlEntity.class, this, OrmPackage.XML_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.jpa.core.resource.orm.XmlEmbeddable}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlEntityMappings_Embeddables()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlEmbeddable> getEmbeddables()
+ {
+ if (embeddables == null)
+ {
+ embeddables = new EObjectContainmentEList<XmlEmbeddable>(XmlEmbeddable.class, this, OrmPackage.XML_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.XML_ENTITY_MAPPINGS__NAMED_QUERIES:
+ return ((InternalEList<?>)getNamedQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ return ((InternalEList<?>)getNamedNativeQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ return basicSetPersistenceUnitMetadata(null, msgs);
+ case OrmPackage.XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ return ((InternalEList<?>)getSequenceGenerators()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY_MAPPINGS__TABLE_GENERATORS:
+ return ((InternalEList<?>)getTableGenerators()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ return ((InternalEList<?>)getSqlResultSetMappings()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ return ((InternalEList<?>)getMappedSuperclasses()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_ENTITY_MAPPINGS__ENTITIES:
+ return ((InternalEList<?>)getEntities()).basicRemove(otherEnd, msgs);
+ case OrmPackage.XML_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.XML_ENTITY_MAPPINGS__NAMED_QUERIES:
+ return getNamedQueries();
+ case OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ return getNamedNativeQueries();
+ case OrmPackage.XML_ENTITY_MAPPINGS__ACCESS:
+ return getAccess();
+ case OrmPackage.XML_ENTITY_MAPPINGS__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ return getPersistenceUnitMetadata();
+ case OrmPackage.XML_ENTITY_MAPPINGS__PACKAGE:
+ return getPackage();
+ case OrmPackage.XML_ENTITY_MAPPINGS__SCHEMA:
+ return getSchema();
+ case OrmPackage.XML_ENTITY_MAPPINGS__CATALOG:
+ return getCatalog();
+ case OrmPackage.XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ return getSequenceGenerators();
+ case OrmPackage.XML_ENTITY_MAPPINGS__TABLE_GENERATORS:
+ return getTableGenerators();
+ case OrmPackage.XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ return getSqlResultSetMappings();
+ case OrmPackage.XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ return getMappedSuperclasses();
+ case OrmPackage.XML_ENTITY_MAPPINGS__ENTITIES:
+ return getEntities();
+ case OrmPackage.XML_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.XML_ENTITY_MAPPINGS__NAMED_QUERIES:
+ getNamedQueries().clear();
+ getNamedQueries().addAll((Collection<? extends XmlNamedQuery>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ getNamedNativeQueries().addAll((Collection<? extends XmlNamedNativeQuery>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__ACCESS:
+ setAccess((AccessType)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ setPersistenceUnitMetadata((XmlPersistenceUnitMetadata)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__PACKAGE:
+ setPackage((String)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ getSequenceGenerators().clear();
+ getSequenceGenerators().addAll((Collection<? extends XmlSequenceGenerator>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__TABLE_GENERATORS:
+ getTableGenerators().clear();
+ getTableGenerators().addAll((Collection<? extends XmlTableGenerator>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ getSqlResultSetMappings().addAll((Collection<? extends SqlResultSetMapping>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ getMappedSuperclasses().clear();
+ getMappedSuperclasses().addAll((Collection<? extends XmlMappedSuperclass>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__ENTITIES:
+ getEntities().clear();
+ getEntities().addAll((Collection<? extends XmlEntity>)newValue);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__EMBEDDABLES:
+ getEmbeddables().clear();
+ getEmbeddables().addAll((Collection<? extends XmlEmbeddable>)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_MAPPINGS__NAMED_QUERIES:
+ getNamedQueries().clear();
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__ACCESS:
+ setAccess(ACCESS_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ setPersistenceUnitMetadata((XmlPersistenceUnitMetadata)null);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__PACKAGE:
+ setPackage(PACKAGE_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ getSequenceGenerators().clear();
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__TABLE_GENERATORS:
+ getTableGenerators().clear();
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ getMappedSuperclasses().clear();
+ return;
+ case OrmPackage.XML_ENTITY_MAPPINGS__ENTITIES:
+ getEntities().clear();
+ return;
+ case OrmPackage.XML_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.XML_ENTITY_MAPPINGS__NAMED_QUERIES:
+ return namedQueries != null && !namedQueries.isEmpty();
+ case OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ return namedNativeQueries != null && !namedNativeQueries.isEmpty();
+ case OrmPackage.XML_ENTITY_MAPPINGS__ACCESS:
+ return access != ACCESS_EDEFAULT;
+ case OrmPackage.XML_ENTITY_MAPPINGS__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ return persistenceUnitMetadata != null;
+ case OrmPackage.XML_ENTITY_MAPPINGS__PACKAGE:
+ return PACKAGE_EDEFAULT == null ? package_ != null : !PACKAGE_EDEFAULT.equals(package_);
+ case OrmPackage.XML_ENTITY_MAPPINGS__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.XML_ENTITY_MAPPINGS__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.XML_ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ return sequenceGenerators != null && !sequenceGenerators.isEmpty();
+ case OrmPackage.XML_ENTITY_MAPPINGS__TABLE_GENERATORS:
+ return tableGenerators != null && !tableGenerators.isEmpty();
+ case OrmPackage.XML_ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ return sqlResultSetMappings != null && !sqlResultSetMappings.isEmpty();
+ case OrmPackage.XML_ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ return mappedSuperclasses != null && !mappedSuperclasses.isEmpty();
+ case OrmPackage.XML_ENTITY_MAPPINGS__ENTITIES:
+ return entities != null && !entities.isEmpty();
+ case OrmPackage.XML_ENTITY_MAPPINGS__EMBEDDABLES:
+ return embeddables != null && !embeddables.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlQueryContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY_MAPPINGS__NAMED_QUERIES: return OrmPackage.XML_QUERY_CONTAINER__NAMED_QUERIES;
+ case OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES: return OrmPackage.XML_QUERY_CONTAINER__NAMED_NATIVE_QUERIES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAccessHolder.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ENTITY_MAPPINGS__ACCESS: return OrmPackage.XML_ACCESS_HOLDER__ACCESS;
+ 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 == XmlQueryContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_QUERY_CONTAINER__NAMED_QUERIES: return OrmPackage.XML_ENTITY_MAPPINGS__NAMED_QUERIES;
+ case OrmPackage.XML_QUERY_CONTAINER__NAMED_NATIVE_QUERIES: return OrmPackage.XML_ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlAccessHolder.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ACCESS_HOLDER__ACCESS: return OrmPackage.XML_ENTITY_MAPPINGS__ACCESS;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ // **************** 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(" (access: ");
+ result.append(access);
+ 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(')');
+ return result.toString();
+ }
+
+ public List<XmlTypeMapping> getTypeMappings() {
+ // convert lists to arrays to avoid ConcurrentModificationException while adding to result list
+ ArrayList<XmlTypeMapping> typeMappings = new ArrayList<XmlTypeMapping>();
+ CollectionTools.addAll(typeMappings, this.getMappedSuperclasses().toArray(EMPTY_XML_TYPE_MAPPING_ARRAY));
+ CollectionTools.addAll(typeMappings, this.getEntities().toArray(EMPTY_XML_TYPE_MAPPING_ARRAY));
+ CollectionTools.addAll(typeMappings, this.getEmbeddables().toArray(EMPTY_XML_TYPE_MAPPING_ARRAY));
+ return typeMappings;
+ }
+
+ private static final XmlTypeMapping[] EMPTY_XML_TYPE_MAPPING_ARRAY = new XmlTypeMapping[0];
+
+
+ // **************** version -> schema location mapping ********************
+
+ private static String namespace = JPA.SCHEMA_NAMESPACE;
+
+ @Override
+ protected String getNamespace() {
+ return namespace;
+ }
+
+ private static Map<String, String> versionsToSchemaLocations = buildVersionsToSchemaLocations();
+
+ private static Map<String, String> buildVersionsToSchemaLocations() {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put(JPA.SCHEMA_VERSION, JPA.SCHEMA_LOCATION);
+ map.put(JPA2_0.SCHEMA_VERSION, JPA2_0.SCHEMA_LOCATION);
+ return map;
+ }
+
+ @Override
+ protected String getSchemaLocationForVersion(String version) {
+ return versionsToSchemaLocations.get(version);
+ }
+
+
+ // **************** translators *******************************************
+
+ public static Translator getRootTranslator() {
+ return ROOT_TRANSLATOR;
+ }
+
+ private static final Translator ROOT_TRANSLATOR = buildRootTranslator();
+
+ private static Translator buildRootTranslator() {
+ return new SimpleRootTranslator(
+ JPA.ENTITY_MAPPINGS,
+ OrmPackage.eINSTANCE.getXmlEntityMappings(),
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildVersionTranslator(versionsToSchemaLocations),
+ buildNamespaceTranslator(namespace),
+ buildSchemaNamespaceTranslator(),
+ buildSchemaLocationTranslator(namespace, versionsToSchemaLocations),
+ buildDescriptionTranslator(),
+ XmlPersistenceUnitMetadata.buildTranslator(JPA.PERSISTENCE_UNIT_METADATA, OrmPackage.eINSTANCE.getXmlEntityMappings_PersistenceUnitMetadata()),
+ buildPackageTranslator(),
+ buildSchemaTranslator(),
+ buildCatalogTranslator(),
+ buildAccessTranslator(),
+ XmlSequenceGenerator.buildTranslator(JPA.SEQUENCE_GENERATOR, OrmPackage.eINSTANCE.getXmlEntityMappings_SequenceGenerators()),
+ XmlTableGenerator.buildTranslator(JPA.TABLE_GENERATOR, OrmPackage.eINSTANCE.getXmlEntityMappings_TableGenerators()),
+ XmlNamedQuery.buildTranslator(JPA.NAMED_QUERY, OrmPackage.eINSTANCE.getXmlQueryContainer_NamedQueries()),
+ XmlNamedNativeQuery.buildTranslator(JPA.NAMED_NATIVE_QUERY, OrmPackage.eINSTANCE.getXmlQueryContainer_NamedNativeQueries()),
+ SqlResultSetMapping.buildTranslator(JPA.SQL_RESULT_SET_MAPPING, OrmPackage.eINSTANCE.getXmlEntityMappings_SqlResultSetMappings()),
+ XmlMappedSuperclass.buildTranslator(JPA.MAPPED_SUPERCLASS, OrmPackage.eINSTANCE.getXmlEntityMappings_MappedSuperclasses()),
+ XmlEntity.buildTranslator(JPA.ENTITY, OrmPackage.eINSTANCE.getXmlEntityMappings_Entities()),
+ XmlEmbeddable.buildTranslator(JPA.EMBEDDABLE, OrmPackage.eINSTANCE.getXmlEntityMappings_Embeddables()),
+ };
+ }
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmPackage.eINSTANCE.getXmlEntityMappings_Description());
+ }
+
+ protected static Translator buildPackageTranslator() {
+ return new Translator(JPA.PACKAGE, OrmPackage.eINSTANCE.getXmlEntityMappings_Package());
+ }
+
+ protected static Translator buildSchemaTranslator() {
+ return new Translator(JPA.SCHEMA, OrmPackage.eINSTANCE.getXmlEntityMappings_Schema());
+ }
+
+ protected static Translator buildCatalogTranslator() {
+ return new Translator(JPA.CATALOG, OrmPackage.eINSTANCE.getXmlEntityMappings_Catalog());
+ }
+
+ protected static Translator buildAccessTranslator() {
+ return new Translator(JPA.ACCESS, OrmPackage.eINSTANCE.getXmlAccessHolder_Access());
+ }
+
+
+ // ********** refactorings **********
+
+ public ReplaceEdit createRenamePackageEdit(String newName) {
+ int offset = getElementNode(JPA.PACKAGE).getStartStructuredDocumentRegion().getEndOffset();
+ return new ReplaceEdit(offset, this.package_.length(), newName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEventMethodContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEventMethodContainer.java
new file mode 100644
index 0000000000..9ecc87ac43
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEventMethodContainer.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c)2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Event Method Container</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#getPrePersist <em>Pre Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#getPostPersist <em>Post Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#getPreRemove <em>Pre Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#getPostRemove <em>Post Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#getPreUpdate <em>Pre Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#getPostUpdate <em>Post Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#getPostLoad <em>Post Load</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlEventMethodContainer extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_PrePersist()
+ * @model containment="true"
+ * @generated
+ */
+ PrePersist getPrePersist();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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
+ */
+ void setPrePersist(PrePersist value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_PostPersist()
+ * @model containment="true"
+ * @generated
+ */
+ PostPersist getPostPersist();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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
+ */
+ void setPostPersist(PostPersist value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_PreRemove()
+ * @model containment="true"
+ * @generated
+ */
+ PreRemove getPreRemove();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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
+ */
+ void setPreRemove(PreRemove value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_PostRemove()
+ * @model containment="true"
+ * @generated
+ */
+ PostRemove getPostRemove();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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
+ */
+ void setPostRemove(PostRemove value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_PreUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ PreUpdate getPreUpdate();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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
+ */
+ void setPreUpdate(PreUpdate value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_PostUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ PostUpdate getPostUpdate();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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
+ */
+ void setPostUpdate(PostUpdate value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlEventMethodContainer_PostLoad()
+ * @model containment="true"
+ * @generated
+ */
+ PostLoad getPostLoad();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlEventMethodContainer#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
+ */
+ void setPostLoad(PostLoad value);
+
+} // XmlEventMethodContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratedValue.java
new file mode 100644
index 0000000000..164f89a6dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratedValue.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Generated Value</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#getGenerator <em>Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#getStrategy <em>Strategy</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratedValue()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class XmlGeneratedValue extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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;
+
+ /**
+ * 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 GenerationType 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 GenerationType strategy = STRATEGY_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlGeneratedValue()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_GENERATED_VALUE;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlGeneratedValue_Generator()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getGenerator()
+ {
+ return generator;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#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, OrmPackage.XML_GENERATED_VALUE__GENERATOR, oldGenerator, generator));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.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.jpa.core.resource.orm.GenerationType
+ * @see #setStrategy(GenerationType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratedValue_Strategy()
+ * @model default="TABLE"
+ * @generated
+ */
+ public GenerationType getStrategy()
+ {
+ return strategy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue#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.jpa.core.resource.orm.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, OrmPackage.XML_GENERATED_VALUE__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_GENERATED_VALUE__GENERATOR:
+ return getGenerator();
+ case OrmPackage.XML_GENERATED_VALUE__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_GENERATED_VALUE__GENERATOR:
+ setGenerator((String)newValue);
+ return;
+ case OrmPackage.XML_GENERATED_VALUE__STRATEGY:
+ setStrategy((GenerationType)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_GENERATED_VALUE__GENERATOR:
+ setGenerator(GENERATOR_EDEFAULT);
+ return;
+ case OrmPackage.XML_GENERATED_VALUE__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_GENERATED_VALUE__GENERATOR:
+ return GENERATOR_EDEFAULT == null ? generator != null : !GENERATOR_EDEFAULT.equals(generator);
+ case OrmPackage.XML_GENERATED_VALUE__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(" (generator: ");
+ result.append(generator);
+ result.append(", strategy: ");
+ result.append(strategy);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getGeneratorTextRange() {
+ return getAttributeTextRange(JPA.GENERATOR);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildStrategyTranslator(),
+ buildGeneratorTranslator()
+ };
+ }
+
+ protected static Translator buildStrategyTranslator() {
+ return new Translator(JPA.STRATEGY, OrmPackage.eINSTANCE.getXmlGeneratedValue_Strategy(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildGeneratorTranslator() {
+ return new Translator(JPA.GENERATOR, OrmPackage.eINSTANCE.getXmlGeneratedValue_Generator(), Translator.DOM_ATTRIBUTE);
+ }
+} // GeneratedValue
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGenerator.java
new file mode 100644
index 0000000000..83bd5bd8cd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGenerator.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Generator</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#getInitialValue <em>Initial Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#getAllocationSize <em>Allocation Size</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGenerator()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlGenerator extends XmlGenerator_2_0
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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
+ */
+ 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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_InitialValue()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ Integer getInitialValue();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_AllocationSize()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ Integer getAllocationSize();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator#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);
+
+ public TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratorContainer.java
new file mode 100644
index 0000000000..cea5412ca4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratorContainer.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Generator Container</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer#getSequenceGenerator <em>Sequence Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer#getTableGenerator <em>Table Generator</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlGeneratorContainer extends JpaEObject
+{
+ /**
+ * 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(XmlSequenceGenerator)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer_SequenceGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ XmlSequenceGenerator getSequenceGenerator();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer#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(XmlSequenceGenerator 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(XmlTableGenerator)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer_TableGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ XmlTableGenerator getTableGenerator();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer#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(XmlTableGenerator value);
+
+} // XmlGeneratorContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlId.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlId.java
new file mode 100644
index 0000000000..23e68bbce0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlId.java
@@ -0,0 +1,805 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Id</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlId#getGeneratedValue <em>Generated Value</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlId()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlId extends AbstractXmlAttributeMapping implements ColumnMapping, XmlConvertibleMapping, XmlGeneratorContainer
+{
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlColumn 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;
+ /**
+ * 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 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.ORDINAL;
+ /**
+ * 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;
+ /**
+ * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSequenceGenerator()
+ * @generated
+ * @ordered
+ */
+ protected XmlSequenceGenerator 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 XmlTableGenerator tableGenerator;
+ /**
+ * The cached value of the '{@link #getGeneratedValue() <em>Generated Value</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getGeneratedValue()
+ * @generated
+ * @ordered
+ */
+ protected XmlGeneratedValue generatedValue;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlId()
+ {
+ super();
+ }
+
+ /**
+ * <!-- 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 #setColumn(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlColumn getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(XmlColumn newColumn, NotificationChain msgs)
+ {
+ XmlColumn 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;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlId#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(XmlColumn newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_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.jpa.core.resource.orm.XmlId#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_ID__LOB, oldLob, lob));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getTemporal()
+ {
+ return temporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.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.XML_ID__TEMPORAL, oldTemporal, temporal));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getEnumerated()
+ {
+ return enumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlId#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.jpa.core.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.XML_ID__ENUMERATED, oldEnumerated, enumerated));
+ }
+
+ /**
+ * 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(XmlGeneratedValue)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlId_GeneratedValue()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlGeneratedValue getGeneratedValue()
+ {
+ return generatedValue;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetGeneratedValue(XmlGeneratedValue newGeneratedValue, NotificationChain msgs)
+ {
+ XmlGeneratedValue 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.jpa.core.resource.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(XmlGeneratedValue 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>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(XmlTableGenerator)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer_TableGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlTableGenerator getTableGenerator()
+ {
+ return tableGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTableGenerator(XmlTableGenerator newTableGenerator, NotificationChain msgs)
+ {
+ XmlTableGenerator 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.jpa.core.resource.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(XmlTableGenerator 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>' 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(XmlSequenceGenerator)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlGeneratorContainer_SequenceGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlSequenceGenerator getSequenceGenerator()
+ {
+ return sequenceGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSequenceGenerator(XmlSequenceGenerator newSequenceGenerator, NotificationChain msgs)
+ {
+ XmlSequenceGenerator 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.jpa.core.resource.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(XmlSequenceGenerator 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));
+ }
+
+ /**
+ * <!-- 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__SEQUENCE_GENERATOR:
+ return basicSetSequenceGenerator(null, msgs);
+ case OrmPackage.XML_ID__TABLE_GENERATOR:
+ return basicSetTableGenerator(null, msgs);
+ case OrmPackage.XML_ID__GENERATED_VALUE:
+ return basicSetGeneratedValue(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__LOB:
+ return isLob();
+ case OrmPackage.XML_ID__TEMPORAL:
+ return getTemporal();
+ case OrmPackage.XML_ID__ENUMERATED:
+ return getEnumerated();
+ case OrmPackage.XML_ID__SEQUENCE_GENERATOR:
+ return getSequenceGenerator();
+ case OrmPackage.XML_ID__TABLE_GENERATOR:
+ return getTableGenerator();
+ case OrmPackage.XML_ID__GENERATED_VALUE:
+ return getGeneratedValue();
+ }
+ 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__COLUMN:
+ setColumn((XmlColumn)newValue);
+ return;
+ case OrmPackage.XML_ID__LOB:
+ setLob((Boolean)newValue);
+ return;
+ case OrmPackage.XML_ID__TEMPORAL:
+ setTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.XML_ID__ENUMERATED:
+ setEnumerated((EnumType)newValue);
+ return;
+ case OrmPackage.XML_ID__SEQUENCE_GENERATOR:
+ setSequenceGenerator((XmlSequenceGenerator)newValue);
+ return;
+ case OrmPackage.XML_ID__TABLE_GENERATOR:
+ setTableGenerator((XmlTableGenerator)newValue);
+ return;
+ case OrmPackage.XML_ID__GENERATED_VALUE:
+ setGeneratedValue((XmlGeneratedValue)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__COLUMN:
+ setColumn((XmlColumn)null);
+ return;
+ case OrmPackage.XML_ID__LOB:
+ setLob(LOB_EDEFAULT);
+ return;
+ case OrmPackage.XML_ID__TEMPORAL:
+ setTemporal(TEMPORAL_EDEFAULT);
+ return;
+ case OrmPackage.XML_ID__ENUMERATED:
+ setEnumerated(ENUMERATED_EDEFAULT);
+ return;
+ case OrmPackage.XML_ID__SEQUENCE_GENERATOR:
+ setSequenceGenerator((XmlSequenceGenerator)null);
+ return;
+ case OrmPackage.XML_ID__TABLE_GENERATOR:
+ setTableGenerator((XmlTableGenerator)null);
+ return;
+ case OrmPackage.XML_ID__GENERATED_VALUE:
+ setGeneratedValue((XmlGeneratedValue)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__LOB:
+ return lob != LOB_EDEFAULT;
+ case OrmPackage.XML_ID__TEMPORAL:
+ return temporal != TEMPORAL_EDEFAULT;
+ case OrmPackage.XML_ID__ENUMERATED:
+ return enumerated != ENUMERATED_EDEFAULT;
+ case OrmPackage.XML_ID__SEQUENCE_GENERATOR:
+ return sequenceGenerator != null;
+ case OrmPackage.XML_ID__TABLE_GENERATOR:
+ return tableGenerator != null;
+ case OrmPackage.XML_ID__GENERATED_VALUE:
+ return generatedValue != 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.XML_ID__COLUMN: return OrmPackage.COLUMN_MAPPING__COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ID__LOB: return OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+ case OrmPackage.XML_ID__TEMPORAL: return OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+ case OrmPackage.XML_ID__ENUMERATED: return OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlGeneratorContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ID__SEQUENCE_GENERATOR: return OrmPackage.XML_GENERATOR_CONTAINER__SEQUENCE_GENERATOR;
+ case OrmPackage.XML_ID__TABLE_GENERATOR: return OrmPackage.XML_GENERATOR_CONTAINER__TABLE_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 == ColumnMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.COLUMN_MAPPING__COLUMN: return OrmPackage.XML_ID__COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__LOB: return OrmPackage.XML_ID__LOB;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL: return OrmPackage.XML_ID__TEMPORAL;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED: return OrmPackage.XML_ID__ENUMERATED;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlGeneratorContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_GENERATOR_CONTAINER__SEQUENCE_GENERATOR: return OrmPackage.XML_ID__SEQUENCE_GENERATOR;
+ case OrmPackage.XML_GENERATOR_CONTAINER__TABLE_GENERATOR: return OrmPackage.XML_ID__TABLE_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(" (lob: ");
+ result.append(lob);
+ result.append(", temporal: ");
+ result.append(temporal);
+ result.append(", enumerated: ");
+ result.append(enumerated);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getEnumeratedTextRange() {
+ return getAttributeTextRange(JPA.ENUMERATED);
+ }
+
+ public TextRange getLobTextRange() {
+ throw new UnsupportedOperationException("lob not supported by id mappings");
+ }
+
+ public TextRange getTemporalTextRange() {
+ throw new UnsupportedOperationException("temporal not supported by id mappings");
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildAccessTranslator(),
+ buildColumnTranslator(),
+ buildGeneratedValueTranslator(),
+ buildTemporalTranslator(),
+ buildTableGeneratorTranslator(),
+ buildSequenceGeneratorTranslator()
+ };
+ }
+
+ protected static Translator buildColumnTranslator() {
+ return XmlColumn.buildTranslator(JPA.COLUMN, OrmPackage.eINSTANCE.getColumnMapping_Column());
+ }
+
+ protected static Translator buildGeneratedValueTranslator() {
+ return XmlGeneratedValue.buildTranslator(JPA.GENERATED_VALUE, OrmPackage.eINSTANCE.getXmlId_GeneratedValue());
+ }
+
+ protected static Translator buildTemporalTranslator() {
+ return new Translator(JPA.TEMPORAL, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Temporal());
+ }
+
+ protected static Translator buildTableGeneratorTranslator() {
+ return XmlTableGenerator.buildTranslator(JPA.TABLE_GENERATOR, OrmPackage.eINSTANCE.getXmlGeneratorContainer_TableGenerator());
+ }
+
+ protected static Translator buildSequenceGeneratorTranslator() {
+ return XmlSequenceGenerator.buildTranslator(JPA.SEQUENCE_GENERATOR, OrmPackage.eINSTANCE.getXmlGeneratorContainer_SequenceGenerator());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlIdClassContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlIdClassContainer.java
new file mode 100644
index 0000000000..9d50cfc687
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlIdClassContainer.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Id Class Container</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer#getIdClass <em>Id Class</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlIdClassContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlIdClassContainer extends JpaEObject
+{
+ /**
+ * 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(XmlClassReference)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlIdClassContainer_IdClass()
+ * @model containment="true"
+ * @generated
+ */
+ XmlClassReference getIdClass();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer#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
+ */
+ void setIdClass(XmlClassReference value);
+
+} // XmlIdClassContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumn.java
new file mode 100644
index 0000000000..36b1393589
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumn.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Join Column</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinColumn()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlJoinColumn extends AbstractXmlColumn
+{
+ /**
+ * 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 XmlJoinColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- 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 #setReferencedColumnName(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinColumn_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.jpa.core.resource.orm.XmlJoinColumn#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.XML_JOIN_COLUMN__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.XML_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.XML_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.XML_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.XML_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(" (referencedColumnName: ");
+ result.append(referencedColumnName);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return getAttributeTextRange(JPA.REFERENCED_COLUMN_NAME);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildReferencedColumnNameTranslator(),
+ buildUniqueTranslator(),
+ buildNullableTranslator(),
+ buildInsertableTranslator(),
+ buildUpdatableTranslator(),
+ buildColumnDefinitionTranslator(),
+ buildTableTranslator(),
+ };
+ }
+
+ protected static Translator buildReferencedColumnNameTranslator() {
+ return new Translator(JPA.REFERENCED_COLUMN_NAME, OrmPackage.eINSTANCE.getXmlJoinColumn_ReferencedColumnName(), Translator.DOM_ATTRIBUTE);
+ }
+} // JoinColumn
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumnContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumnContainer.java
new file mode 100644
index 0000000000..811b99e9c7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumnContainer.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Join Column Container</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer#getJoinColumns <em>Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinColumnContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlJoinColumnContainer extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlJoinColumnContainer_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlJoinColumn> getJoinColumns();
+
+} // XmlJoinColumnContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTable.java
new file mode 100644
index 0000000000..894c525703
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTable.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Join Table</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable#getInverseJoinColumns <em>Inverse Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTable()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlJoinTable extends AbstractXmlReferenceTable
+{
+ /**
+ * 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<XmlJoinColumn> inverseJoinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlJoinTable()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_JOIN_TABLE;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlJoinTable_InverseJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJoinColumn> getInverseJoinColumns()
+ {
+ if (inverseJoinColumns == null)
+ {
+ inverseJoinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__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.XML_JOIN_TABLE__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.XML_JOIN_TABLE__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.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS:
+ getInverseJoinColumns().clear();
+ getInverseJoinColumns().addAll((Collection<? extends XmlJoinColumn>)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__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.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS:
+ return inverseJoinColumns != null && !inverseJoinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ public boolean isSpecified() {
+ return true;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildCatalogTranslator(),
+ buildSchemaTranslator(),
+ buildJoinColumnTranslator(),
+ buildInverseJoinColumnTranslator(),
+ buildUniqueConstraintTranslator()
+ };
+ }
+
+ protected static Translator buildInverseJoinColumnTranslator() {
+ return XmlJoinColumn.buildTranslator(JPA.INVERSE_JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlJoinTable_InverseJoinColumns());
+ }
+
+} // JoinTable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTableContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTableContainer.java
new file mode 100644
index 0000000000..3199364e79
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTableContainer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Join Table Container</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer#getJoinTable <em>Join Table</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTableContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlJoinTableContainer extends JpaEObject
+{
+ /**
+ * 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(XmlJoinTable)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlJoinTableContainer_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ XmlJoinTable getJoinTable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer#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(XmlJoinTable value);
+
+} // XmlJoinTableContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToMany.java
new file mode 100644
index 0000000000..b3012927bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToMany.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlManyToMany_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Many To Many</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlManyToMany()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlManyToMany extends AbstractXmlMultiRelationshipMapping implements XmlManyToMany_2_0
+{
+ /**
+ * <!-- 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 getMappingKey() {
+ return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildTargetEntityTranslator(),
+ buildFetchTranslator(),
+ buildAccessTranslator(),
+ buildMappedByTranslator(),
+ buildOrderByTranslator(),
+ buildOrderColumnTranslator(),
+ buildMapKeyTranslator(),
+ buildMapKeyClassTranslator(),
+ buildMapKeyTemporalTranslator(),
+ buildMapKeyEnumeratedTranslator(),
+ buildMapKeyAttributeOverrideTranslator(),
+ buildMapKeyColumnTranslator(),
+ buildMapKeyJoinColumnTranslator(),
+ buildJoinTableTranslator(),
+ buildCascadeTranslator()
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToOne.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToOne.java
new file mode 100644
index 0000000000..002ed41f75
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToOne.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Many To One</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlManyToOne()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlManyToOne extends AbstractXmlSingleRelationshipMapping
+{
+
+ /**
+ * <!-- 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;
+ }
+
+ // **************** XmlAttributeMapping impl ******************************
+
+ public String getMappingKey() {
+ return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+
+ // **************** translators *******************************************
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildTargetEntityTranslator(),
+ buildFetchTranslator(),
+ buildOptionalTranslator(),
+ buildAccessTranslator(),
+ buildMapsIdTranslator(),
+ buildIdTranslator(),
+ buildJoinColumnTranslator(),
+ buildJoinTableTranslator(),
+ buildCascadeTranslator()
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedByMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedByMapping.java
new file mode 100644
index 0000000000..3d520018c8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedByMapping.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Ownable Relationship Mapping</b></em>'.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping#getMappedBy <em>Mapped By</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMappedByMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlMappedByMapping extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlMappedByMapping_MappedBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getMappedBy();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping#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);
+
+ TextRange getMappedByTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedSuperclass.java
new file mode 100644
index 0000000000..7f4f78510b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedSuperclass.java
@@ -0,0 +1,574 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.EmptyTagBooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Mapped Superclass</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass#getEntityListeners <em>Entity Listeners</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlMappedSuperclass()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlMappedSuperclass extends AbstractXmlTypeMapping implements XmlIdClassContainer
+{
+
+ /**
+ * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIdClass()
+ * @generated
+ * @ordered
+ */
+ protected XmlClassReference 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlMappedSuperclass()
+ {
+ super();
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
+ }
+
+ public XmlEntityMappings entityMappings() {
+ return (XmlEntityMappings) eContainer();
+ }
+
+ /**
+ * <!-- 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>' 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(XmlClassReference)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlIdClassContainer_IdClass()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlClassReference getIdClass()
+ {
+ return idClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetIdClass(XmlClassReference newIdClass, NotificationChain msgs)
+ {
+ XmlClassReference oldIdClass = idClass;
+ idClass = newIdClass;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlMappedSuperclass#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(XmlClassReference newIdClass)
+ {
+ if (newIdClass != idClass)
+ {
+ NotificationChain msgs = null;
+ if (idClass != null)
+ msgs = ((InternalEObject)idClass).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS, null, msgs);
+ if (newIdClass != null)
+ msgs = ((InternalEObject)newIdClass).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlMappedSuperclass_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.jpa.core.resource.orm.XmlMappedSuperclass#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlMappedSuperclass_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.jpa.core.resource.orm.XmlMappedSuperclass#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlMappedSuperclass_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.XML_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.jpa.core.resource.orm.XmlMappedSuperclass#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.XML_MAPPED_SUPERCLASS__ENTITY_LISTENERS, null, msgs);
+ if (newEntityListeners != null)
+ msgs = ((InternalEObject)newEntityListeners).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_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.XML_MAPPED_SUPERCLASS__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.XML_MAPPED_SUPERCLASS__ID_CLASS:
+ return basicSetIdClass(null, msgs);
+ case OrmPackage.XML_MAPPED_SUPERCLASS__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.XML_MAPPED_SUPERCLASS__ID_CLASS:
+ return getIdClass();
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ return isExcludeDefaultListeners();
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ return isExcludeSuperclassListeners();
+ case OrmPackage.XML_MAPPED_SUPERCLASS__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.XML_MAPPED_SUPERCLASS__ID_CLASS:
+ setIdClass((XmlClassReference)newValue);
+ return;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners((Boolean)newValue);
+ return;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners((Boolean)newValue);
+ return;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__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.XML_MAPPED_SUPERCLASS__ID_CLASS:
+ setIdClass((XmlClassReference)null);
+ return;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners(EXCLUDE_DEFAULT_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners(EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__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.XML_MAPPED_SUPERCLASS__ID_CLASS:
+ return idClass != null;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ return excludeDefaultListeners != EXCLUDE_DEFAULT_LISTENERS_EDEFAULT;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ return excludeSuperclassListeners != EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT;
+ case OrmPackage.XML_MAPPED_SUPERCLASS__ENTITY_LISTENERS:
+ return entityListeners != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlIdClassContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS: return OrmPackage.XML_ID_CLASS_CONTAINER__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 == XmlIdClassContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_ID_CLASS_CONTAINER__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(" (excludeDefaultListeners: ");
+ result.append(excludeDefaultListeners);
+ result.append(", excludeSuperclassListeners: ");
+ result.append(excludeSuperclassListeners);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildClassTranslator(),
+ buildAccessTranslator(),
+ buildMetadataCompleteTranslator(),
+ buildDescriptionTranslator(),
+ buildIdClassTranslator(),
+ buildExcludeDefaultListenersTranslator(),
+ buildExcludeSuperclassListenersTranslator(),
+ buildEntityListenersTranslator(),
+ PrePersist.buildTranslator(),
+ PostPersist.buildTranslator(),
+ PreRemove.buildTranslator(),
+ PostRemove.buildTranslator(),
+ PreUpdate.buildTranslator(),
+ PostUpdate.buildTranslator(),
+ PostLoad.buildTranslator(),
+ Attributes.buildTranslator()
+ };
+ }
+
+ protected static Translator buildAccessTranslator() {
+ return new Translator(JPA.ACCESS, OrmPackage.eINSTANCE.getXmlAccessHolder_Access(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildIdClassTranslator() {
+ return XmlClassReference.buildTranslator(JPA.ID_CLASS, OrmPackage.eINSTANCE.getXmlIdClassContainer_IdClass());
+ }
+
+ protected static Translator buildExcludeDefaultListenersTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.EXCLUDE_DEFAULT_LISTENERS, OrmPackage.eINSTANCE.getXmlMappedSuperclass_ExcludeDefaultListeners());
+ }
+
+ protected static Translator buildExcludeSuperclassListenersTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.EXCLUDE_SUPERCLASS_LISTENERS, OrmPackage.eINSTANCE.getXmlMappedSuperclass_ExcludeSuperclassListeners());
+ }
+
+ protected static Translator buildEntityListenersTranslator() {
+ return EntityListeners.buildTranslator(JPA.ENTITY_LISTENERS, OrmPackage.eINSTANCE.getXmlMappedSuperclass_EntityListeners());
+ }
+
+ protected static Translator buildPrePersistTranslator() {
+ return PrePersist.buildTranslator();
+ }
+
+ protected static Translator buildPostPersistTranslator() {
+ return PostPersist.buildTranslator();
+ }
+
+ protected static Translator buildPreRemoveTranslator() {
+ return PreRemove.buildTranslator();
+ }
+
+ protected static Translator buildPostRemoveTranslator() {
+ return PostRemove.buildTranslator();
+ }
+
+ protected static Translator buildPreUpdateTranslator() {
+ return PreUpdate.buildTranslator();
+ }
+
+ protected static Translator buildPostUpdateTranslator() {
+ return PostUpdate.buildTranslator();
+ }
+
+ protected static Translator buildPostLoadTranslator() {
+ return PostLoad.buildTranslator();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedNativeQuery.java
new file mode 100644
index 0000000000..024f72fbb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedNativeQuery.java
@@ -0,0 +1,586 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Named Native Query</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery#getResultClass <em>Result Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNamedNativeQuery()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlNamedNativeQuery extends AbstractJpaEObject implements XmlQuery
+{
+ /**
+ * 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 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<XmlQueryHint> 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 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>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.jpa.core.resource.orm.OrmPackage#getXmlQuery_2_0_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.jpa.core.resource.orm.XmlNamedNativeQuery#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.XML_NAMED_NATIVE_QUERY__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_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.jpa.core.resource.orm.XmlNamedNativeQuery#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_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.jpa.core.resource.orm.OrmPackage#getXmlNamedNativeQuery_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.jpa.core.resource.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.jpa.core.resource.orm.OrmPackage#getXmlNamedNativeQuery_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.jpa.core.resource.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));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_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.jpa.core.resource.orm.XmlNamedNativeQuery#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.XML_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.jpa.core.resource.orm.XmlQueryHint}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_Hints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlQueryHint> getHints()
+ {
+ if (hints == null)
+ {
+ hints = new EObjectContainmentEList<XmlQueryHint>(XmlQueryHint.class, this, OrmPackage.XML_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.XML_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.XML_NAMED_NATIVE_QUERY__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__NAME:
+ return getName();
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__QUERY:
+ return getQuery();
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__HINTS:
+ return getHints();
+ 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
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__QUERY:
+ setQuery((String)newValue);
+ return;
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__HINTS:
+ getHints().clear();
+ getHints().addAll((Collection<? extends XmlQueryHint>)newValue);
+ return;
+ 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__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__QUERY:
+ setQuery(QUERY_EDEFAULT);
+ return;
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__HINTS:
+ getHints().clear();
+ return;
+ 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__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__QUERY:
+ return QUERY_EDEFAULT == null ? query != null : !QUERY_EDEFAULT.equals(query);
+ case OrmPackage.XML_NAMED_NATIVE_QUERY__HINTS:
+ return hints != null && !hints.isEmpty();
+ 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 String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (description: ");
+ result.append(description);
+ 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();
+ }
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildResultClassTranslator(),
+ buildResultSetMappingTranslator(),
+ buildDescriptionTranslator(),
+ buildQueryTranslator(),
+ buildHintTranslator()
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlQuery_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildResultClassTranslator() {
+ return new Translator(JPA.RESULT_CLASS, OrmPackage.eINSTANCE.getXmlNamedNativeQuery_ResultClass(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildResultSetMappingTranslator() {
+ return new Translator(JPA.RESULT_SET_MAPPING, OrmPackage.eINSTANCE.getXmlNamedNativeQuery_ResultSetMapping(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlQuery_2_0_Description());
+ }
+
+ protected static Translator buildQueryTranslator() {
+ return new Translator(JPA.QUERY, OrmPackage.eINSTANCE.getXmlQuery_Query());
+ }
+
+ protected static Translator buildHintTranslator() {
+ return XmlQueryHint.buildTranslator(JPA.HINT, OrmPackage.eINSTANCE.getXmlQuery_Hints());
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedQuery.java
new file mode 100644
index 0000000000..0c4cc5e3f7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedQuery.java
@@ -0,0 +1,542 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Named Query</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNamedQuery()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlNamedQuery extends AbstractJpaEObject implements XmlQuery, XmlNamedQuery_2_0
+{
+ /**
+ * 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 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<XmlQueryHint> hints;
+
+ /**
+ * 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 LockModeType_2_0 LOCK_MODE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getLockMode() <em>Lock Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLockMode()
+ * @generated
+ * @ordered
+ */
+ protected LockModeType_2_0 lockMode = LOCK_MODE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlNamedQuery()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_NAMED_QUERY;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_2_0_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.jpa.core.resource.orm.XmlNamedQuery#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.XML_NAMED_QUERY__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_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.jpa.core.resource.orm.XmlNamedQuery#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_NAMED_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.jpa.core.resource.orm.OrmPackage#getXmlQuery_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.jpa.core.resource.orm.XmlNamedQuery#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.XML_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.jpa.core.resource.orm.XmlQueryHint}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_Hints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlQueryHint> getHints()
+ {
+ if (hints == null)
+ {
+ hints = new EObjectContainmentEList<XmlQueryHint>(XmlQueryHint.class, this, OrmPackage.XML_NAMED_QUERY__HINTS);
+ }
+ return hints;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Lock Mode</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lock Mode</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lock Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0
+ * @see #setLockMode(LockModeType_2_0)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNamedQuery_2_0_LockMode()
+ * @model
+ * @generated
+ */
+ public LockModeType_2_0 getLockMode()
+ {
+ return lockMode;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery#getLockMode <em>Lock Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lock Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0
+ * @see #getLockMode()
+ * @generated
+ */
+ public void setLockMode(LockModeType_2_0 newLockMode)
+ {
+ LockModeType_2_0 oldLockMode = lockMode;
+ lockMode = newLockMode == null ? LOCK_MODE_EDEFAULT : newLockMode;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_NAMED_QUERY__LOCK_MODE, oldLockMode, lockMode));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_NAMED_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.XML_NAMED_QUERY__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_NAMED_QUERY__NAME:
+ return getName();
+ case OrmPackage.XML_NAMED_QUERY__QUERY:
+ return getQuery();
+ case OrmPackage.XML_NAMED_QUERY__HINTS:
+ return getHints();
+ case OrmPackage.XML_NAMED_QUERY__LOCK_MODE:
+ return getLockMode();
+ }
+ 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_NAMED_QUERY__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_NAMED_QUERY__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_NAMED_QUERY__QUERY:
+ setQuery((String)newValue);
+ return;
+ case OrmPackage.XML_NAMED_QUERY__HINTS:
+ getHints().clear();
+ getHints().addAll((Collection<? extends XmlQueryHint>)newValue);
+ return;
+ case OrmPackage.XML_NAMED_QUERY__LOCK_MODE:
+ setLockMode((LockModeType_2_0)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_QUERY__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_NAMED_QUERY__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_NAMED_QUERY__QUERY:
+ setQuery(QUERY_EDEFAULT);
+ return;
+ case OrmPackage.XML_NAMED_QUERY__HINTS:
+ getHints().clear();
+ return;
+ case OrmPackage.XML_NAMED_QUERY__LOCK_MODE:
+ setLockMode(LOCK_MODE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_NAMED_QUERY__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_NAMED_QUERY__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_NAMED_QUERY__QUERY:
+ return QUERY_EDEFAULT == null ? query != null : !QUERY_EDEFAULT.equals(query);
+ case OrmPackage.XML_NAMED_QUERY__HINTS:
+ return hints != null && !hints.isEmpty();
+ case OrmPackage.XML_NAMED_QUERY__LOCK_MODE:
+ return lockMode != LOCK_MODE_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlNamedQuery_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_NAMED_QUERY__LOCK_MODE: return OrmV2_0Package.XML_NAMED_QUERY_20__LOCK_MODE;
+ 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 == XmlNamedQuery_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_NAMED_QUERY_20__LOCK_MODE: return OrmPackage.XML_NAMED_QUERY__LOCK_MODE;
+ 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(" (description: ");
+ result.append(description);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", query: ");
+ result.append(query);
+ result.append(", lockMode: ");
+ result.append(lockMode);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildDescriptionTranslator(),
+ buildQueryTranslator(),
+ buildLockModeTranslator(),
+ XmlQueryHint.buildTranslator(JPA2_0.HINT, OrmPackage.eINSTANCE.getXmlQuery_Hints()),
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlQuery_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlQuery_2_0_Description());
+ }
+
+ protected static Translator buildQueryTranslator() {
+ return new Translator(JPA.QUERY, OrmPackage.eINSTANCE.getXmlQuery_Query());
+ }
+
+ protected static Translator buildLockModeTranslator() {
+ return new Translator(JPA2_0.NAMED_QUERY__LOCK_MODE, OrmV2_0Package.eINSTANCE.getXmlNamedQuery_2_0_LockMode());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNullAttributeMapping.java
new file mode 100644
index 0000000000..d6e607828a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNullAttributeMapping.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Null Attribute Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlNullAttributeMapping()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class XmlNullAttributeMapping extends AbstractXmlAttributeMapping
+{
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlNullAttributeMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_NULL_ATTRIBUTE_MAPPING;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToMany.java
new file mode 100644
index 0000000000..456385128b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToMany.java
@@ -0,0 +1,376 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>One To Many</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOneToMany()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlOneToMany extends AbstractXmlMultiRelationshipMapping implements XmlJoinColumnContainer, XmlOneToMany_2_0
+{
+
+ /**
+ * 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<XmlJoinColumn> joinColumns;
+
+ /**
+ * The default value of the '{@link #getOrphanRemoval() <em>Orphan Removal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrphanRemoval()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean ORPHAN_REMOVAL_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getOrphanRemoval() <em>Orphan Removal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrphanRemoval()
+ * @generated
+ * @ordered
+ */
+ protected Boolean orphanRemoval = ORPHAN_REMOVAL_EDEFAULT;
+
+ /**
+ * <!-- 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;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlJoinColumnContainer_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<XmlJoinColumn>(XmlJoinColumn.class, this, OrmPackage.XML_ONE_TO_MANY__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Orphan Removal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Orphan Removal</em>' attribute.
+ * @see #setOrphanRemoval(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrphanRemovable_2_0_OrphanRemoval()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getOrphanRemoval()
+ {
+ return orphanRemoval;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany#getOrphanRemoval <em>Orphan Removal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Orphan Removal</em>' attribute.
+ * @see #getOrphanRemoval()
+ * @generated
+ */
+ public void setOrphanRemoval(Boolean newOrphanRemoval)
+ {
+ Boolean oldOrphanRemoval = orphanRemoval;
+ orphanRemoval = newOrphanRemoval;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ONE_TO_MANY__ORPHAN_REMOVAL, oldOrphanRemoval, orphanRemoval));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ONE_TO_MANY__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.XML_ONE_TO_MANY__JOIN_COLUMNS:
+ return getJoinColumns();
+ case OrmPackage.XML_ONE_TO_MANY__ORPHAN_REMOVAL:
+ return getOrphanRemoval();
+ }
+ 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_ONE_TO_MANY__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends XmlJoinColumn>)newValue);
+ return;
+ case OrmPackage.XML_ONE_TO_MANY__ORPHAN_REMOVAL:
+ setOrphanRemoval((Boolean)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_MANY__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ case OrmPackage.XML_ONE_TO_MANY__ORPHAN_REMOVAL:
+ setOrphanRemoval(ORPHAN_REMOVAL_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_MANY__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ case OrmPackage.XML_ONE_TO_MANY__ORPHAN_REMOVAL:
+ return ORPHAN_REMOVAL_EDEFAULT == null ? orphanRemoval != null : !ORPHAN_REMOVAL_EDEFAULT.equals(orphanRemoval);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlJoinColumnContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ONE_TO_MANY__JOIN_COLUMNS: return OrmPackage.XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrphanRemovable_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ONE_TO_MANY__ORPHAN_REMOVAL: return OrmV2_0Package.XML_ORPHAN_REMOVABLE_20__ORPHAN_REMOVAL;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOneToMany_2_0.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 == XmlJoinColumnContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_JOIN_COLUMN_CONTAINER__JOIN_COLUMNS: return OrmPackage.XML_ONE_TO_MANY__JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrphanRemovable_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ORPHAN_REMOVABLE_20__ORPHAN_REMOVAL: return OrmPackage.XML_ONE_TO_MANY__ORPHAN_REMOVAL;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOneToMany_2_0.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(" (orphanRemoval: ");
+ result.append(orphanRemoval);
+ result.append(')');
+ return result.toString();
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildTargetEntityTranslator(),
+ buildFetchTranslator(),
+ buildAccessTranslator(),
+ buildMappedByTranslator(),
+ buildOrphanRemovalTranslator(),
+ buildOrderByTranslator(),
+ buildOrderColumnTranslator(),
+ buildMapKeyTranslator(),
+ buildMapKeyClassTranslator(),
+ buildMapKeyTemporalTranslator(),
+ buildMapKeyEnumeratedTranslator(),
+ buildMapKeyAttributeOverrideTranslator(),
+ buildMapKeyColumnTranslator(),
+ buildMapKeyJoinColumnTranslator(),
+ buildJoinTableTranslator(),
+ buildJoinColumnTranslator(),
+ buildCascadeTranslator()
+ };
+ }
+
+ protected static Translator buildOrphanRemovalTranslator() {
+ return new Translator(JPA2_0.ORPHAN_REMOVAL, OrmV2_0Package.eINSTANCE.getXmlOrphanRemovable_2_0_OrphanRemoval(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildJoinColumnTranslator() {
+ return XmlJoinColumn.buildTranslator(JPA.JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlJoinColumnContainer_JoinColumns());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToOne.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToOne.java
new file mode 100644
index 0000000000..890c2d073f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToOne.java
@@ -0,0 +1,467 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToOne_2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>One To One</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOneToOne()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlOneToOne extends AbstractXmlSingleRelationshipMapping implements XmlMappedByMapping, XmlPrimaryKeyJoinColumnContainer, XmlOneToOne_2_0
+{
+
+ /**
+ * 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<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns;
+ /**
+ * The default value of the '{@link #getOrphanRemoval() <em>Orphan Removal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrphanRemoval()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean ORPHAN_REMOVAL_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getOrphanRemoval() <em>Orphan Removal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrphanRemoval()
+ * @generated
+ * @ordered
+ */
+ protected Boolean orphanRemoval = ORPHAN_REMOVAL_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlOneToOne()
+ {
+ super();
+ }
+
+ /**
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlMappedByMapping_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.jpa.core.resource.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));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Orphan Removal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Orphan Removal</em>' attribute.
+ * @see #setOrphanRemoval(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrphanRemovable_2_0_OrphanRemoval()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getOrphanRemoval()
+ {
+ return orphanRemoval;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne#getOrphanRemoval <em>Orphan Removal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Orphan Removal</em>' attribute.
+ * @see #getOrphanRemoval()
+ * @generated
+ */
+ public void setOrphanRemoval(Boolean newOrphanRemoval)
+ {
+ Boolean oldOrphanRemoval = orphanRemoval;
+ orphanRemoval = newOrphanRemoval;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ONE_TO_ONE__ORPHAN_REMOVAL, oldOrphanRemoval, orphanRemoval));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnContainer_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns()
+ {
+ if (primaryKeyJoinColumns == null)
+ {
+ primaryKeyJoinColumns = new EObjectContainmentEList<XmlPrimaryKeyJoinColumn>(XmlPrimaryKeyJoinColumn.class, this, OrmPackage.XML_ONE_TO_ONE__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.XML_ONE_TO_ONE__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.XML_ONE_TO_ONE__MAPPED_BY:
+ return getMappedBy();
+ case OrmPackage.XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS:
+ return getPrimaryKeyJoinColumns();
+ case OrmPackage.XML_ONE_TO_ONE__ORPHAN_REMOVAL:
+ return getOrphanRemoval();
+ }
+ 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_ONE_TO_ONE__MAPPED_BY:
+ setMappedBy((String)newValue);
+ return;
+ case OrmPackage.XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ getPrimaryKeyJoinColumns().addAll((Collection<? extends XmlPrimaryKeyJoinColumn>)newValue);
+ return;
+ case OrmPackage.XML_ONE_TO_ONE__ORPHAN_REMOVAL:
+ setOrphanRemoval((Boolean)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;
+ case OrmPackage.XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ return;
+ case OrmPackage.XML_ONE_TO_ONE__ORPHAN_REMOVAL:
+ setOrphanRemoval(ORPHAN_REMOVAL_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);
+ case OrmPackage.XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS:
+ return primaryKeyJoinColumns != null && !primaryKeyJoinColumns.isEmpty();
+ case OrmPackage.XML_ONE_TO_ONE__ORPHAN_REMOVAL:
+ return ORPHAN_REMOVAL_EDEFAULT == null ? orphanRemoval != null : !ORPHAN_REMOVAL_EDEFAULT.equals(orphanRemoval);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlMappedByMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ONE_TO_ONE__MAPPED_BY: return OrmPackage.XML_MAPPED_BY_MAPPING__MAPPED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlPrimaryKeyJoinColumnContainer.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS: return OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER__PRIMARY_KEY_JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrphanRemovable_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ONE_TO_ONE__ORPHAN_REMOVAL: return OrmV2_0Package.XML_ORPHAN_REMOVABLE_20__ORPHAN_REMOVAL;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOneToOne_2_0.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 == XmlMappedByMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_MAPPED_BY_MAPPING__MAPPED_BY: return OrmPackage.XML_ONE_TO_ONE__MAPPED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlPrimaryKeyJoinColumnContainer.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_CONTAINER__PRIMARY_KEY_JOIN_COLUMNS: return OrmPackage.XML_ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOrphanRemovable_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ORPHAN_REMOVABLE_20__ORPHAN_REMOVAL: return OrmPackage.XML_ONE_TO_ONE__ORPHAN_REMOVAL;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlOneToOne_2_0.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(", orphanRemoval: ");
+ result.append(orphanRemoval);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // **************** XmlAttributeMapping impl ******************************
+
+ public String getMappingKey() {
+ return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+
+ // **************** validation support ************************************
+
+ public TextRange getMappedByTextRange() {
+ return getAttributeTextRange(JPA.MAPPED_BY);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildTargetEntityTranslator(),
+ buildFetchTranslator(),
+ buildOptionalTranslator(),
+ buildAccessTranslator(),
+ buildMappedByTranslator(),
+ buildOrphanRemovalTranslator(),
+ buildMapsIdTranslator(),
+ buildIdTranslator(),
+ buildPrimaryKeyJoinColumnTranslator(),
+ buildJoinColumnTranslator(),
+ buildJoinTableTranslator(),
+ buildCascadeTranslator()
+ };
+ }
+
+ protected static Translator buildMappedByTranslator() {
+ return new Translator(JPA.MAPPED_BY, OrmPackage.eINSTANCE.getXmlMappedByMapping_MappedBy(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildOrphanRemovalTranslator() {
+ return new Translator(JPA2_0.ORPHAN_REMOVAL, OrmV2_0Package.eINSTANCE.getXmlOrphanRemovable_2_0_OrphanRemoval(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildPrimaryKeyJoinColumnTranslator() {
+ return XmlPrimaryKeyJoinColumn.buildTranslator(JPA.PRIMARY_KEY_JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlPrimaryKeyJoinColumnContainer_PrimaryKeyJoinColumns());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderColumn.java
new file mode 100644
index 0000000000..73ad09cf47
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderColumn.java
@@ -0,0 +1,404 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.BooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Order Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderColumn()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlOrderColumn extends AbstractXmlNamedColumn implements XmlOrderColumn_2_0
+{
+ /**
+ * 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 #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 #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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlOrderColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_ORDER_COLUMN;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOrderColumn_2_0_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.jpa.core.resource.orm.XmlOrderColumn#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.XML_ORDER_COLUMN__NULLABLE, oldNullable, nullable));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOrderColumn_2_0_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.jpa.core.resource.orm.XmlOrderColumn#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.XML_ORDER_COLUMN__INSERTABLE, oldInsertable, insertable));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOrderColumn_2_0_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.jpa.core.resource.orm.XmlOrderColumn#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.XML_ORDER_COLUMN__UPDATABLE, oldUpdatable, updatable));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ORDER_COLUMN__NULLABLE:
+ return getNullable();
+ case OrmPackage.XML_ORDER_COLUMN__INSERTABLE:
+ return getInsertable();
+ case OrmPackage.XML_ORDER_COLUMN__UPDATABLE:
+ return getUpdatable();
+ }
+ 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_ORDER_COLUMN__NULLABLE:
+ setNullable((Boolean)newValue);
+ return;
+ case OrmPackage.XML_ORDER_COLUMN__INSERTABLE:
+ setInsertable((Boolean)newValue);
+ return;
+ case OrmPackage.XML_ORDER_COLUMN__UPDATABLE:
+ setUpdatable((Boolean)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ORDER_COLUMN__NULLABLE:
+ setNullable(NULLABLE_EDEFAULT);
+ return;
+ case OrmPackage.XML_ORDER_COLUMN__INSERTABLE:
+ setInsertable(INSERTABLE_EDEFAULT);
+ return;
+ case OrmPackage.XML_ORDER_COLUMN__UPDATABLE:
+ setUpdatable(UPDATABLE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_ORDER_COLUMN__NULLABLE:
+ return NULLABLE_EDEFAULT == null ? nullable != null : !NULLABLE_EDEFAULT.equals(nullable);
+ case OrmPackage.XML_ORDER_COLUMN__INSERTABLE:
+ return INSERTABLE_EDEFAULT == null ? insertable != null : !INSERTABLE_EDEFAULT.equals(insertable);
+ case OrmPackage.XML_ORDER_COLUMN__UPDATABLE:
+ return UPDATABLE_EDEFAULT == null ? updatable != null : !UPDATABLE_EDEFAULT.equals(updatable);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlOrderColumn_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_ORDER_COLUMN__NULLABLE: return OrmV2_0Package.XML_ORDER_COLUMN_20__NULLABLE;
+ case OrmPackage.XML_ORDER_COLUMN__INSERTABLE: return OrmV2_0Package.XML_ORDER_COLUMN_20__INSERTABLE;
+ case OrmPackage.XML_ORDER_COLUMN__UPDATABLE: return OrmV2_0Package.XML_ORDER_COLUMN_20__UPDATABLE;
+ 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 == XmlOrderColumn_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_ORDER_COLUMN_20__NULLABLE: return OrmPackage.XML_ORDER_COLUMN__NULLABLE;
+ case OrmV2_0Package.XML_ORDER_COLUMN_20__INSERTABLE: return OrmPackage.XML_ORDER_COLUMN__INSERTABLE;
+ case OrmV2_0Package.XML_ORDER_COLUMN_20__UPDATABLE: return OrmPackage.XML_ORDER_COLUMN__UPDATABLE;
+ 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(" (nullable: ");
+ result.append(nullable);
+ result.append(", insertable: ");
+ result.append(insertable);
+ result.append(", updatable: ");
+ result.append(updatable);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildNullableTranslator(),
+ buildInsertableTranslator(),
+ buildUpdatableTranslator(),
+ buildColumnDefinitionTranslator(),
+ };
+ }
+
+ protected static Translator buildNullableTranslator() {
+ return new BooleanTranslator(JPA.NULLABLE, OrmV2_0Package.eINSTANCE.getXmlOrderColumn_2_0_Nullable(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildInsertableTranslator() {
+ return new BooleanTranslator(JPA.INSERTABLE, OrmV2_0Package.eINSTANCE.getXmlOrderColumn_2_0_Insertable(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildUpdatableTranslator() {
+ return new BooleanTranslator(JPA.UPDATABLE, OrmV2_0Package.eINSTANCE.getXmlOrderColumn_2_0_Updatable(), Translator.DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderable.java
new file mode 100644
index 0000000000..d7d50139d2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderable.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Orderable</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable#getOrderBy <em>Order By</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOrderable()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlOrderable extends XmlOrderable_2_0
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOrderable_OrderBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getOrderBy();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable#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);
+
+} // XmlOrderable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOverride.java
new file mode 100644
index 0000000000..879c065560
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOverride.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Override</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlOverride#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlOverride()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlOverride extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlOverride_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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
+ */
+ void setName(String value);
+
+ TextRange getNameTextRange();
+} // XmlOverride
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitDefaults.java
new file mode 100644
index 0000000000..bfd2f6ff02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitDefaults.java
@@ -0,0 +1,727 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.EmptyTagBooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlPersistence Unit Defaults</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#isCascadePersist <em>Cascade Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#getEntityListeners <em>Entity Listeners</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlPersistenceUnitDefaults extends AbstractJpaEObject implements XmlAccessHolder, XmlPersistenceUnitDefaults_2_0
+{
+ /**
+ * 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 #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 default value of the '{@link #isDelimitedIdentifiers() <em>Delimited Identifiers</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isDelimitedIdentifiers()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean DELIMITED_IDENTIFIERS_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isDelimitedIdentifiers() <em>Delimited Identifiers</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isDelimitedIdentifiers()
+ * @generated
+ * @ordered
+ */
+ protected boolean delimitedIdentifiers = DELIMITED_IDENTIFIERS_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;
+
+ /**
+ * 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 XmlPersistenceUnitDefaults()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_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.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults_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.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults_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.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.XML_PERSISTENCE_UNIT_DEFAULTS__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlAccessHolder_Access()
+ * @model
+ * @generated
+ */
+ public AccessType getAccess()
+ {
+ return access;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.jpa.core.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.XML_PERSISTENCE_UNIT_DEFAULTS__ACCESS, oldAccess, access));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults_2_0_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.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.XML_PERSISTENCE_UNIT_DEFAULTS__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Delimited Identifiers</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Delimited Identifiers</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Delimited Identifiers</em>' attribute.
+ * @see #setDelimitedIdentifiers(boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults_2_0_DelimitedIdentifiers()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isDelimitedIdentifiers()
+ {
+ return delimitedIdentifiers;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults#isDelimitedIdentifiers <em>Delimited Identifiers</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Delimited Identifiers</em>' attribute.
+ * @see #isDelimitedIdentifiers()
+ * @generated
+ */
+ public void setDelimitedIdentifiers(boolean newDelimitedIdentifiers)
+ {
+ boolean oldDelimitedIdentifiers = delimitedIdentifiers;
+ delimitedIdentifiers = newDelimitedIdentifiers;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS, oldDelimitedIdentifiers, delimitedIdentifiers));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults_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.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.XML_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.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitDefaults_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.XML_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.jpa.core.resource.orm.XmlPersistenceUnitDefaults#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.XML_PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS, null, msgs);
+ if (newEntityListeners != null)
+ msgs = ((InternalEObject)newEntityListeners).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_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.XML_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.XML_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.XML_PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ return getAccess();
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS:
+ return isDelimitedIdentifiers();
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ return getSchema();
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ return getCatalog();
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ return isCascadePersist();
+ case OrmPackage.XML_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.XML_PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ setAccess((AccessType)newValue);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS:
+ setDelimitedIdentifiers((Boolean)newValue);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ setCascadePersist((Boolean)newValue);
+ return;
+ case OrmPackage.XML_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.XML_PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ setAccess(ACCESS_EDEFAULT);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS:
+ setDelimitedIdentifiers(DELIMITED_IDENTIFIERS_EDEFAULT);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ setCascadePersist(CASCADE_PERSIST_EDEFAULT);
+ return;
+ case OrmPackage.XML_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.XML_PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ return access != ACCESS_EDEFAULT;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS:
+ return delimitedIdentifiers != DELIMITED_IDENTIFIERS_EDEFAULT;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ return cascadePersist != CASCADE_PERSIST_EDEFAULT;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS:
+ return entityListeners != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlPersistenceUnitDefaults_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DESCRIPTION: return OrmV2_0Package.XML_PERSISTENCE_UNIT_DEFAULTS_20__DESCRIPTION;
+ case OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS: return OrmV2_0Package.XML_PERSISTENCE_UNIT_DEFAULTS_20__DELIMITED_IDENTIFIERS;
+ 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 == XmlPersistenceUnitDefaults_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_PERSISTENCE_UNIT_DEFAULTS_20__DESCRIPTION: return OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DESCRIPTION;
+ case OrmV2_0Package.XML_PERSISTENCE_UNIT_DEFAULTS_20__DELIMITED_IDENTIFIERS: return OrmPackage.XML_PERSISTENCE_UNIT_DEFAULTS__DELIMITED_IDENTIFIERS;
+ 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(" (access: ");
+ result.append(access);
+ result.append(", description: ");
+ result.append(description);
+ result.append(", delimitedIdentifiers: ");
+ result.append(delimitedIdentifiers);
+ result.append(", schema: ");
+ result.append(schema);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", cascadePersist: ");
+ result.append(cascadePersist);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildDescriptionTranslator(),
+ buildSchemaTranslator(),
+ buildCatalogTranslator(),
+ buildDelimitedIdentifiersTranslator(),
+ buildAccessTranslator(),
+ buildCascadePersistTranslator(),
+ buildEntityListenersTranslator()
+ };
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlPersistenceUnitDefaults_2_0_Description());
+ }
+
+ protected static Translator buildSchemaTranslator() {
+ return new Translator(JPA.SCHEMA, OrmPackage.eINSTANCE.getXmlPersistenceUnitDefaults_Schema());
+ }
+
+ protected static Translator buildCatalogTranslator() {
+ return new Translator(JPA.CATALOG, OrmPackage.eINSTANCE.getXmlPersistenceUnitDefaults_Catalog());
+ }
+
+ protected static Translator buildDelimitedIdentifiersTranslator() {
+ return new EmptyTagBooleanTranslator(JPA2_0.DELIMITIED_IDENTIFIERS, OrmV2_0Package.eINSTANCE.getXmlPersistenceUnitDefaults_2_0_DelimitedIdentifiers());
+ }
+
+ protected static Translator buildAccessTranslator() {
+ return new Translator(JPA.ACCESS, OrmPackage.eINSTANCE.getXmlAccessHolder_Access());
+ }
+
+ protected static Translator buildCascadePersistTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.CASCADE_PERSIST, OrmPackage.eINSTANCE.getXmlPersistenceUnitDefaults_CascadePersist());
+ }
+
+ protected static Translator buildEntityListenersTranslator() {
+ return EntityListeners.buildTranslator(JPA.ENTITY_LISTENERS, OrmPackage.eINSTANCE.getXmlPersistenceUnitDefaults_EntityListeners());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitMetadata.java
new file mode 100644
index 0000000000..b2617324dd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitMetadata.java
@@ -0,0 +1,394 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.EmptyTagBooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlPersistence Unit Metadata</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata#getPersistenceUnitDefaults <em>Persistence Unit Defaults</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitMetadata()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlPersistenceUnitMetadata extends AbstractJpaEObject implements XmlPersistenceUnitMetadata_2_0
+{
+ /**
+ * 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 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 XmlPersistenceUnitDefaults persistenceUnitDefaults;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlPersistenceUnitMetadata()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_PERSISTENCE_UNIT_METADATA;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitMetadata_2_0_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.jpa.core.resource.orm.XmlPersistenceUnitMetadata#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.XML_PERSISTENCE_UNIT_METADATA__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitMetadata_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.jpa.core.resource.orm.XmlPersistenceUnitMetadata#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.XML_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(XmlPersistenceUnitDefaults)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPersistenceUnitMetadata_PersistenceUnitDefaults()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlPersistenceUnitDefaults getPersistenceUnitDefaults()
+ {
+ return persistenceUnitDefaults;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPersistenceUnitDefaults(XmlPersistenceUnitDefaults newPersistenceUnitDefaults, NotificationChain msgs)
+ {
+ XmlPersistenceUnitDefaults oldPersistenceUnitDefaults = persistenceUnitDefaults;
+ persistenceUnitDefaults = newPersistenceUnitDefaults;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_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.jpa.core.resource.orm.XmlPersistenceUnitMetadata#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(XmlPersistenceUnitDefaults newPersistenceUnitDefaults)
+ {
+ if (newPersistenceUnitDefaults != persistenceUnitDefaults)
+ {
+ NotificationChain msgs = null;
+ if (persistenceUnitDefaults != null)
+ msgs = ((InternalEObject)persistenceUnitDefaults).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS, null, msgs);
+ if (newPersistenceUnitDefaults != null)
+ msgs = ((InternalEObject)newPersistenceUnitDefaults).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_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.XML_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.XML_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.XML_PERSISTENCE_UNIT_METADATA__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ return isXmlMappingMetadataComplete();
+ case OrmPackage.XML_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.XML_PERSISTENCE_UNIT_METADATA__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ setXmlMappingMetadataComplete((Boolean)newValue);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS:
+ setPersistenceUnitDefaults((XmlPersistenceUnitDefaults)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ setXmlMappingMetadataComplete(XML_MAPPING_METADATA_COMPLETE_EDEFAULT);
+ return;
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS:
+ setPersistenceUnitDefaults((XmlPersistenceUnitDefaults)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ return xmlMappingMetadataComplete != XML_MAPPING_METADATA_COMPLETE_EDEFAULT;
+ case OrmPackage.XML_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(" (description: ");
+ result.append(description);
+ result.append(", xmlMappingMetadataComplete: ");
+ result.append(xmlMappingMetadataComplete);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildDescriptionTranslator(),
+ buildXmlMappingMetadataCompleteTranslator(),
+ XmlPersistenceUnitDefaults.buildTranslator(JPA.PERSISTENCE_UNIT_DEFAULTS, OrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata_PersistenceUnitDefaults())
+ };
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlPersistenceUnitMetadata_2_0_Description());
+ }
+
+ protected static Translator buildXmlMappingMetadataCompleteTranslator() {
+ return new EmptyTagBooleanTranslator(JPA.XML_MAPPING_METADATA_COMPLETE, OrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata_XmlMappingMetadataComplete());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..7a72d355b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumn.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Primary Key Join Column Impl</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlPrimaryKeyJoinColumn extends AbstractXmlNamedColumn
+{
+ /**
+ * 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 XmlPrimaryKeyJoinColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_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 #setReferencedColumnName(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumn_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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn#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.XML_PRIMARY_KEY_JOIN_COLUMN__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.XML_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.XML_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.XML_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.XML_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(" (referencedColumnName: ");
+ result.append(referencedColumnName);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getReferencedColumnNameTextRange() {
+ return getAttributeTextRange(JPA.REFERENCED_COLUMN_NAME);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildReferencedColumnNameTranslator(),
+ buildColumnDefinitionTranslator(),
+ };
+ }
+
+ protected static Translator buildReferencedColumnNameTranslator() {
+ return new Translator(JPA.REFERENCED_COLUMN_NAME, OrmPackage.eINSTANCE.getXmlPrimaryKeyJoinColumn_ReferencedColumnName(), Translator.DOM_ATTRIBUTE);
+ }
+
+} // XmlPrimaryKeyJoinColumnImpl
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumnContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumnContainer.java
new file mode 100644
index 0000000000..9f23754f8c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumnContainer.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Primary Key Join Column Container</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlPrimaryKeyJoinColumnContainer extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnContainer_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+
+} // XmlPrimaryKeyJoinColumnContainer
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQuery.java
new file mode 100644
index 0000000000..9161893293
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQuery.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Query</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#getQuery <em>Query</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#getHints <em>Hints</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQuery()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlQuery extends XmlQuery_2_0
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#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>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.jpa.core.resource.orm.OrmPackage#getXmlQuery_Query()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getQuery();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQuery#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
+ */
+ void setQuery(String value);
+
+ /**
+ * Returns the value of the '<em><b>Hints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlQuery_Hints()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlQueryHint> getHints();
+
+ public TextRange getNameTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryContainer.java
new file mode 100644
index 0000000000..12f9387dba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryContainer.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Queries Holder</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer#getNamedQueries <em>Named Queries</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer#getNamedNativeQueries <em>Named Native Queries</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlQueryContainer extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer_NamedQueries()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlNamedQuery> 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.jpa.core.resource.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.jpa.core.resource.orm.OrmPackage#getXmlQueryContainer_NamedNativeQueries()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlNamedNativeQuery> getNamedNativeQueries();
+
+} // XmlQueriesHolder
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryHint.java
new file mode 100644
index 0000000000..a798b5aa55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryHint.java
@@ -0,0 +1,366 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Query Hint</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint#getValue <em>Value</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlQueryHint()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlQueryHint extends AbstractJpaEObject implements XmlQueryHint_2_0
+{
+ /**
+ * 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 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlQueryHint()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_QUERY_HINT;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlQueryHint_2_0_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.jpa.core.resource.orm.XmlQueryHint#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.XML_QUERY_HINT__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlQueryHint_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.jpa.core.resource.orm.XmlQueryHint#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_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.jpa.core.resource.orm.OrmPackage#getXmlQueryHint_Value()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint#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_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 OrmPackage.XML_QUERY_HINT__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_QUERY_HINT__NAME:
+ return getName();
+ case OrmPackage.XML_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 OrmPackage.XML_QUERY_HINT__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_QUERY_HINT__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_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 OrmPackage.XML_QUERY_HINT__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_QUERY_HINT__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_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 OrmPackage.XML_QUERY_HINT__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_QUERY_HINT__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_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 String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (description: ");
+ result.append(description);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", value: ");
+ result.append(value);
+ result.append(')');
+ return result.toString();
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildValueTranslator(),
+ buildDescriptionTranslator()
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlQueryHint_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildValueTranslator() {
+ return new Translator(JPA.VALUE, OrmPackage.eINSTANCE.getXmlQueryHint_Value(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlQueryHint_2_0_Description());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlReferenceTable.java
new file mode 100644
index 0000000000..5e739e65bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlReferenceTable.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Reference Table</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable#getJoinColumns <em>Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlReferenceTable()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlReferenceTable extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlReferenceTable_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlJoinColumn> getJoinColumns();
+
+} // XmlReferenceTable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java
new file mode 100644
index 0000000000..6571012254
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Secondary Table Impl</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSecondaryTable()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlSecondaryTable extends AbstractXmlTable
+{
+ /**
+ * 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<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlSecondaryTable()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_SECONDARY_TABLE;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlSecondaryTable_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns()
+ {
+ if (primaryKeyJoinColumns == null)
+ {
+ primaryKeyJoinColumns = new EObjectContainmentEList<XmlPrimaryKeyJoinColumn>(XmlPrimaryKeyJoinColumn.class, this, OrmPackage.XML_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.XML_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.XML_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.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ getPrimaryKeyJoinColumns().addAll((Collection<? extends XmlPrimaryKeyJoinColumn>)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__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.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS:
+ return primaryKeyJoinColumns != null && !primaryKeyJoinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildCatalogTranslator(),
+ buildSchemaTranslator(),
+ buildPrimaryKeyJoinColumnsTranslator(),
+ buildUniqueConstraintTranslator()
+ };
+ }
+
+ protected static Translator buildPrimaryKeyJoinColumnsTranslator() {
+ return XmlPrimaryKeyJoinColumn.buildTranslator(JPA.PRIMARY_KEY_JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlSecondaryTable_PrimaryKeyJoinColumns());
+ }
+
+} // XmlSecondaryTableImpl
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSequenceGenerator.java
new file mode 100644
index 0000000000..8ec8b8ca5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSequenceGenerator.java
@@ -0,0 +1,702 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Sequence Generator</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator#getSequenceName <em>Sequence Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSequenceGenerator()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlSequenceGenerator extends AbstractJpaEObject implements XmlGenerator, XmlSequenceGenerator_2_0
+{
+ /**
+ * 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 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 #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 #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 XmlSequenceGenerator()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_SEQUENCE_GENERATOR;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_2_0_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.jpa.core.resource.orm.XmlSequenceGenerator#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.XML_SEQUENCE_GENERATOR__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_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.jpa.core.resource.orm.XmlSequenceGenerator#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_SEQUENCE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlSequenceGenerator_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.jpa.core.resource.orm.XmlSequenceGenerator#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.XML_SEQUENCE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_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.jpa.core.resource.orm.XmlSequenceGenerator#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.XML_SEQUENCE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_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.jpa.core.resource.orm.XmlSequenceGenerator#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.XML_SEQUENCE_GENERATOR__ALLOCATION_SIZE, oldAllocationSize, allocationSize));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlSequenceGenerator_2_0_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.jpa.core.resource.orm.XmlSequenceGenerator#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.XML_SEQUENCE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlSequenceGenerator_2_0_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.jpa.core.resource.orm.XmlSequenceGenerator#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.XML_SEQUENCE_GENERATOR__SCHEMA, oldSchema, schema));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_SEQUENCE_GENERATOR__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_SEQUENCE_GENERATOR__NAME:
+ return getName();
+ case OrmPackage.XML_SEQUENCE_GENERATOR__INITIAL_VALUE:
+ return getInitialValue();
+ case OrmPackage.XML_SEQUENCE_GENERATOR__ALLOCATION_SIZE:
+ return getAllocationSize();
+ case OrmPackage.XML_SEQUENCE_GENERATOR__CATALOG:
+ return getCatalog();
+ case OrmPackage.XML_SEQUENCE_GENERATOR__SCHEMA:
+ return getSchema();
+ case OrmPackage.XML_SEQUENCE_GENERATOR__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.XML_SEQUENCE_GENERATOR__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__INITIAL_VALUE:
+ setInitialValue((Integer)newValue);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__ALLOCATION_SIZE:
+ setAllocationSize((Integer)newValue);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__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.XML_SEQUENCE_GENERATOR__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__INITIAL_VALUE:
+ setInitialValue(INITIAL_VALUE_EDEFAULT);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__ALLOCATION_SIZE:
+ setAllocationSize(ALLOCATION_SIZE_EDEFAULT);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__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.XML_SEQUENCE_GENERATOR__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_SEQUENCE_GENERATOR__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_SEQUENCE_GENERATOR__INITIAL_VALUE:
+ return INITIAL_VALUE_EDEFAULT == null ? initialValue != null : !INITIAL_VALUE_EDEFAULT.equals(initialValue);
+ case OrmPackage.XML_SEQUENCE_GENERATOR__ALLOCATION_SIZE:
+ return ALLOCATION_SIZE_EDEFAULT == null ? allocationSize != null : !ALLOCATION_SIZE_EDEFAULT.equals(allocationSize);
+ case OrmPackage.XML_SEQUENCE_GENERATOR__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.XML_SEQUENCE_GENERATOR__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.XML_SEQUENCE_GENERATOR__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 int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlSequenceGenerator_2_0.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_SEQUENCE_GENERATOR__CATALOG: return OrmV2_0Package.XML_SEQUENCE_GENERATOR_20__CATALOG;
+ case OrmPackage.XML_SEQUENCE_GENERATOR__SCHEMA: return OrmV2_0Package.XML_SEQUENCE_GENERATOR_20__SCHEMA;
+ 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 == XmlSequenceGenerator_2_0.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmV2_0Package.XML_SEQUENCE_GENERATOR_20__CATALOG: return OrmPackage.XML_SEQUENCE_GENERATOR__CATALOG;
+ case OrmV2_0Package.XML_SEQUENCE_GENERATOR_20__SCHEMA: return OrmPackage.XML_SEQUENCE_GENERATOR__SCHEMA;
+ 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(" (description: ");
+ result.append(description);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", initialValue: ");
+ result.append(initialValue);
+ result.append(", allocationSize: ");
+ result.append(allocationSize);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", schema: ");
+ result.append(schema);
+ result.append(", sequenceName: ");
+ result.append(sequenceName);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildSequenceNameTranslator(),
+ buildInitialValueTranslator(),
+ buildAllocationSizeTranslator(),
+ buildCatalogTranslator(),
+ buildSchemaTranslator(),
+ buildDescriptionTranslator(),
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlGenerator_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildSequenceNameTranslator() {
+ return new Translator(JPA.SEQUENCE_NAME, OrmPackage.eINSTANCE.getXmlSequenceGenerator_SequenceName(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildInitialValueTranslator() {
+ return new Translator(JPA.INITIAL_VALUE, OrmPackage.eINSTANCE.getXmlGenerator_InitialValue(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildAllocationSizeTranslator() {
+ return new Translator(JPA.ALLOCATION_SIZE, OrmPackage.eINSTANCE.getXmlGenerator_AllocationSize(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlGenerator_2_0_Description());
+ }
+
+ protected static Translator buildCatalogTranslator() {
+ return new Translator(JPA.CATALOG, OrmV2_0Package.eINSTANCE.getXmlSequenceGenerator_2_0_Catalog(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildSchemaTranslator() {
+ return new Translator(JPA.SCHEMA, OrmV2_0Package.eINSTANCE.getXmlSequenceGenerator_2_0_Schema(), Translator.DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTable.java
new file mode 100644
index 0000000000..76c9db8b4f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTable.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Table</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTable()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlTable extends AbstractXmlTable
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlTable()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_TABLE;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildCatalogTranslator(),
+ buildSchemaTranslator(),
+ buildUniqueConstraintTranslator()
+ };
+ }
+
+} // Table
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTableGenerator.java
new file mode 100644
index 0000000000..688ec44842
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTableGenerator.java
@@ -0,0 +1,947 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Table Generator</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getTable <em>Table</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getPkColumnName <em>Pk Column Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getValueColumnName <em>Value Column Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getPkColumnValue <em>Pk Column Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator#getUniqueConstraints <em>Unique Constraints</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlTableGenerator extends AbstractJpaEObject implements XmlGenerator
+{
+ /**
+ * 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 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<XmlUniqueConstraint> 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;
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_2_0_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.OrmPackage#getXmlGenerator_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.jpa.core.resource.orm.XmlTableGenerator#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.XML_TABLE_GENERATOR__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.jpa.core.resource.orm.XmlUniqueConstraint}.
+ * <!-- 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.jpa.core.resource.orm.OrmPackage#getXmlTableGenerator_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlUniqueConstraint> getUniqueConstraints()
+ {
+ if (uniqueConstraints == null)
+ {
+ uniqueConstraints = new EObjectContainmentEList<XmlUniqueConstraint>(XmlUniqueConstraint.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__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.XML_TABLE_GENERATOR__NAME:
+ return getName();
+ case OrmPackage.XML_TABLE_GENERATOR__INITIAL_VALUE:
+ return getInitialValue();
+ case OrmPackage.XML_TABLE_GENERATOR__ALLOCATION_SIZE:
+ return getAllocationSize();
+ case OrmPackage.XML_TABLE_GENERATOR__TABLE:
+ return getTable();
+ case OrmPackage.XML_TABLE_GENERATOR__CATALOG:
+ return getCatalog();
+ case OrmPackage.XML_TABLE_GENERATOR__SCHEMA:
+ return getSchema();
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME:
+ return getPkColumnName();
+ case OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME:
+ return getValueColumnName();
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE:
+ return getPkColumnValue();
+ 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__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__INITIAL_VALUE:
+ setInitialValue((Integer)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__ALLOCATION_SIZE:
+ setAllocationSize((Integer)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__TABLE:
+ setTable((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME:
+ setPkColumnName((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME:
+ setValueColumnName((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE:
+ setPkColumnValue((String)newValue);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ getUniqueConstraints().addAll((Collection<? extends XmlUniqueConstraint>)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__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__INITIAL_VALUE:
+ setInitialValue(INITIAL_VALUE_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__ALLOCATION_SIZE:
+ setAllocationSize(ALLOCATION_SIZE_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__TABLE:
+ setTable(TABLE_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME:
+ setPkColumnName(PK_COLUMN_NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME:
+ setValueColumnName(VALUE_COLUMN_NAME_EDEFAULT);
+ return;
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE:
+ setPkColumnValue(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__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.XML_TABLE_GENERATOR__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.XML_TABLE_GENERATOR__INITIAL_VALUE:
+ return INITIAL_VALUE_EDEFAULT == null ? initialValue != null : !INITIAL_VALUE_EDEFAULT.equals(initialValue);
+ case OrmPackage.XML_TABLE_GENERATOR__ALLOCATION_SIZE:
+ return ALLOCATION_SIZE_EDEFAULT == null ? allocationSize != null : !ALLOCATION_SIZE_EDEFAULT.equals(allocationSize);
+ case OrmPackage.XML_TABLE_GENERATOR__TABLE:
+ return TABLE_EDEFAULT == null ? table != null : !TABLE_EDEFAULT.equals(table);
+ case OrmPackage.XML_TABLE_GENERATOR__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.XML_TABLE_GENERATOR__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME:
+ return PK_COLUMN_NAME_EDEFAULT == null ? pkColumnName != null : !PK_COLUMN_NAME_EDEFAULT.equals(pkColumnName);
+ case OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME:
+ return VALUE_COLUMN_NAME_EDEFAULT == null ? valueColumnName != null : !VALUE_COLUMN_NAME_EDEFAULT.equals(valueColumnName);
+ case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE:
+ return PK_COLUMN_VALUE_EDEFAULT == null ? pkColumnValue != null : !PK_COLUMN_VALUE_EDEFAULT.equals(pkColumnValue);
+ 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 String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (description: ");
+ result.append(description);
+ 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();
+ }
+
+ public TextRange getNameTextRange() {
+ return getAttributeTextRange(JPA.NAME);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildTableTranslator(),
+ buildCatalogTranslator(),
+ buildSchemaTranslator(),
+ buildPkColumnNameTranslator(),
+ buildValueColumnNameTranslator(),
+ buildPkColumnValueTranslator(),
+ buildInitialValueTranslator(),
+ buildAllocationSizeTranslator(),
+ buildDescriptionTranslator(),
+ XmlUniqueConstraint.buildTranslator(JPA.UNIQUE_CONSTRAINT, OrmPackage.eINSTANCE.getXmlTableGenerator_UniqueConstraints())
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlGenerator_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildTableTranslator() {
+ return new Translator(JPA.TABLE, OrmPackage.eINSTANCE.getXmlTableGenerator_Table(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildCatalogTranslator() {
+ return new Translator(JPA.CATALOG, OrmPackage.eINSTANCE.getXmlTableGenerator_Catalog(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildSchemaTranslator() {
+ return new Translator(JPA.SCHEMA, OrmPackage.eINSTANCE.getXmlTableGenerator_Schema(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildPkColumnNameTranslator() {
+ return new Translator(JPA.PK_COLUMN_NAME, OrmPackage.eINSTANCE.getXmlTableGenerator_PkColumnName(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildValueColumnNameTranslator() {
+ return new Translator(JPA.VALUE_COLUMN_NAME, OrmPackage.eINSTANCE.getXmlTableGenerator_ValueColumnName(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildPkColumnValueTranslator() {
+ return new Translator(JPA.PK_COLUMN_VALUE, OrmPackage.eINSTANCE.getXmlTableGenerator_PkColumnValue(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildInitialValueTranslator() {
+ return new Translator(JPA.INITIAL_VALUE, OrmPackage.eINSTANCE.getXmlGenerator_InitialValue(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildAllocationSizeTranslator() {
+ return new Translator(JPA.ALLOCATION_SIZE, OrmPackage.eINSTANCE.getXmlGenerator_AllocationSize(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(JPA.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlGenerator_2_0_Description());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTransient.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTransient.java
new file mode 100644
index 0000000000..b51d6e800d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTransient.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Transient</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTransient()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlTransient extends AbstractXmlAttributeMapping
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlTransient()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_TRANSIENT;
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator()
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTypeMapping.java
new file mode 100644
index 0000000000..c43d64f357
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTypeMapping.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.text.edits.ReplaceEdit;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Type Mapping</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#getClassName <em>Class Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#getMetadataComplete <em>Metadata Complete</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#getAttributes <em>Attributes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlTypeMapping extends XmlAccessHolder
+{
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_ClassName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getClassName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#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
+ */
+ void setClassName(String value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_MetadataComplete()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getMetadataComplete();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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 #getMetadataComplete()
+ * @generated
+ */
+ void setMetadataComplete(Boolean value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#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
+ */
+ void setDescription(String value);
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlTypeMapping_Attributes()
+ * @model containment="true"
+ * @generated
+ */
+ Attributes getAttributes();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping#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
+ */
+ void setAttributes(Attributes value);
+
+ TextRange getClassTextRange();
+
+ TextRange getAttributesTextRange();
+
+ TextRange getNameTextRange();
+
+ //TODO not happy with this, or the corresponding one in XmlAttributeMapping
+ String getMappingKey();
+
+
+ // ********** refactoring **********
+
+ ReplaceEdit createRenameTypeEdit(IType originalType, String newName);
+
+ ReplaceEdit createRenamePackageEdit(String newName);
+
+} // XmlTypeMapping
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlUniqueConstraint.java
new file mode 100644
index 0000000000..1d71e8a6ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlUniqueConstraint.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm;
+
+import java.util.Collection;
+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.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EDataTypeEList;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Unique Constraint</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint#getColumnNames <em>Column Names</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlUniqueConstraint()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlUniqueConstraint extends AbstractJpaEObject implements XmlUniqueConstraint_2_0
+{
+ /**
+ * 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 #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>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.jpa.core.resource.orm.OrmPackage#getXmlUniqueConstraint_2_0_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.jpa.core.resource.orm.XmlUniqueConstraint#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_UNIQUE_CONSTRAINT__NAME, oldName, name));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlUniqueConstraint_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.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__NAME:
+ return getName();
+ 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__NAME:
+ setName((String)newValue);
+ return;
+ 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__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ 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__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ 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 String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", columnNames: ");
+ result.append(columnNames);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildColumnNameTranslator(),
+ };
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(JPA.NAME, OrmV2_0Package.eINSTANCE.getXmlUniqueConstraint_2_0_Name(), Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildColumnNameTranslator() {
+ return new Translator(JPA.COLUMN_NAME, OrmPackage.eINSTANCE.getXmlUniqueConstraint_ColumnNames());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlVersion.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlVersion.java
new file mode 100644
index 0000000000..d4b466b7f5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlVersion.java
@@ -0,0 +1,523 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Version</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlVersion()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlVersion extends AbstractXmlAttributeMapping implements ColumnMapping, XmlConvertibleMapping
+{
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected XmlColumn 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;
+ /**
+ * 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 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.ORDINAL;
+ /**
+ * 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 XmlVersion()
+ {
+ super();
+ }
+
+ /**
+ * <!-- 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 #setColumn(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlColumn getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(XmlColumn newColumn, NotificationChain msgs)
+ {
+ XmlColumn 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;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlVersion#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(XmlColumn newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_VERSION__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_VERSION__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_VERSION__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * 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.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_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.jpa.core.resource.orm.XmlVersion#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_VERSION__LOB, oldLob, lob));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Temporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getTemporal()
+ {
+ return temporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.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.jpa.core.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.XML_VERSION__TEMPORAL, oldTemporal, temporal));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlConvertibleMapping_Enumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getEnumerated()
+ {
+ return enumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlVersion#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.jpa.core.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.XML_VERSION__ENUMERATED, oldEnumerated, enumerated));
+ }
+
+ /**
+ * <!-- 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__LOB:
+ return isLob();
+ case OrmPackage.XML_VERSION__TEMPORAL:
+ return getTemporal();
+ case OrmPackage.XML_VERSION__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.XML_VERSION__COLUMN:
+ setColumn((XmlColumn)newValue);
+ return;
+ case OrmPackage.XML_VERSION__LOB:
+ setLob((Boolean)newValue);
+ return;
+ case OrmPackage.XML_VERSION__TEMPORAL:
+ setTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.XML_VERSION__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.XML_VERSION__COLUMN:
+ setColumn((XmlColumn)null);
+ return;
+ case OrmPackage.XML_VERSION__LOB:
+ setLob(LOB_EDEFAULT);
+ return;
+ case OrmPackage.XML_VERSION__TEMPORAL:
+ setTemporal(TEMPORAL_EDEFAULT);
+ return;
+ case OrmPackage.XML_VERSION__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.XML_VERSION__COLUMN:
+ return column != null;
+ case OrmPackage.XML_VERSION__LOB:
+ return lob != LOB_EDEFAULT;
+ case OrmPackage.XML_VERSION__TEMPORAL:
+ return temporal != TEMPORAL_EDEFAULT;
+ case OrmPackage.XML_VERSION__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.XML_VERSION__COLUMN: return OrmPackage.COLUMN_MAPPING__COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_VERSION__LOB: return OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+ case OrmPackage.XML_VERSION__TEMPORAL: return OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+ case OrmPackage.XML_VERSION__ENUMERATED: return OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+ 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.XML_VERSION__COLUMN;
+ default: return -1;
+ }
+ }
+ if (baseClass == XmlConvertibleMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__LOB: return OrmPackage.XML_VERSION__LOB;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL: return OrmPackage.XML_VERSION__TEMPORAL;
+ case OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED: return OrmPackage.XML_VERSION__ENUMERATED;
+ 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(" (lob: ");
+ result.append(lob);
+ result.append(", temporal: ");
+ result.append(temporal);
+ result.append(", enumerated: ");
+ result.append(enumerated);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange getEnumeratedTextRange() {
+ throw new UnsupportedOperationException("enumerated not supported by version mappings");
+ }
+
+ public TextRange getLobTextRange() {
+ throw new UnsupportedOperationException("lob not supported by version mappings");
+ }
+
+ public TextRange getTemporalTextRange() {
+ return getAttributeTextRange(JPA.TEMPORAL);
+ }
+
+ public String getMappingKey() {
+ return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildAccessTranslator(),
+ buildColumnTranslator(),
+ buildTemporalTranslator(),
+ };
+ }
+
+ protected static Translator buildColumnTranslator() {
+ return XmlColumn.buildTranslator(JPA.COLUMN, OrmPackage.eINSTANCE.getColumnMapping_Column());
+ }
+
+ protected static Translator buildTemporalTranslator() {
+ return new Translator(JPA.TEMPORAL, OrmPackage.eINSTANCE.getXmlConvertibleMapping_Temporal());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/JPA2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/JPA2_0.java
new file mode 100644
index 0000000000..8b58b67f87
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/JPA2_0.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.orm.JPA;
+
+/**
+ * JPA 2.0 orm.xml-related stuff (elements, attributes etc.)
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+@SuppressWarnings("nls")
+public interface JPA2_0
+ extends JPA
+{
+ String SCHEMA_NAMESPACE = JPA.SCHEMA_NAMESPACE;
+ String SCHEMA_LOCATION = "http://java.sun.com/xml/ns/persistence/orm_2_0.xsd";
+ String SCHEMA_VERSION = "2.0";
+
+ // JPA 2.0 specific nodes
+
+ String CACHEABLE = "cacheable";
+ String COLLECTION_TABLE = "collection-table";
+ String DELIMITIED_IDENTIFIERS = "delimited-identifiers";
+ String ELEMENT_COLLECTION = "element-collection";
+ String MAP_KEY_ATTRIBUTE_OVERRIDE = "map-key-attribute-override";
+ String MAP_KEY_CLASS = "map-key-class";
+ String MAP_KEY_COLUMN = "map-key-column";
+ String MAP_KEY_CONVERT = "map-key-convert";
+ String MAP_KEY_ENUMERATED = "map-key-enumerated";
+ String MAP_KEY_JOIN_COLUMN = "map-key-join-column";
+ String MAPS_ID = "maps-id";
+ String NAMED_QUERY__LOCK_MODE = "lock-mode";
+ String ORDER_COLUMN = "order-column";
+ String ORPHAN_REMOVAL = "orphan-removal";
+ String TARGET_CLASS = "target-class";
+ String MAP_KEY_TEMPORAL = "map-key-temporal";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/LockModeType_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/LockModeType_2_0.java
new file mode 100644
index 0000000000..e589259108
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/LockModeType_2_0.java
@@ -0,0 +1,397 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+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>Lock Mode Type 20</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getLockModeType_2_0()
+ * @model
+ * @generated
+ */
+public enum LockModeType_2_0 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>READ</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #READ_VALUE
+ * @generated
+ * @ordered
+ */
+ READ(1, "READ", "READ"),
+
+ /**
+ * The '<em><b>WRITE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #WRITE_VALUE
+ * @generated
+ * @ordered
+ */
+ WRITE(2, "WRITE", "WRITE"),
+
+ /**
+ * The '<em><b>OPTIMISTIC</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #OPTIMISTIC_VALUE
+ * @generated
+ * @ordered
+ */
+ OPTIMISTIC(3, "OPTIMISTIC", "OPTIMISTIC"),
+
+ /**
+ * The '<em><b>OPTIMISTIC FORCE INCREMENT</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #OPTIMISTIC_FORCE_INCREMENT_VALUE
+ * @generated
+ * @ordered
+ */
+ OPTIMISTIC_FORCE_INCREMENT(4, "OPTIMISTIC_FORCE_INCREMENT", "OPTIMISTIC_FORCE_INCREMENT"),
+
+ /**
+ * The '<em><b>PESSIMISTIC READ</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #PESSIMISTIC_READ_VALUE
+ * @generated
+ * @ordered
+ */
+ PESSIMISTIC_READ(5, "PESSIMISTIC_READ", "PESSIMISTIC_READ"),
+
+ /**
+ * The '<em><b>PESSIMISTIC WRITE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #PESSIMISTIC_WRITE_VALUE
+ * @generated
+ * @ordered
+ */
+ PESSIMISTIC_WRITE(6, "PESSIMISTIC_WRITE", "PESSIMISTIC_WRITE"),
+
+ /**
+ * The '<em><b>PESSIMISTIC FORCE INCREMENT</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #PESSIMISTIC_FORCE_INCREMENT_VALUE
+ * @generated
+ * @ordered
+ */
+ PESSIMISTIC_FORCE_INCREMENT(7, "PESSIMISTIC_FORCE_INCREMENT", "PESSIMISTIC_FORCE_INCREMENT");
+
+ /**
+ * 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
+ * @generated
+ * @ordered
+ */
+ public static final int NONE_VALUE = 0;
+
+ /**
+ * The '<em><b>READ</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>READ</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #READ
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int READ_VALUE = 1;
+
+ /**
+ * The '<em><b>WRITE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>WRITE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #WRITE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int WRITE_VALUE = 2;
+
+ /**
+ * The '<em><b>OPTIMISTIC</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>OPTIMISTIC</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #OPTIMISTIC
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int OPTIMISTIC_VALUE = 3;
+
+ /**
+ * The '<em><b>OPTIMISTIC FORCE INCREMENT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>OPTIMISTIC FORCE INCREMENT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #OPTIMISTIC_FORCE_INCREMENT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int OPTIMISTIC_FORCE_INCREMENT_VALUE = 4;
+
+ /**
+ * The '<em><b>PESSIMISTIC READ</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>PESSIMISTIC READ</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #PESSIMISTIC_READ
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int PESSIMISTIC_READ_VALUE = 5;
+
+ /**
+ * The '<em><b>PESSIMISTIC WRITE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>PESSIMISTIC WRITE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #PESSIMISTIC_WRITE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int PESSIMISTIC_WRITE_VALUE = 6;
+
+ /**
+ * The '<em><b>PESSIMISTIC FORCE INCREMENT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>PESSIMISTIC FORCE INCREMENT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #PESSIMISTIC_FORCE_INCREMENT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int PESSIMISTIC_FORCE_INCREMENT_VALUE = 7;
+
+ /**
+ * An array of all the '<em><b>Lock Mode Type 20</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final LockModeType_2_0[] VALUES_ARRAY =
+ new LockModeType_2_0[]
+ {
+ NONE,
+ READ,
+ WRITE,
+ OPTIMISTIC,
+ OPTIMISTIC_FORCE_INCREMENT,
+ PESSIMISTIC_READ,
+ PESSIMISTIC_WRITE,
+ PESSIMISTIC_FORCE_INCREMENT,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Lock Mode Type 20</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<LockModeType_2_0> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Lock Mode Type 20</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static LockModeType_2_0 get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ LockModeType_2_0 result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Lock Mode Type 20</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static LockModeType_2_0 getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ LockModeType_2_0 result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Lock Mode Type 20</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static LockModeType_2_0 get(int value)
+ {
+ switch (value)
+ {
+ case NONE_VALUE: return NONE;
+ case READ_VALUE: return READ;
+ case WRITE_VALUE: return WRITE;
+ case OPTIMISTIC_VALUE: return OPTIMISTIC;
+ case OPTIMISTIC_FORCE_INCREMENT_VALUE: return OPTIMISTIC_FORCE_INCREMENT;
+ case PESSIMISTIC_READ_VALUE: return PESSIMISTIC_READ;
+ case PESSIMISTIC_WRITE_VALUE: return PESSIMISTIC_WRITE;
+ case PESSIMISTIC_FORCE_INCREMENT_VALUE: return PESSIMISTIC_FORCE_INCREMENT;
+ }
+ 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 LockModeType_2_0(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;
+ }
+
+} //LockModeType_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Factory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Factory.java
new file mode 100644
index 0000000000..0e9e84a0b6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Factory.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+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.jpa.core.resource.orm.v2_0.OrmV2_0Package
+ * @generated
+ */
+public class OrmV2_0Factory extends EFactoryImpl
+{
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final OrmV2_0Factory eINSTANCE = init();
+
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static OrmV2_0Factory init()
+ {
+ try
+ {
+ OrmV2_0Factory theOrmV2_0Factory = (OrmV2_0Factory)EPackage.Registry.INSTANCE.getEFactory("jpt.orm.v2_0.xmi");
+ if (theOrmV2_0Factory != null)
+ {
+ return theOrmV2_0Factory;
+ }
+ }
+ catch (Exception exception)
+ {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new OrmV2_0Factory();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OrmV2_0Factory()
+ {
+ 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 OrmV2_0Package.LOCK_MODE_TYPE_20:
+ return createLockModeType_2_0FromString(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 OrmV2_0Package.LOCK_MODE_TYPE_20:
+ return convertLockModeType_2_0ToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public LockModeType_2_0 createLockModeType_2_0FromString(EDataType eDataType, String initialValue)
+ {
+ LockModeType_2_0 result = LockModeType_2_0.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 convertLockModeType_2_0ToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OrmV2_0Package getOrmV2_0Package()
+ {
+ return (OrmV2_0Package)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static OrmV2_0Package getPackage()
+ {
+ return OrmV2_0Package.eINSTANCE;
+ }
+
+} //OrmV2_0Factory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java
new file mode 100644
index 0000000000..de0d4b3a0e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java
@@ -0,0 +1,3784 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+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.emf.ecore.xml.type.XMLTypePackage;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.xml.CommonPackage;
+
+/**
+ * <!-- 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.jpa.core.resource.orm.v2_0.OrmV2_0Factory
+ * @model kind="package"
+ * @generated
+ */
+public class OrmV2_0Package extends EPackageImpl
+{
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNAME = "v2_0";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_URI = "jpt.orm.v2_0.xmi";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_PREFIX = "org.eclipse.jpt.jpa.core.resource.orm.v2_0";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final OrmV2_0Package eINSTANCE = org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeMapping_2_0 <em>Xml Attribute Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributeMapping_2_0()
+ * @generated
+ */
+ public static final int XML_ATTRIBUTE_MAPPING_20 = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0 <em>Xml Association Override 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAssociationOverride_2_0()
+ * @generated
+ */
+ public static final int XML_ASSOCIATION_OVERRIDE_20 = 0;
+
+ /**
+ * 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_ASSOCIATION_OVERRIDE_20__JOIN_TABLE = OrmPackage.XML_JOIN_TABLE_CONTAINER__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ASSOCIATION_OVERRIDE_20__DESCRIPTION = OrmPackage.XML_JOIN_TABLE_CONTAINER_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Association Override 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ASSOCIATION_OVERRIDE_20_FEATURE_COUNT = OrmPackage.XML_JOIN_TABLE_CONTAINER_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 XML_ATTRIBUTE_MAPPING_20__ACCESS = OrmPackage.XML_ACCESS_HOLDER__ACCESS;
+
+ /**
+ * The number of structural features of the '<em>Xml Attribute Mapping 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTE_MAPPING_20_FEATURE_COUNT = OrmPackage.XML_ACCESS_HOLDER_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0 <em>Xml Attribute Override 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributeOverride_2_0()
+ * @generated
+ */
+ public static final int XML_ATTRIBUTE_OVERRIDE_20 = 2;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTE_OVERRIDE_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Attribute Override 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTE_OVERRIDE_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0 <em>Xml Attributes 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributes_2_0()
+ * @generated
+ */
+ public static final int XML_ATTRIBUTES_20 = 3;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTES_20__DESCRIPTION = 0;
+
+ /**
+ * The feature id for the '<em><b>Element Collections</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTES_20__ELEMENT_COLLECTIONS = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Attributes 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ATTRIBUTES_20_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCollectionTable_2_0 <em>Xml Collection Table 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCollectionTable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCollectionTable_2_0()
+ * @generated
+ */
+ public static final int XML_COLLECTION_TABLE_20 = 6;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0 <em>Xml Derived Id 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlDerivedId_2_0()
+ * @generated
+ */
+ public static final int XML_DERIVED_ID_20 = 7;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0 <em>Xml Element Collection 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0()
+ * @generated
+ */
+ public static final int XML_ELEMENT_COLLECTION_20 = 8;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEmbedded_2_0 <em>Xml Embedded 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEmbedded_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEmbedded_2_0()
+ * @generated
+ */
+ public static final int XML_EMBEDDED_20 = 9;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0 <em>Xml Cacheable 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCacheable_2_0()
+ * @generated
+ */
+ public static final int XML_CACHEABLE_20 = 4;
+
+ /**
+ * The feature id for the '<em><b>Cacheable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CACHEABLE_20__CACHEABLE = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Cacheable 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CACHEABLE_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0 <em>Xml Cascade Type 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCascadeType_2_0()
+ * @generated
+ */
+ public static final int XML_CASCADE_TYPE_20 = 5;
+
+ /**
+ * The feature id for the '<em><b>Cascade Detach</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CASCADE_TYPE_20__CASCADE_DETACH = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Cascade Type 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_CASCADE_TYPE_20_FEATURE_COUNT = 1;
+
+ /**
+ * 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_COLLECTION_TABLE_20__JOIN_COLUMNS = OrmPackage.XML_REFERENCE_TABLE__JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>Xml Collection Table 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_COLLECTION_TABLE_20_FEATURE_COUNT = OrmPackage.XML_REFERENCE_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_DERIVED_ID_20__ID = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Derived Id 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_DERIVED_ID_20_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__LOB = OrmPackage.XML_CONVERTIBLE_MAPPING__LOB;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__TEMPORAL = OrmPackage.XML_CONVERTIBLE_MAPPING__TEMPORAL;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__ENUMERATED = OrmPackage.XML_CONVERTIBLE_MAPPING__ENUMERATED;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__ORDER_COLUMN = OrmPackage.XML_CONVERTIBLE_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_ELEMENT_COLLECTION_20__ORDER_BY = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * 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_ELEMENT_COLLECTION_20__ATTRIBUTE_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * 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_ELEMENT_COLLECTION_20__ASSOCIATION_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_ATTRIBUTE_OVERRIDES = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Target Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__TARGET_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__FETCH = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * 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 XML_ELEMENT_COLLECTION_20__MAP_KEY = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 8;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 9;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 10;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 11;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 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 XML_ELEMENT_COLLECTION_20__COLUMN = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 13;
+
+ /**
+ * The feature id for the '<em><b>Collection Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20__COLLECTION_TABLE = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 14;
+
+ /**
+ * The number of structural features of the '<em>Xml Element Collection 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ELEMENT_COLLECTION_20_FEATURE_COUNT = OrmPackage.XML_CONVERTIBLE_MAPPING_FEATURE_COUNT + 15;
+
+ /**
+ * 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_EMBEDDED_20__ASSOCIATION_OVERRIDES = OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER__ASSOCIATION_OVERRIDES;
+
+ /**
+ * The number of structural features of the '<em>Xml Embedded 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EMBEDDED_20_FEATURE_COUNT = OrmPackage.XML_ASSOCIATION_OVERRIDE_CONTAINER_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntity_2_0 <em>Xml Entity 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntity_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEntity_2_0()
+ * @generated
+ */
+ public static final int XML_ENTITY_20 = 10;
+
+ /**
+ * The feature id for the '<em><b>Cacheable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_20__CACHEABLE = XML_CACHEABLE_20__CACHEABLE;
+
+ /**
+ * The number of structural features of the '<em>Xml Entity 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_20_FEATURE_COUNT = XML_CACHEABLE_20_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0 <em>Xml Entity Listener 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEntityListener_2_0()
+ * @generated
+ */
+ public static final int XML_ENTITY_LISTENER_20 = 11;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_LISTENER_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Entity Listener 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ENTITY_LISTENER_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0 <em>Xml Event Method 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEventMethod_2_0()
+ * @generated
+ */
+ public static final int XML_EVENT_METHOD_20 = 12;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EVENT_METHOD_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Event Method 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_EVENT_METHOD_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0 <em>Xml Generator 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlGenerator_2_0()
+ * @generated
+ */
+ public static final int XML_GENERATOR_20 = 13;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_GENERATOR_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Generator 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_GENERATOR_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0 <em>Xml Orderable 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderable_2_0()
+ * @generated
+ */
+ public static final int XML_ORDERABLE_20 = 21;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDERABLE_20__ORDER_COLUMN = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Orderable 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDERABLE_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0 <em>Xml Multi Relationship Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0()
+ * @generated
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20 = 17;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__ORDER_COLUMN = XML_ORDERABLE_20__ORDER_COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ATTRIBUTE_OVERRIDES = XML_ORDERABLE_20_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS = XML_ORDERABLE_20_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL = XML_ORDERABLE_20_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED = XML_ORDERABLE_20_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN = XML_ORDERABLE_20_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS = XML_ORDERABLE_20_FEATURE_COUNT + 5;
+
+ /**
+ * The number of structural features of the '<em>Xml Multi Relationship Mapping 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MULTI_RELATIONSHIP_MAPPING_20_FEATURE_COUNT = XML_ORDERABLE_20_FEATURE_COUNT + 6;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlManyToMany_2_0 <em>Xml Many To Many 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlManyToMany_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlManyToMany_2_0()
+ * @generated
+ */
+ public static final int XML_MANY_TO_MANY_20 = 14;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20__ORDER_COLUMN = XML_MULTI_RELATIONSHIP_MAPPING_20__ORDER_COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20__MAP_KEY_ATTRIBUTE_OVERRIDES = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ATTRIBUTE_OVERRIDES;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20__MAP_KEY_CLASS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20__MAP_KEY_TEMPORAL = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20__MAP_KEY_ENUMERATED = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20__MAP_KEY_COLUMN = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20__MAP_KEY_JOIN_COLUMNS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>Xml Many To Many 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MANY_TO_MANY_20_FEATURE_COUNT = XML_MULTI_RELATIONSHIP_MAPPING_20_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0 <em>Xml Map Key Attribute Override Container 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyAttributeOverrideContainer_2_0()
+ * @generated
+ */
+ public static final int XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20 = 15;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Map Key Attribute Override Container 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 <em>Xml Maps Id 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapsId_2_0()
+ * @generated
+ */
+ public static final int XML_MAPS_ID_20 = 16;
+
+ /**
+ * The feature id for the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAPS_ID_20__MAPS_ID = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Maps Id 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAPS_ID_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0 <em>Xml Named Query 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlNamedQuery_2_0()
+ * @generated
+ */
+ public static final int XML_NAMED_QUERY_20 = 18;
+
+ /**
+ * The feature id for the '<em><b>Lock Mode</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_NAMED_QUERY_20__LOCK_MODE = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Named Query 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_NAMED_QUERY_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0 <em>Xml Orphan Removable 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrphanRemovable_2_0()
+ * @generated
+ */
+ public static final int XML_ORPHAN_REMOVABLE_20 = 23;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0 <em>Xml One To Many 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToMany_2_0()
+ * @generated
+ */
+ public static final int XML_ONE_TO_MANY_20 = 19;
+
+ /**
+ * The feature id for the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__ORDER_COLUMN = XML_MULTI_RELATIONSHIP_MAPPING_20__ORDER_COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__MAP_KEY_ATTRIBUTE_OVERRIDES = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ATTRIBUTE_OVERRIDES;
+
+ /**
+ * The feature id for the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__MAP_KEY_CLASS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS;
+
+ /**
+ * The feature id for the '<em><b>Map Key Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__MAP_KEY_TEMPORAL = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL;
+
+ /**
+ * The feature id for the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__MAP_KEY_ENUMERATED = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED;
+
+ /**
+ * The feature id for the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__MAP_KEY_COLUMN = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__MAP_KEY_JOIN_COLUMNS = XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS;
+
+ /**
+ * The feature id for the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20__ORPHAN_REMOVAL = XML_MULTI_RELATIONSHIP_MAPPING_20_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Xml One To Many 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_MANY_20_FEATURE_COUNT = XML_MULTI_RELATIONSHIP_MAPPING_20_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0 <em>Xml Single Relationship Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSingleRelationshipMapping_2_0()
+ * @generated
+ */
+ public static final int XML_SINGLE_RELATIONSHIP_MAPPING_20 = 29;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SINGLE_RELATIONSHIP_MAPPING_20__ID = XML_DERIVED_ID_20__ID;
+
+ /**
+ * The feature id for the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SINGLE_RELATIONSHIP_MAPPING_20__MAPS_ID = XML_DERIVED_ID_20_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Single Relationship Mapping 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SINGLE_RELATIONSHIP_MAPPING_20_FEATURE_COUNT = XML_DERIVED_ID_20_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToOne_2_0 <em>Xml One To One 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToOne_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToOne_2_0()
+ * @generated
+ */
+ public static final int XML_ONE_TO_ONE_20 = 20;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE_20__ID = XML_SINGLE_RELATIONSHIP_MAPPING_20__ID;
+
+ /**
+ * The feature id for the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE_20__MAPS_ID = XML_SINGLE_RELATIONSHIP_MAPPING_20__MAPS_ID;
+
+ /**
+ * The feature id for the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE_20__ORPHAN_REMOVAL = XML_SINGLE_RELATIONSHIP_MAPPING_20_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Xml One To One 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ONE_TO_ONE_20_FEATURE_COUNT = XML_SINGLE_RELATIONSHIP_MAPPING_20_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0 <em>Xml Order Column 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderColumn_2_0()
+ * @generated
+ */
+ public static final int XML_ORDER_COLUMN_20 = 22;
+
+ /**
+ * The feature id for the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN_20__NULLABLE = 0;
+
+ /**
+ * The feature id for the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN_20__INSERTABLE = 1;
+
+ /**
+ * The feature id for the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN_20__UPDATABLE = 2;
+
+ /**
+ * The number of structural features of the '<em>Xml Order Column 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORDER_COLUMN_20_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0 <em>Xml Persistence Unit Defaults 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitDefaults_2_0()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_DEFAULTS_20 = 24;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0 <em>Xml Persistence Unit Metadata 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitMetadata_2_0()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_METADATA_20 = 25;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0 <em>Xml Query 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQuery_2_0()
+ * @generated
+ */
+ public static final int XML_QUERY_20 = 26;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0 <em>Xml Query Hint 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQueryHint_2_0()
+ * @generated
+ */
+ public static final int XML_QUERY_HINT_20 = 27;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0 <em>Xml Sequence Generator 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSequenceGenerator_2_0()
+ * @generated
+ */
+ public static final int XML_SEQUENCE_GENERATOR_20 = 28;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0 <em>Xml Sql Result Set Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSqlResultSetMapping_2_0()
+ * @generated
+ */
+ public static final int XML_SQL_RESULT_SET_MAPPING_20 = 30;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0 <em>Xml Unique Constraint 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlUniqueConstraint_2_0()
+ * @generated
+ */
+ public static final int XML_UNIQUE_CONSTRAINT_20 = 31;
+
+ /**
+ * The feature id for the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORPHAN_REMOVABLE_20__ORPHAN_REMOVAL = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Orphan Removable 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_ORPHAN_REMOVABLE_20_FEATURE_COUNT = 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_DEFAULTS_20__DESCRIPTION = 0;
+
+ /**
+ * The feature id for the '<em><b>Delimited Identifiers</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_DEFAULTS_20__DELIMITED_IDENTIFIERS = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Persistence Unit Defaults 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_DEFAULTS_20_FEATURE_COUNT = 2;
+
+ /**
+ * 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_METADATA_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Persistence Unit Metadata 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_METADATA_20_FEATURE_COUNT = 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_QUERY_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Query 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_QUERY_20_FEATURE_COUNT = 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_QUERY_HINT_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Query Hint 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_QUERY_HINT_20_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SEQUENCE_GENERATOR_20__CATALOG = 0;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SEQUENCE_GENERATOR_20__SCHEMA = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Sequence Generator 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SEQUENCE_GENERATOR_20_FEATURE_COUNT = 2;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SQL_RESULT_SET_MAPPING_20__DESCRIPTION = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Sql Result Set Mapping 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_SQL_RESULT_SET_MAPPING_20_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 XML_UNIQUE_CONSTRAINT_20__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Unique Constraint 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_UNIQUE_CONSTRAINT_20_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 <em>Lock Mode Type 20</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getLockModeType_2_0()
+ * @generated
+ */
+ public static final int LOCK_MODE_TYPE_20 = 32;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAttributeMapping_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAssociationOverride_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAttributeOverride_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlAttributes_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlCollectionTable_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlDerivedId_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlElementCollection_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlEmbedded_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlEntity_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlEntityListener_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlEventMethod_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlGenerator_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlManyToMany_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlMapKeyAttributeOverrideContainer_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlMapsId_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlMultiRelationshipMapping_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlNamedQuery_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOneToMany_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOneToOne_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOrderColumn_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPersistenceUnitDefaults_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPersistenceUnitMetadata_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlQuery_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlQueryHint_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlSequenceGenerator_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlSingleRelationshipMapping_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlSqlResultSetMapping_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlUniqueConstraint_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlCacheable_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlCascadeType_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOrphanRemovable_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlOrderable_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum lockModeType_2_0EEnum = 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private OrmV2_0Package()
+ {
+ super(eNS_URI, OrmV2_0Factory.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.
+ *
+ * <p>This method is used to initialize {@link OrmV2_0Package#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static OrmV2_0Package init()
+ {
+ if (isInited) return (OrmV2_0Package)EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI);
+
+ // Obtain or create and register package
+ OrmV2_0Package theOrmV2_0Package = (OrmV2_0Package)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof OrmV2_0Package ? EPackage.Registry.INSTANCE.get(eNS_URI) : new OrmV2_0Package());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+ XMLTypePackage.eINSTANCE.eClass();
+
+ // Obtain or create and register interdependencies
+ CommonPackage theCommonPackage = (CommonPackage)(EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) instanceof CommonPackage ? EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) : CommonPackage.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);
+ PersistenceV2_0Package thePersistenceV2_0Package = (PersistenceV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) instanceof PersistenceV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) : PersistenceV2_0Package.eINSTANCE);
+
+ // Create package meta-data objects
+ theOrmV2_0Package.createPackageContents();
+ theCommonPackage.createPackageContents();
+ theOrmPackage.createPackageContents();
+ thePersistencePackage.createPackageContents();
+ thePersistenceV2_0Package.createPackageContents();
+
+ // Initialize created meta-data
+ theOrmV2_0Package.initializePackageContents();
+ theCommonPackage.initializePackageContents();
+ theOrmPackage.initializePackageContents();
+ thePersistencePackage.initializePackageContents();
+ thePersistenceV2_0Package.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theOrmV2_0Package.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(OrmV2_0Package.eNS_URI, theOrmV2_0Package);
+ return theOrmV2_0Package;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeMapping_2_0 <em>Xml Attribute Mapping 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Attribute Mapping 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeMapping_2_0
+ * @generated
+ */
+ public EClass getXmlAttributeMapping_2_0()
+ {
+ return xmlAttributeMapping_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0 <em>Xml Association Override 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Association Override 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0
+ * @generated
+ */
+ public EClass getXmlAssociationOverride_2_0()
+ {
+ return xmlAssociationOverride_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0#getDescription()
+ * @see #getXmlAssociationOverride_2_0()
+ * @generated
+ */
+ public EAttribute getXmlAssociationOverride_2_0_Description()
+ {
+ return (EAttribute)xmlAssociationOverride_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0 <em>Xml Attribute Override 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Attribute Override 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0
+ * @generated
+ */
+ public EClass getXmlAttributeOverride_2_0()
+ {
+ return xmlAttributeOverride_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0#getDescription()
+ * @see #getXmlAttributeOverride_2_0()
+ * @generated
+ */
+ public EAttribute getXmlAttributeOverride_2_0_Description()
+ {
+ return (EAttribute)xmlAttributeOverride_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0 <em>Xml Attributes 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Attributes 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0
+ * @generated
+ */
+ public EClass getXmlAttributes_2_0()
+ {
+ return xmlAttributes_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0#getDescription()
+ * @see #getXmlAttributes_2_0()
+ * @generated
+ */
+ public EAttribute getXmlAttributes_2_0_Description()
+ {
+ return (EAttribute)xmlAttributes_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0#getElementCollections <em>Element Collections</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Element Collections</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0#getElementCollections()
+ * @see #getXmlAttributes_2_0()
+ * @generated
+ */
+ public EReference getXmlAttributes_2_0_ElementCollections()
+ {
+ return (EReference)xmlAttributes_2_0EClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCollectionTable_2_0 <em>Xml Collection Table 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Collection Table 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCollectionTable_2_0
+ * @generated
+ */
+ public EClass getXmlCollectionTable_2_0()
+ {
+ return xmlCollectionTable_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0 <em>Xml Derived Id 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Derived Id 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0
+ * @generated
+ */
+ public EClass getXmlDerivedId_2_0()
+ {
+ return xmlDerivedId_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0#getId <em>Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Id</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0#getId()
+ * @see #getXmlDerivedId_2_0()
+ * @generated
+ */
+ public EAttribute getXmlDerivedId_2_0_Id()
+ {
+ return (EAttribute)xmlDerivedId_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0 <em>Xml Element Collection 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Element Collection 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0
+ * @generated
+ */
+ public EClass getXmlElementCollection_2_0()
+ {
+ return xmlElementCollection_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getTargetClass <em>Target Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Target Class</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getTargetClass()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EAttribute getXmlElementCollection_2_0_TargetClass()
+ {
+ return (EAttribute)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getFetch <em>Fetch</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Fetch</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getFetch()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EAttribute getXmlElementCollection_2_0_Fetch()
+ {
+ return (EAttribute)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#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.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKey()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EReference getXmlElementCollection_2_0_MapKey()
+ {
+ return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyClass <em>Map Key Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Map Key Class</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyClass()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EReference getXmlElementCollection_2_0_MapKeyClass()
+ {
+ return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(3);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Map Key Temporal</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EAttribute getXmlElementCollection_2_0_MapKeyTemporal()
+ {
+ return (EAttribute)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(4);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Map Key Enumerated</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EAttribute getXmlElementCollection_2_0_MapKeyEnumerated()
+ {
+ return (EAttribute)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(5);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyColumn <em>Map Key Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Map Key Column</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyColumn()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EReference getXmlElementCollection_2_0_MapKeyColumn()
+ {
+ return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(6);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyJoinColumns <em>Map Key Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Map Key Join Columns</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyJoinColumns()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EReference getXmlElementCollection_2_0_MapKeyJoinColumns()
+ {
+ return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(7);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#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.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getColumn()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EReference getXmlElementCollection_2_0_Column()
+ {
+ return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(8);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getCollectionTable <em>Collection Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Collection Table</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getCollectionTable()
+ * @see #getXmlElementCollection_2_0()
+ * @generated
+ */
+ public EReference getXmlElementCollection_2_0_CollectionTable()
+ {
+ return (EReference)xmlElementCollection_2_0EClass.getEStructuralFeatures().get(9);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEmbedded_2_0 <em>Xml Embedded 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Embedded 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEmbedded_2_0
+ * @generated
+ */
+ public EClass getXmlEmbedded_2_0()
+ {
+ return xmlEmbedded_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntity_2_0 <em>Xml Entity 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Entity 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntity_2_0
+ * @generated
+ */
+ public EClass getXmlEntity_2_0()
+ {
+ return xmlEntity_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0 <em>Xml Entity Listener 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Entity Listener 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0
+ * @generated
+ */
+ public EClass getXmlEntityListener_2_0()
+ {
+ return xmlEntityListener_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0#getDescription()
+ * @see #getXmlEntityListener_2_0()
+ * @generated
+ */
+ public EAttribute getXmlEntityListener_2_0_Description()
+ {
+ return (EAttribute)xmlEntityListener_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0 <em>Xml Event Method 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Event Method 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0
+ * @generated
+ */
+ public EClass getXmlEventMethod_2_0()
+ {
+ return xmlEventMethod_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0#getDescription()
+ * @see #getXmlEventMethod_2_0()
+ * @generated
+ */
+ public EAttribute getXmlEventMethod_2_0_Description()
+ {
+ return (EAttribute)xmlEventMethod_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0 <em>Xml Generator 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Generator 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0
+ * @generated
+ */
+ public EClass getXmlGenerator_2_0()
+ {
+ return xmlGenerator_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0#getDescription()
+ * @see #getXmlGenerator_2_0()
+ * @generated
+ */
+ public EAttribute getXmlGenerator_2_0_Description()
+ {
+ return (EAttribute)xmlGenerator_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlManyToMany_2_0 <em>Xml Many To Many 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Many To Many 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlManyToMany_2_0
+ * @generated
+ */
+ public EClass getXmlManyToMany_2_0()
+ {
+ return xmlManyToMany_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0 <em>Xml Map Key Attribute Override Container 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Map Key Attribute Override Container 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0
+ * @generated
+ */
+ public EClass getXmlMapKeyAttributeOverrideContainer_2_0()
+ {
+ return xmlMapKeyAttributeOverrideContainer_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0#getMapKeyAttributeOverrides <em>Map Key Attribute Overrides</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Map Key Attribute Overrides</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0#getMapKeyAttributeOverrides()
+ * @see #getXmlMapKeyAttributeOverrideContainer_2_0()
+ * @generated
+ */
+ public EReference getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides()
+ {
+ return (EReference)xmlMapKeyAttributeOverrideContainer_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 <em>Xml Maps Id 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Maps Id 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0
+ * @generated
+ */
+ public EClass getXmlMapsId_2_0()
+ {
+ return xmlMapsId_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0#getMapsId <em>Maps Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Maps Id</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0#getMapsId()
+ * @see #getXmlMapsId_2_0()
+ * @generated
+ */
+ public EAttribute getXmlMapsId_2_0_MapsId()
+ {
+ return (EAttribute)xmlMapsId_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0 <em>Xml Multi Relationship Mapping 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Multi Relationship Mapping 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0
+ * @generated
+ */
+ public EClass getXmlMultiRelationshipMapping_2_0()
+ {
+ return xmlMultiRelationshipMapping_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyClass <em>Map Key Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Map Key Class</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyClass()
+ * @see #getXmlMultiRelationshipMapping_2_0()
+ * @generated
+ */
+ public EReference getXmlMultiRelationshipMapping_2_0_MapKeyClass()
+ {
+ return (EReference)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Map Key Temporal</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal()
+ * @see #getXmlMultiRelationshipMapping_2_0()
+ * @generated
+ */
+ public EAttribute getXmlMultiRelationshipMapping_2_0_MapKeyTemporal()
+ {
+ return (EAttribute)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Map Key Enumerated</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated()
+ * @see #getXmlMultiRelationshipMapping_2_0()
+ * @generated
+ */
+ public EAttribute getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated()
+ {
+ return (EAttribute)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyColumn <em>Map Key Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Map Key Column</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyColumn()
+ * @see #getXmlMultiRelationshipMapping_2_0()
+ * @generated
+ */
+ public EReference getXmlMultiRelationshipMapping_2_0_MapKeyColumn()
+ {
+ return (EReference)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(3);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyJoinColumns <em>Map Key Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Map Key Join Columns</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyJoinColumns()
+ * @see #getXmlMultiRelationshipMapping_2_0()
+ * @generated
+ */
+ public EReference getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns()
+ {
+ return (EReference)xmlMultiRelationshipMapping_2_0EClass.getEStructuralFeatures().get(4);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0 <em>Xml Named Query 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Named Query 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0
+ * @generated
+ */
+ public EClass getXmlNamedQuery_2_0()
+ {
+ return xmlNamedQuery_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0#getLockMode <em>Lock Mode</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Lock Mode</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0#getLockMode()
+ * @see #getXmlNamedQuery_2_0()
+ * @generated
+ */
+ public EAttribute getXmlNamedQuery_2_0_LockMode()
+ {
+ return (EAttribute)xmlNamedQuery_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0 <em>Xml One To Many 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml One To Many 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0
+ * @generated
+ */
+ public EClass getXmlOneToMany_2_0()
+ {
+ return xmlOneToMany_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToOne_2_0 <em>Xml One To One 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml One To One 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToOne_2_0
+ * @generated
+ */
+ public EClass getXmlOneToOne_2_0()
+ {
+ return xmlOneToOne_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0 <em>Xml Order Column 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Order Column 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0
+ * @generated
+ */
+ public EClass getXmlOrderColumn_2_0()
+ {
+ return xmlOrderColumn_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getNullable <em>Nullable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Nullable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getNullable()
+ * @see #getXmlOrderColumn_2_0()
+ * @generated
+ */
+ public EAttribute getXmlOrderColumn_2_0_Nullable()
+ {
+ return (EAttribute)xmlOrderColumn_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getInsertable <em>Insertable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Insertable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getInsertable()
+ * @see #getXmlOrderColumn_2_0()
+ * @generated
+ */
+ public EAttribute getXmlOrderColumn_2_0_Insertable()
+ {
+ return (EAttribute)xmlOrderColumn_2_0EClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getUpdatable <em>Updatable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Updatable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getUpdatable()
+ * @see #getXmlOrderColumn_2_0()
+ * @generated
+ */
+ public EAttribute getXmlOrderColumn_2_0_Updatable()
+ {
+ return (EAttribute)xmlOrderColumn_2_0EClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0 <em>Xml Persistence Unit Defaults 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Persistence Unit Defaults 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0
+ * @generated
+ */
+ public EClass getXmlPersistenceUnitDefaults_2_0()
+ {
+ return xmlPersistenceUnitDefaults_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#getDescription()
+ * @see #getXmlPersistenceUnitDefaults_2_0()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnitDefaults_2_0_Description()
+ {
+ return (EAttribute)xmlPersistenceUnitDefaults_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#isDelimitedIdentifiers <em>Delimited Identifiers</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Delimited Identifiers</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#isDelimitedIdentifiers()
+ * @see #getXmlPersistenceUnitDefaults_2_0()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnitDefaults_2_0_DelimitedIdentifiers()
+ {
+ return (EAttribute)xmlPersistenceUnitDefaults_2_0EClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0 <em>Xml Persistence Unit Metadata 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Persistence Unit Metadata 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0
+ * @generated
+ */
+ public EClass getXmlPersistenceUnitMetadata_2_0()
+ {
+ return xmlPersistenceUnitMetadata_2_0EClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0#getDescription()
+ * @see #getXmlPersistenceUnitMetadata_2_0()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnitMetadata_2_0_Description()
+ {
+ return (EAttribute)xmlPersistenceUnitMetadata_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0 <em>Xml Query 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Query 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0
+ * @generated
+ */
+ public EClass getXmlQuery_2_0()
+ {
+ return xmlQuery_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0#getDescription()
+ * @see #getXmlQuery_2_0()
+ * @generated
+ */
+ public EAttribute getXmlQuery_2_0_Description()
+ {
+ return (EAttribute)xmlQuery_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0 <em>Xml Query Hint 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Query Hint 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0
+ * @generated
+ */
+ public EClass getXmlQueryHint_2_0()
+ {
+ return xmlQueryHint_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0#getDescription()
+ * @see #getXmlQueryHint_2_0()
+ * @generated
+ */
+ public EAttribute getXmlQueryHint_2_0_Description()
+ {
+ return (EAttribute)xmlQueryHint_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0 <em>Xml Sequence Generator 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Sequence Generator 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0
+ * @generated
+ */
+ public EClass getXmlSequenceGenerator_2_0()
+ {
+ return xmlSequenceGenerator_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#getCatalog()
+ * @see #getXmlSequenceGenerator_2_0()
+ * @generated
+ */
+ public EAttribute getXmlSequenceGenerator_2_0_Catalog()
+ {
+ return (EAttribute)xmlSequenceGenerator_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#getSchema()
+ * @see #getXmlSequenceGenerator_2_0()
+ * @generated
+ */
+ public EAttribute getXmlSequenceGenerator_2_0_Schema()
+ {
+ return (EAttribute)xmlSequenceGenerator_2_0EClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0 <em>Xml Single Relationship Mapping 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Single Relationship Mapping 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0
+ * @generated
+ */
+ public EClass getXmlSingleRelationshipMapping_2_0()
+ {
+ return xmlSingleRelationshipMapping_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0 <em>Xml Sql Result Set Mapping 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Sql Result Set Mapping 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0
+ * @generated
+ */
+ public EClass getXmlSqlResultSetMapping_2_0()
+ {
+ return xmlSqlResultSetMapping_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0#getDescription()
+ * @see #getXmlSqlResultSetMapping_2_0()
+ * @generated
+ */
+ public EAttribute getXmlSqlResultSetMapping_2_0_Description()
+ {
+ return (EAttribute)xmlSqlResultSetMapping_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0 <em>Xml Unique Constraint 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Unique Constraint 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0
+ * @generated
+ */
+ public EClass getXmlUniqueConstraint_2_0()
+ {
+ return xmlUniqueConstraint_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0#getName()
+ * @see #getXmlUniqueConstraint_2_0()
+ * @generated
+ */
+ public EAttribute getXmlUniqueConstraint_2_0_Name()
+ {
+ return (EAttribute)xmlUniqueConstraint_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0 <em>Xml Cacheable 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Cacheable 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0
+ * @generated
+ */
+ public EClass getXmlCacheable_2_0()
+ {
+ return xmlCacheable_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0#getCacheable <em>Cacheable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cacheable</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0#getCacheable()
+ * @see #getXmlCacheable_2_0()
+ * @generated
+ */
+ public EAttribute getXmlCacheable_2_0_Cacheable()
+ {
+ return (EAttribute)xmlCacheable_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0 <em>Xml Cascade Type 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Cascade Type 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0
+ * @generated
+ */
+ public EClass getXmlCascadeType_2_0()
+ {
+ return xmlCascadeType_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0#isCascadeDetach <em>Cascade Detach</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cascade Detach</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0#isCascadeDetach()
+ * @see #getXmlCascadeType_2_0()
+ * @generated
+ */
+ public EAttribute getXmlCascadeType_2_0_CascadeDetach()
+ {
+ return (EAttribute)xmlCascadeType_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0 <em>Xml Orphan Removable 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Orphan Removable 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0
+ * @generated
+ */
+ public EClass getXmlOrphanRemovable_2_0()
+ {
+ return xmlOrphanRemovable_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0#getOrphanRemoval <em>Orphan Removal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Orphan Removal</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0#getOrphanRemoval()
+ * @see #getXmlOrphanRemovable_2_0()
+ * @generated
+ */
+ public EAttribute getXmlOrphanRemovable_2_0_OrphanRemoval()
+ {
+ return (EAttribute)xmlOrphanRemovable_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0 <em>Xml Orderable 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Orderable 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0
+ * @generated
+ */
+ public EClass getXmlOrderable_2_0()
+ {
+ return xmlOrderable_2_0EClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0#getOrderColumn <em>Order Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Order Column</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0#getOrderColumn()
+ * @see #getXmlOrderable_2_0()
+ * @generated
+ */
+ public EReference getXmlOrderable_2_0_OrderColumn()
+ {
+ return (EReference)xmlOrderable_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 <em>Lock Mode Type 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Lock Mode Type 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0
+ * @generated
+ */
+ public EEnum getLockModeType_2_0()
+ {
+ return lockModeType_2_0EEnum;
+ }
+
+
+ /**
+ * 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 OrmV2_0Factory getOrmV2_0Factory()
+ {
+ return (OrmV2_0Factory)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
+ xmlAssociationOverride_2_0EClass = createEClass(XML_ASSOCIATION_OVERRIDE_20);
+ createEAttribute(xmlAssociationOverride_2_0EClass, XML_ASSOCIATION_OVERRIDE_20__DESCRIPTION);
+
+ xmlAttributeMapping_2_0EClass = createEClass(XML_ATTRIBUTE_MAPPING_20);
+
+ xmlAttributeOverride_2_0EClass = createEClass(XML_ATTRIBUTE_OVERRIDE_20);
+ createEAttribute(xmlAttributeOverride_2_0EClass, XML_ATTRIBUTE_OVERRIDE_20__DESCRIPTION);
+
+ xmlAttributes_2_0EClass = createEClass(XML_ATTRIBUTES_20);
+ createEAttribute(xmlAttributes_2_0EClass, XML_ATTRIBUTES_20__DESCRIPTION);
+ createEReference(xmlAttributes_2_0EClass, XML_ATTRIBUTES_20__ELEMENT_COLLECTIONS);
+
+ xmlCacheable_2_0EClass = createEClass(XML_CACHEABLE_20);
+ createEAttribute(xmlCacheable_2_0EClass, XML_CACHEABLE_20__CACHEABLE);
+
+ xmlCascadeType_2_0EClass = createEClass(XML_CASCADE_TYPE_20);
+ createEAttribute(xmlCascadeType_2_0EClass, XML_CASCADE_TYPE_20__CASCADE_DETACH);
+
+ xmlCollectionTable_2_0EClass = createEClass(XML_COLLECTION_TABLE_20);
+
+ xmlDerivedId_2_0EClass = createEClass(XML_DERIVED_ID_20);
+ createEAttribute(xmlDerivedId_2_0EClass, XML_DERIVED_ID_20__ID);
+
+ xmlElementCollection_2_0EClass = createEClass(XML_ELEMENT_COLLECTION_20);
+ createEAttribute(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__TARGET_CLASS);
+ createEAttribute(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__FETCH);
+ createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY);
+ createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS);
+ createEAttribute(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL);
+ createEAttribute(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED);
+ createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN);
+ createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS);
+ createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__COLUMN);
+ createEReference(xmlElementCollection_2_0EClass, XML_ELEMENT_COLLECTION_20__COLLECTION_TABLE);
+
+ xmlEmbedded_2_0EClass = createEClass(XML_EMBEDDED_20);
+
+ xmlEntity_2_0EClass = createEClass(XML_ENTITY_20);
+
+ xmlEntityListener_2_0EClass = createEClass(XML_ENTITY_LISTENER_20);
+ createEAttribute(xmlEntityListener_2_0EClass, XML_ENTITY_LISTENER_20__DESCRIPTION);
+
+ xmlEventMethod_2_0EClass = createEClass(XML_EVENT_METHOD_20);
+ createEAttribute(xmlEventMethod_2_0EClass, XML_EVENT_METHOD_20__DESCRIPTION);
+
+ xmlGenerator_2_0EClass = createEClass(XML_GENERATOR_20);
+ createEAttribute(xmlGenerator_2_0EClass, XML_GENERATOR_20__DESCRIPTION);
+
+ xmlManyToMany_2_0EClass = createEClass(XML_MANY_TO_MANY_20);
+
+ xmlMapKeyAttributeOverrideContainer_2_0EClass = createEClass(XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20);
+ createEReference(xmlMapKeyAttributeOverrideContainer_2_0EClass, XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES);
+
+ xmlMapsId_2_0EClass = createEClass(XML_MAPS_ID_20);
+ createEAttribute(xmlMapsId_2_0EClass, XML_MAPS_ID_20__MAPS_ID);
+
+ xmlMultiRelationshipMapping_2_0EClass = createEClass(XML_MULTI_RELATIONSHIP_MAPPING_20);
+ createEReference(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS);
+ createEAttribute(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL);
+ createEAttribute(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED);
+ createEReference(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN);
+ createEReference(xmlMultiRelationshipMapping_2_0EClass, XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS);
+
+ xmlNamedQuery_2_0EClass = createEClass(XML_NAMED_QUERY_20);
+ createEAttribute(xmlNamedQuery_2_0EClass, XML_NAMED_QUERY_20__LOCK_MODE);
+
+ xmlOneToMany_2_0EClass = createEClass(XML_ONE_TO_MANY_20);
+
+ xmlOneToOne_2_0EClass = createEClass(XML_ONE_TO_ONE_20);
+
+ xmlOrderable_2_0EClass = createEClass(XML_ORDERABLE_20);
+ createEReference(xmlOrderable_2_0EClass, XML_ORDERABLE_20__ORDER_COLUMN);
+
+ xmlOrderColumn_2_0EClass = createEClass(XML_ORDER_COLUMN_20);
+ createEAttribute(xmlOrderColumn_2_0EClass, XML_ORDER_COLUMN_20__NULLABLE);
+ createEAttribute(xmlOrderColumn_2_0EClass, XML_ORDER_COLUMN_20__INSERTABLE);
+ createEAttribute(xmlOrderColumn_2_0EClass, XML_ORDER_COLUMN_20__UPDATABLE);
+
+ xmlOrphanRemovable_2_0EClass = createEClass(XML_ORPHAN_REMOVABLE_20);
+ createEAttribute(xmlOrphanRemovable_2_0EClass, XML_ORPHAN_REMOVABLE_20__ORPHAN_REMOVAL);
+
+ xmlPersistenceUnitDefaults_2_0EClass = createEClass(XML_PERSISTENCE_UNIT_DEFAULTS_20);
+ createEAttribute(xmlPersistenceUnitDefaults_2_0EClass, XML_PERSISTENCE_UNIT_DEFAULTS_20__DESCRIPTION);
+ createEAttribute(xmlPersistenceUnitDefaults_2_0EClass, XML_PERSISTENCE_UNIT_DEFAULTS_20__DELIMITED_IDENTIFIERS);
+
+ xmlPersistenceUnitMetadata_2_0EClass = createEClass(XML_PERSISTENCE_UNIT_METADATA_20);
+ createEAttribute(xmlPersistenceUnitMetadata_2_0EClass, XML_PERSISTENCE_UNIT_METADATA_20__DESCRIPTION);
+
+ xmlQuery_2_0EClass = createEClass(XML_QUERY_20);
+ createEAttribute(xmlQuery_2_0EClass, XML_QUERY_20__DESCRIPTION);
+
+ xmlQueryHint_2_0EClass = createEClass(XML_QUERY_HINT_20);
+ createEAttribute(xmlQueryHint_2_0EClass, XML_QUERY_HINT_20__DESCRIPTION);
+
+ xmlSequenceGenerator_2_0EClass = createEClass(XML_SEQUENCE_GENERATOR_20);
+ createEAttribute(xmlSequenceGenerator_2_0EClass, XML_SEQUENCE_GENERATOR_20__CATALOG);
+ createEAttribute(xmlSequenceGenerator_2_0EClass, XML_SEQUENCE_GENERATOR_20__SCHEMA);
+
+ xmlSingleRelationshipMapping_2_0EClass = createEClass(XML_SINGLE_RELATIONSHIP_MAPPING_20);
+
+ xmlSqlResultSetMapping_2_0EClass = createEClass(XML_SQL_RESULT_SET_MAPPING_20);
+ createEAttribute(xmlSqlResultSetMapping_2_0EClass, XML_SQL_RESULT_SET_MAPPING_20__DESCRIPTION);
+
+ xmlUniqueConstraint_2_0EClass = createEClass(XML_UNIQUE_CONSTRAINT_20);
+ createEAttribute(xmlUniqueConstraint_2_0EClass, XML_UNIQUE_CONSTRAINT_20__NAME);
+
+ // Create enums
+ lockModeType_2_0EEnum = createEEnum(LOCK_MODE_TYPE_20);
+ }
+
+ /**
+ * <!-- 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
+ OrmPackage theOrmPackage = (OrmPackage)EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI);
+ XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ xmlAssociationOverride_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlJoinTableContainer());
+ xmlAttributeMapping_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAccessHolder());
+ xmlCollectionTable_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlReferenceTable());
+ xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlConvertibleMapping());
+ xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlOrderable());
+ xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAttributeOverrideContainer());
+ xmlElementCollection_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAssociationOverrideContainer());
+ xmlElementCollection_2_0EClass.getESuperTypes().add(this.getXmlMapKeyAttributeOverrideContainer_2_0());
+ xmlEmbedded_2_0EClass.getESuperTypes().add(theOrmPackage.getXmlAssociationOverrideContainer());
+ xmlEntity_2_0EClass.getESuperTypes().add(this.getXmlCacheable_2_0());
+ xmlManyToMany_2_0EClass.getESuperTypes().add(this.getXmlMultiRelationshipMapping_2_0());
+ xmlMultiRelationshipMapping_2_0EClass.getESuperTypes().add(this.getXmlOrderable_2_0());
+ xmlMultiRelationshipMapping_2_0EClass.getESuperTypes().add(this.getXmlMapKeyAttributeOverrideContainer_2_0());
+ xmlOneToMany_2_0EClass.getESuperTypes().add(this.getXmlMultiRelationshipMapping_2_0());
+ xmlOneToMany_2_0EClass.getESuperTypes().add(this.getXmlOrphanRemovable_2_0());
+ xmlOneToOne_2_0EClass.getESuperTypes().add(this.getXmlSingleRelationshipMapping_2_0());
+ xmlOneToOne_2_0EClass.getESuperTypes().add(this.getXmlOrphanRemovable_2_0());
+ xmlSingleRelationshipMapping_2_0EClass.getESuperTypes().add(this.getXmlDerivedId_2_0());
+ xmlSingleRelationshipMapping_2_0EClass.getESuperTypes().add(this.getXmlMapsId_2_0());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(xmlAssociationOverride_2_0EClass, XmlAssociationOverride_2_0.class, "XmlAssociationOverride_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlAssociationOverride_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlAssociationOverride_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlAttributeMapping_2_0EClass, XmlAttributeMapping_2_0.class, "XmlAttributeMapping_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlAttributeOverride_2_0EClass, XmlAttributeOverride_2_0.class, "XmlAttributeOverride_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlAttributeOverride_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlAttributeOverride_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlAttributes_2_0EClass, XmlAttributes_2_0.class, "XmlAttributes_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlAttributes_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlAttributes_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlAttributes_2_0_ElementCollections(), theOrmPackage.getXmlElementCollection(), null, "elementCollections", null, 0, -1, XmlAttributes_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlCacheable_2_0EClass, XmlCacheable_2_0.class, "XmlCacheable_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlCacheable_2_0_Cacheable(), theXMLTypePackage.getBooleanObject(), "cacheable", null, 0, 1, XmlCacheable_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlCascadeType_2_0EClass, XmlCascadeType_2_0.class, "XmlCascadeType_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlCascadeType_2_0_CascadeDetach(), theXMLTypePackage.getBoolean(), "cascadeDetach", null, 0, 1, XmlCascadeType_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlCollectionTable_2_0EClass, XmlCollectionTable_2_0.class, "XmlCollectionTable_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlDerivedId_2_0EClass, XmlDerivedId_2_0.class, "XmlDerivedId_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlDerivedId_2_0_Id(), theXMLTypePackage.getBooleanObject(), "id", null, 0, 1, XmlDerivedId_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlElementCollection_2_0EClass, XmlElementCollection_2_0.class, "XmlElementCollection_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlElementCollection_2_0_TargetClass(), theXMLTypePackage.getString(), "targetClass", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlElementCollection_2_0_Fetch(), theOrmPackage.getFetchType(), "fetch", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlElementCollection_2_0_MapKey(), theOrmPackage.getMapKey(), null, "mapKey", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlElementCollection_2_0_MapKeyClass(), theOrmPackage.getXmlClassReference(), null, "mapKeyClass", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlElementCollection_2_0_MapKeyTemporal(), theOrmPackage.getTemporalType(), "mapKeyTemporal", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlElementCollection_2_0_MapKeyEnumerated(), theOrmPackage.getEnumType(), "mapKeyEnumerated", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlElementCollection_2_0_MapKeyColumn(), theOrmPackage.getXmlColumn(), null, "mapKeyColumn", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlElementCollection_2_0_MapKeyJoinColumns(), theOrmPackage.getXmlJoinColumn(), null, "mapKeyJoinColumns", null, 0, -1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlElementCollection_2_0_Column(), theOrmPackage.getXmlColumn(), null, "column", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlElementCollection_2_0_CollectionTable(), theOrmPackage.getXmlCollectionTable(), null, "collectionTable", null, 0, 1, XmlElementCollection_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlEmbedded_2_0EClass, XmlEmbedded_2_0.class, "XmlEmbedded_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlEntity_2_0EClass, XmlEntity_2_0.class, "XmlEntity_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlEntityListener_2_0EClass, XmlEntityListener_2_0.class, "XmlEntityListener_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlEntityListener_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlEntityListener_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlEventMethod_2_0EClass, XmlEventMethod_2_0.class, "XmlEventMethod_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlEventMethod_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlEventMethod_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlGenerator_2_0EClass, XmlGenerator_2_0.class, "XmlGenerator_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlGenerator_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlGenerator_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlManyToMany_2_0EClass, XmlManyToMany_2_0.class, "XmlManyToMany_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlMapKeyAttributeOverrideContainer_2_0EClass, XmlMapKeyAttributeOverrideContainer_2_0.class, "XmlMapKeyAttributeOverrideContainer_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides(), theOrmPackage.getXmlAttributeOverride(), null, "mapKeyAttributeOverrides", null, 0, -1, XmlMapKeyAttributeOverrideContainer_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlMapsId_2_0EClass, XmlMapsId_2_0.class, "XmlMapsId_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlMapsId_2_0_MapsId(), theXMLTypePackage.getString(), "mapsId", null, 0, 1, XmlMapsId_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlMultiRelationshipMapping_2_0EClass, XmlMultiRelationshipMapping_2_0.class, "XmlMultiRelationshipMapping_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlMultiRelationshipMapping_2_0_MapKeyClass(), theOrmPackage.getXmlClassReference(), null, "mapKeyClass", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlMultiRelationshipMapping_2_0_MapKeyTemporal(), theOrmPackage.getTemporalType(), "mapKeyTemporal", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated(), theOrmPackage.getEnumType(), "mapKeyEnumerated", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlMultiRelationshipMapping_2_0_MapKeyColumn(), theOrmPackage.getXmlColumn(), null, "mapKeyColumn", null, 0, 1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns(), theOrmPackage.getXmlJoinColumn(), null, "mapKeyJoinColumns", null, 0, -1, XmlMultiRelationshipMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlNamedQuery_2_0EClass, XmlNamedQuery_2_0.class, "XmlNamedQuery_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlNamedQuery_2_0_LockMode(), this.getLockModeType_2_0(), "lockMode", null, 0, 1, XmlNamedQuery_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlOneToMany_2_0EClass, XmlOneToMany_2_0.class, "XmlOneToMany_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlOneToOne_2_0EClass, XmlOneToOne_2_0.class, "XmlOneToOne_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlOrderable_2_0EClass, XmlOrderable_2_0.class, "XmlOrderable_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlOrderable_2_0_OrderColumn(), theOrmPackage.getXmlOrderColumn(), null, "orderColumn", null, 0, 1, XmlOrderable_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlOrderColumn_2_0EClass, XmlOrderColumn_2_0.class, "XmlOrderColumn_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlOrderColumn_2_0_Nullable(), theXMLTypePackage.getBooleanObject(), "nullable", null, 0, 1, XmlOrderColumn_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlOrderColumn_2_0_Insertable(), theXMLTypePackage.getBooleanObject(), "insertable", null, 0, 1, XmlOrderColumn_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlOrderColumn_2_0_Updatable(), theXMLTypePackage.getBooleanObject(), "updatable", null, 0, 1, XmlOrderColumn_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlOrphanRemovable_2_0EClass, XmlOrphanRemovable_2_0.class, "XmlOrphanRemovable_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlOrphanRemovable_2_0_OrphanRemoval(), theXMLTypePackage.getBooleanObject(), "orphanRemoval", null, 0, 1, XmlOrphanRemovable_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlPersistenceUnitDefaults_2_0EClass, XmlPersistenceUnitDefaults_2_0.class, "XmlPersistenceUnitDefaults_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlPersistenceUnitDefaults_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlPersistenceUnitDefaults_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnitDefaults_2_0_DelimitedIdentifiers(), theXMLTypePackage.getBoolean(), "delimitedIdentifiers", null, 0, 1, XmlPersistenceUnitDefaults_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlPersistenceUnitMetadata_2_0EClass, XmlPersistenceUnitMetadata_2_0.class, "XmlPersistenceUnitMetadata_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlPersistenceUnitMetadata_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlPersistenceUnitMetadata_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlQuery_2_0EClass, XmlQuery_2_0.class, "XmlQuery_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlQuery_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlQuery_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlQueryHint_2_0EClass, XmlQueryHint_2_0.class, "XmlQueryHint_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlQueryHint_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlQueryHint_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlSequenceGenerator_2_0EClass, XmlSequenceGenerator_2_0.class, "XmlSequenceGenerator_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlSequenceGenerator_2_0_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, XmlSequenceGenerator_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlSequenceGenerator_2_0_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, XmlSequenceGenerator_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlSingleRelationshipMapping_2_0EClass, XmlSingleRelationshipMapping_2_0.class, "XmlSingleRelationshipMapping_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(xmlSqlResultSetMapping_2_0EClass, XmlSqlResultSetMapping_2_0.class, "XmlSqlResultSetMapping_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlSqlResultSetMapping_2_0_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlSqlResultSetMapping_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlUniqueConstraint_2_0EClass, XmlUniqueConstraint_2_0.class, "XmlUniqueConstraint_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlUniqueConstraint_2_0_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, XmlUniqueConstraint_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(lockModeType_2_0EEnum, LockModeType_2_0.class, "LockModeType_2_0");
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.NONE);
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.READ);
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.WRITE);
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.OPTIMISTIC);
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.OPTIMISTIC_FORCE_INCREMENT);
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.PESSIMISTIC_READ);
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.PESSIMISTIC_WRITE);
+ addEEnumLiteral(lockModeType_2_0EEnum, LockModeType_2_0.PESSIMISTIC_FORCE_INCREMENT);
+ }
+
+ /**
+ * <!-- 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.jpa.core.resource.orm.v2_0.XmlAttributeMapping_2_0 <em>Xml Attribute Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributeMapping_2_0()
+ * @generated
+ */
+ public static final EClass XML_ATTRIBUTE_MAPPING_20 = eINSTANCE.getXmlAttributeMapping_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0 <em>Xml Association Override 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAssociationOverride_2_0()
+ * @generated
+ */
+ public static final EClass XML_ASSOCIATION_OVERRIDE_20 = eINSTANCE.getXmlAssociationOverride_2_0();
+
+ /**
+ * 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_ASSOCIATION_OVERRIDE_20__DESCRIPTION = eINSTANCE.getXmlAssociationOverride_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0 <em>Xml Attribute Override 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributeOverride_2_0()
+ * @generated
+ */
+ public static final EClass XML_ATTRIBUTE_OVERRIDE_20 = eINSTANCE.getXmlAttributeOverride_2_0();
+
+ /**
+ * 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_ATTRIBUTE_OVERRIDE_20__DESCRIPTION = eINSTANCE.getXmlAttributeOverride_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0 <em>Xml Attributes 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributes_2_0()
+ * @generated
+ */
+ public static final EClass XML_ATTRIBUTES_20 = eINSTANCE.getXmlAttributes_2_0();
+
+ /**
+ * 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_ATTRIBUTES_20__DESCRIPTION = eINSTANCE.getXmlAttributes_2_0_Description();
+
+ /**
+ * The meta object literal for the '<em><b>Element Collections</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_ATTRIBUTES_20__ELEMENT_COLLECTIONS = eINSTANCE.getXmlAttributes_2_0_ElementCollections();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCollectionTable_2_0 <em>Xml Collection Table 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCollectionTable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCollectionTable_2_0()
+ * @generated
+ */
+ public static final EClass XML_COLLECTION_TABLE_20 = eINSTANCE.getXmlCollectionTable_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0 <em>Xml Derived Id 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlDerivedId_2_0()
+ * @generated
+ */
+ public static final EClass XML_DERIVED_ID_20 = eINSTANCE.getXmlDerivedId_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Id</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_DERIVED_ID_20__ID = eINSTANCE.getXmlDerivedId_2_0_Id();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0 <em>Xml Element Collection 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0()
+ * @generated
+ */
+ public static final EClass XML_ELEMENT_COLLECTION_20 = eINSTANCE.getXmlElementCollection_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Target Class</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_ELEMENT_COLLECTION_20__TARGET_CLASS = eINSTANCE.getXmlElementCollection_2_0_TargetClass();
+
+ /**
+ * The meta object literal for the '<em><b>Fetch</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_ELEMENT_COLLECTION_20__FETCH = eINSTANCE.getXmlElementCollection_2_0_Fetch();
+
+ /**
+ * 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 XML_ELEMENT_COLLECTION_20__MAP_KEY = eINSTANCE.getXmlElementCollection_2_0_MapKey();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Class</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_ELEMENT_COLLECTION_20__MAP_KEY_CLASS = eINSTANCE.getXmlElementCollection_2_0_MapKeyClass();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Temporal</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_ELEMENT_COLLECTION_20__MAP_KEY_TEMPORAL = eINSTANCE.getXmlElementCollection_2_0_MapKeyTemporal();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Enumerated</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_ELEMENT_COLLECTION_20__MAP_KEY_ENUMERATED = eINSTANCE.getXmlElementCollection_2_0_MapKeyEnumerated();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Column</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_ELEMENT_COLLECTION_20__MAP_KEY_COLUMN = eINSTANCE.getXmlElementCollection_2_0_MapKeyColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_ELEMENT_COLLECTION_20__MAP_KEY_JOIN_COLUMNS = eINSTANCE.getXmlElementCollection_2_0_MapKeyJoinColumns();
+
+ /**
+ * 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 XML_ELEMENT_COLLECTION_20__COLUMN = eINSTANCE.getXmlElementCollection_2_0_Column();
+
+ /**
+ * The meta object literal for the '<em><b>Collection Table</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_ELEMENT_COLLECTION_20__COLLECTION_TABLE = eINSTANCE.getXmlElementCollection_2_0_CollectionTable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEmbedded_2_0 <em>Xml Embedded 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEmbedded_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEmbedded_2_0()
+ * @generated
+ */
+ public static final EClass XML_EMBEDDED_20 = eINSTANCE.getXmlEmbedded_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntity_2_0 <em>Xml Entity 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntity_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEntity_2_0()
+ * @generated
+ */
+ public static final EClass XML_ENTITY_20 = eINSTANCE.getXmlEntity_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0 <em>Xml Entity Listener 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEntityListener_2_0()
+ * @generated
+ */
+ public static final EClass XML_ENTITY_LISTENER_20 = eINSTANCE.getXmlEntityListener_2_0();
+
+ /**
+ * 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_ENTITY_LISTENER_20__DESCRIPTION = eINSTANCE.getXmlEntityListener_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0 <em>Xml Event Method 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEventMethod_2_0()
+ * @generated
+ */
+ public static final EClass XML_EVENT_METHOD_20 = eINSTANCE.getXmlEventMethod_2_0();
+
+ /**
+ * 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_EVENT_METHOD_20__DESCRIPTION = eINSTANCE.getXmlEventMethod_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0 <em>Xml Generator 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlGenerator_2_0()
+ * @generated
+ */
+ public static final EClass XML_GENERATOR_20 = eINSTANCE.getXmlGenerator_2_0();
+
+ /**
+ * 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_GENERATOR_20__DESCRIPTION = eINSTANCE.getXmlGenerator_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlManyToMany_2_0 <em>Xml Many To Many 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlManyToMany_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlManyToMany_2_0()
+ * @generated
+ */
+ public static final EClass XML_MANY_TO_MANY_20 = eINSTANCE.getXmlManyToMany_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0 <em>Xml Map Key Attribute Override Container 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyAttributeOverrideContainer_2_0()
+ * @generated
+ */
+ public static final EClass XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20 = eINSTANCE.getXmlMapKeyAttributeOverrideContainer_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_MAP_KEY_ATTRIBUTE_OVERRIDE_CONTAINER_20__MAP_KEY_ATTRIBUTE_OVERRIDES = eINSTANCE.getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0 <em>Xml Maps Id 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapsId_2_0()
+ * @generated
+ */
+ public static final EClass XML_MAPS_ID_20 = eINSTANCE.getXmlMapsId_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Maps Id</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_MAPS_ID_20__MAPS_ID = eINSTANCE.getXmlMapsId_2_0_MapsId();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0 <em>Xml Multi Relationship Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0()
+ * @generated
+ */
+ public static final EClass XML_MULTI_RELATIONSHIP_MAPPING_20 = eINSTANCE.getXmlMultiRelationshipMapping_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Class</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_CLASS = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyClass();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Temporal</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_TEMPORAL = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyTemporal();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Enumerated</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_ENUMERATED = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Column</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_COLUMN = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_MULTI_RELATIONSHIP_MAPPING_20__MAP_KEY_JOIN_COLUMNS = eINSTANCE.getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0 <em>Xml Named Query 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlNamedQuery_2_0()
+ * @generated
+ */
+ public static final EClass XML_NAMED_QUERY_20 = eINSTANCE.getXmlNamedQuery_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Lock Mode</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_NAMED_QUERY_20__LOCK_MODE = eINSTANCE.getXmlNamedQuery_2_0_LockMode();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0 <em>Xml One To Many 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToMany_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToMany_2_0()
+ * @generated
+ */
+ public static final EClass XML_ONE_TO_MANY_20 = eINSTANCE.getXmlOneToMany_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToOne_2_0 <em>Xml One To One 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOneToOne_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToOne_2_0()
+ * @generated
+ */
+ public static final EClass XML_ONE_TO_ONE_20 = eINSTANCE.getXmlOneToOne_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0 <em>Xml Order Column 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderColumn_2_0()
+ * @generated
+ */
+ public static final EClass XML_ORDER_COLUMN_20 = eINSTANCE.getXmlOrderColumn_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Nullable</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_ORDER_COLUMN_20__NULLABLE = eINSTANCE.getXmlOrderColumn_2_0_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 XML_ORDER_COLUMN_20__INSERTABLE = eINSTANCE.getXmlOrderColumn_2_0_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 XML_ORDER_COLUMN_20__UPDATABLE = eINSTANCE.getXmlOrderColumn_2_0_Updatable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0 <em>Xml Persistence Unit Defaults 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitDefaults_2_0()
+ * @generated
+ */
+ public static final EClass XML_PERSISTENCE_UNIT_DEFAULTS_20 = eINSTANCE.getXmlPersistenceUnitDefaults_2_0();
+
+ /**
+ * 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_DEFAULTS_20__DESCRIPTION = eINSTANCE.getXmlPersistenceUnitDefaults_2_0_Description();
+
+ /**
+ * The meta object literal for the '<em><b>Delimited Identifiers</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT_DEFAULTS_20__DELIMITED_IDENTIFIERS = eINSTANCE.getXmlPersistenceUnitDefaults_2_0_DelimitedIdentifiers();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0 <em>Xml Persistence Unit Metadata 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitMetadata_2_0()
+ * @generated
+ */
+ public static final EClass XML_PERSISTENCE_UNIT_METADATA_20 = eINSTANCE.getXmlPersistenceUnitMetadata_2_0();
+
+ /**
+ * 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_METADATA_20__DESCRIPTION = eINSTANCE.getXmlPersistenceUnitMetadata_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0 <em>Xml Query 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQuery_2_0()
+ * @generated
+ */
+ public static final EClass XML_QUERY_20 = eINSTANCE.getXmlQuery_2_0();
+
+ /**
+ * 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_QUERY_20__DESCRIPTION = eINSTANCE.getXmlQuery_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0 <em>Xml Query Hint 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQueryHint_2_0()
+ * @generated
+ */
+ public static final EClass XML_QUERY_HINT_20 = eINSTANCE.getXmlQueryHint_2_0();
+
+ /**
+ * 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_QUERY_HINT_20__DESCRIPTION = eINSTANCE.getXmlQueryHint_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0 <em>Xml Sequence Generator 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSequenceGenerator_2_0()
+ * @generated
+ */
+ public static final EClass XML_SEQUENCE_GENERATOR_20 = eINSTANCE.getXmlSequenceGenerator_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_SEQUENCE_GENERATOR_20__CATALOG = eINSTANCE.getXmlSequenceGenerator_2_0_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 XML_SEQUENCE_GENERATOR_20__SCHEMA = eINSTANCE.getXmlSequenceGenerator_2_0_Schema();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0 <em>Xml Single Relationship Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSingleRelationshipMapping_2_0()
+ * @generated
+ */
+ public static final EClass XML_SINGLE_RELATIONSHIP_MAPPING_20 = eINSTANCE.getXmlSingleRelationshipMapping_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0 <em>Xml Sql Result Set Mapping 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSqlResultSetMapping_2_0()
+ * @generated
+ */
+ public static final EClass XML_SQL_RESULT_SET_MAPPING_20 = eINSTANCE.getXmlSqlResultSetMapping_2_0();
+
+ /**
+ * 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_SQL_RESULT_SET_MAPPING_20__DESCRIPTION = eINSTANCE.getXmlSqlResultSetMapping_2_0_Description();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0 <em>Xml Unique Constraint 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlUniqueConstraint_2_0()
+ * @generated
+ */
+ public static final EClass XML_UNIQUE_CONSTRAINT_20 = eINSTANCE.getXmlUniqueConstraint_2_0();
+
+ /**
+ * 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_UNIQUE_CONSTRAINT_20__NAME = eINSTANCE.getXmlUniqueConstraint_2_0_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0 <em>Xml Cacheable 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCacheable_2_0()
+ * @generated
+ */
+ public static final EClass XML_CACHEABLE_20 = eINSTANCE.getXmlCacheable_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Cacheable</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_CACHEABLE_20__CACHEABLE = eINSTANCE.getXmlCacheable_2_0_Cacheable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0 <em>Xml Cascade Type 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCascadeType_2_0()
+ * @generated
+ */
+ public static final EClass XML_CASCADE_TYPE_20 = eINSTANCE.getXmlCascadeType_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade Detach</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_CASCADE_TYPE_20__CASCADE_DETACH = eINSTANCE.getXmlCascadeType_2_0_CascadeDetach();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0 <em>Xml Orphan Removable 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrphanRemovable_2_0()
+ * @generated
+ */
+ public static final EClass XML_ORPHAN_REMOVABLE_20 = eINSTANCE.getXmlOrphanRemovable_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Orphan Removal</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_ORPHAN_REMOVABLE_20__ORPHAN_REMOVAL = eINSTANCE.getXmlOrphanRemovable_2_0_OrphanRemoval();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0 <em>Xml Orderable 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderable_2_0()
+ * @generated
+ */
+ public static final EClass XML_ORDERABLE_20 = eINSTANCE.getXmlOrderable_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Order Column</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_ORDERABLE_20__ORDER_COLUMN = eINSTANCE.getXmlOrderable_2_0_OrderColumn();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0 <em>Lock Mode Type 20</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getLockModeType_2_0()
+ * @generated
+ */
+ public static final EEnum LOCK_MODE_TYPE_20 = eINSTANCE.getLockModeType_2_0();
+
+ }
+
+} //OrmV2_0Package
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAssociationOverride_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAssociationOverride_2_0.java
new file mode 100644
index 0000000000..00718558fc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAssociationOverride_2_0.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Association Override 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAssociationOverride_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlAssociationOverride_2_0 extends XmlJoinTableContainer
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAssociationOverride_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAssociationOverride_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlAssociationOverride_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeMapping_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeMapping_2_0.java
new file mode 100644
index 0000000000..08094ff11a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeMapping_2_0.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Attribute Mapping 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributeMapping_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlAttributeMapping_2_0 extends XmlAccessHolder
+{
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeOverride_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeOverride_2_0.java
new file mode 100644
index 0000000000..7c618f794a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeOverride_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Attribute Override 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributeOverride_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlAttributeOverride_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributeOverride_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributeOverride_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlAttributeOverride_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributes_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributes_2_0.java
new file mode 100644
index 0000000000..068f755bca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributes_2_0.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Attributes 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0#getElementCollections <em>Element Collections</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributes_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlAttributes_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributes_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlAttributes_2_0#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
+ */
+ void setDescription(String value);
+
+ /**
+ * Returns the value of the '<em><b>Element Collections</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Element Collections</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>Element Collections</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlAttributes_2_0_ElementCollections()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlElementCollection> getElementCollections();
+
+} // XmlAttributes_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCacheable_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCacheable_2_0.java
new file mode 100644
index 0000000000..6bac56d8a0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCacheable_2_0.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Cacheable2 0</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0#getCacheable <em>Cacheable</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCacheable_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlCacheable_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Cacheable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cacheable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cacheable</em>' attribute.
+ * @see #setCacheable(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCacheable_2_0_Cacheable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getCacheable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0#getCacheable <em>Cacheable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cacheable</em>' attribute.
+ * @see #getCacheable()
+ * @generated
+ */
+ void setCacheable(Boolean value);
+
+ /**
+ * Return the {@link TextRange} for the cacheable annotation
+ */
+ TextRange getCacheableTextRange();
+} // XmlCacheable2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCascadeType_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCascadeType_2_0.java
new file mode 100644
index 0000000000..6ebb968679
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCascadeType_2_0.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Cascade Type 20</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0#isCascadeDetach <em>Cascade Detach</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCascadeType_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlCascadeType_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Cascade Detach</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Detach</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 Detach</em>' attribute.
+ * @see #setCascadeDetach(boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCascadeType_2_0_CascadeDetach()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isCascadeDetach();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCascadeType_2_0#isCascadeDetach <em>Cascade Detach</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Detach</em>' attribute.
+ * @see #isCascadeDetach()
+ * @generated
+ */
+ void setCascadeDetach(boolean value);
+
+} // XmlCascadeType_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCollectionTable_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCollectionTable_2_0.java
new file mode 100644
index 0000000000..298a2311a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCollectionTable_2_0.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.orm.XmlReferenceTable;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Collection Table 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlCollectionTable_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlCollectionTable_2_0 extends XmlReferenceTable
+{
+
+} // XmlCollectionTable_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlDerivedId_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlDerivedId_2_0.java
new file mode 100644
index 0000000000..b70d585770
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlDerivedId_2_0.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Derived Id 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0#getId <em>Id</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlDerivedId_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlDerivedId_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>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>Id</em>' attribute.
+ * @see #setId(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlDerivedId_2_0_Id()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getId();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlDerivedId_2_0#getId <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ void setId(Boolean value);
+
+ /**
+ * Return the text range of the derived id part of the XML document
+ */
+ TextRange getIdTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java
new file mode 100644
index 0000000000..9940b49e73
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java
@@ -0,0 +1,326 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.orm.EnumType;
+import org.eclipse.jpt.jpa.core.resource.orm.FetchType;
+import org.eclipse.jpt.jpa.core.resource.orm.MapKey;
+import org.eclipse.jpt.jpa.core.resource.orm.TemporalType;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverrideContainer;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Element Collection 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getTargetClass <em>Target Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getFetch <em>Fetch</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKey <em>Map Key</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyClass <em>Map Key Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyColumn <em>Map Key Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyJoinColumns <em>Map Key Join Columns</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getColumn <em>Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getCollectionTable <em>Collection Table</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlElementCollection_2_0 extends XmlConvertibleMapping, XmlOrderable, XmlAttributeOverrideContainer, XmlAssociationOverrideContainer, XmlMapKeyAttributeOverrideContainer_2_0
+{
+ /**
+ * Returns the value of the '<em><b>Target Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target 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>Target Class</em>' attribute.
+ * @see #setTargetClass(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_TargetClass()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getTargetClass();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getTargetClass <em>Target Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Class</em>' attribute.
+ * @see #getTargetClass()
+ * @generated
+ */
+ void setTargetClass(String value);
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_Fetch()
+ * @model
+ * @generated
+ */
+ FetchType getFetch();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#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.jpa.core.resource.orm.FetchType
+ * @see #getFetch()
+ * @generated
+ */
+ void setFetch(FetchType 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKey()
+ * @model containment="true"
+ * @generated
+ */
+ MapKey getMapKey();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#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>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Class</em>' containment reference.
+ * @see #setMapKeyClass(XmlClassReference)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKeyClass()
+ * @model containment="true"
+ * @generated
+ */
+ XmlClassReference getMapKeyClass();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyClass <em>Map Key Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Class</em>' containment reference.
+ * @see #getMapKeyClass()
+ * @generated
+ */
+ void setMapKeyClass(XmlClassReference value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #setMapKeyTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKeyTemporal()
+ * @model
+ * @generated
+ */
+ TemporalType getMapKeyTemporal();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #getMapKeyTemporal()
+ * @generated
+ */
+ void setMapKeyTemporal(TemporalType value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #setMapKeyEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKeyEnumerated()
+ * @model
+ * @generated
+ */
+ EnumType getMapKeyEnumerated();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #getMapKeyEnumerated()
+ * @generated
+ */
+ void setMapKeyEnumerated(EnumType value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Column</em>' containment reference.
+ * @see #setMapKeyColumn(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKeyColumn()
+ * @model containment="true"
+ * @generated
+ */
+ XmlColumn getMapKeyColumn();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getMapKeyColumn <em>Map Key Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Column</em>' containment reference.
+ * @see #getMapKeyColumn()
+ * @generated
+ */
+ void setMapKeyColumn(XmlColumn value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map 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>Map Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_MapKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlJoinColumn> getMapKeyJoinColumns();
+
+ /**
+ * 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(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_Column()
+ * @model containment="true"
+ * @generated
+ */
+ XmlColumn getColumn();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#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(XmlColumn value);
+
+ /**
+ * Returns the value of the '<em><b>Collection Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Collection 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>Collection Table</em>' containment reference.
+ * @see #setCollectionTable(XmlCollectionTable)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlElementCollection_2_0_CollectionTable()
+ * @model containment="true"
+ * @generated
+ */
+ XmlCollectionTable getCollectionTable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0#getCollectionTable <em>Collection Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Collection Table</em>' containment reference.
+ * @see #getCollectionTable()
+ * @generated
+ */
+ void setCollectionTable(XmlCollectionTable value);
+
+ /**
+ * Return the {@link TextRange} for the target-class attribute.
+ */
+ TextRange getTargetClassTextRange();
+
+} // XmlElementCollection_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEmbedded_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEmbedded_2_0.java
new file mode 100644
index 0000000000..31728d2e2f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEmbedded_2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverrideContainer;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Embedded 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEmbedded_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlEmbedded_2_0 extends XmlAssociationOverrideContainer
+{
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntityListener_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntityListener_2_0.java
new file mode 100644
index 0000000000..55e1f2d449
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntityListener_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Entity Listener 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEntityListener_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlEntityListener_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEntityListener_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEntityListener_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlEntityListener_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntity_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntity_2_0.java
new file mode 100644
index 0000000000..c569622e9d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntity_2_0.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Entity 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEntity_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlEntity_2_0 extends XmlCacheable_2_0
+{
+
+} // XmlEntity_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEventMethod_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEventMethod_2_0.java
new file mode 100644
index 0000000000..a4659e0532
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEventMethod_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Event Method 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEventMethod_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlEventMethod_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlEventMethod_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlEventMethod_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlEventMethod_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlGenerator_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlGenerator_2_0.java
new file mode 100644
index 0000000000..5eea431c28
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlGenerator_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Generator 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlGenerator_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlGenerator_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlGenerator_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlGenerator_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlGenerator_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlManyToMany_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlManyToMany_2_0.java
new file mode 100644
index 0000000000..52ab5e52a5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlManyToMany_2_0.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Many To Many 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlManyToMany_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlManyToMany_2_0 extends XmlMultiRelationshipMapping_2_0
+{
+
+} // XmlManyToMany_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyAttributeOverrideContainer_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyAttributeOverrideContainer_2_0.java
new file mode 100644
index 0000000000..e0a206e520
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyAttributeOverrideContainer_2_0.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.emf.common.util.EList;
+
+
+import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Map Key Attribute Override Container2 0</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyAttributeOverrideContainer_2_0#getMapKeyAttributeOverrides <em>Map Key Attribute Overrides</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyAttributeOverrideContainer_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlMapKeyAttributeOverrideContainer_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Map Key Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyAttributeOverrideContainer_2_0_MapKeyAttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlAttributeOverride> getMapKeyAttributeOverrides();
+
+} // XmlMapKeyAttributeOverrideContainer2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyClass_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyClass_2_0.java
new file mode 100644
index 0000000000..d9b7b95f82
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyClass_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Map Key Class 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyClass_2_0#getClassName <em>Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyClass_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlMapKeyClass_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapKeyClass_2_0_ClassName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getClassName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapKeyClass_2_0#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
+ */
+ void setClassName(String value);
+
+} // XmlMapKeyClass_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapsId_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapsId_2_0.java
new file mode 100644
index 0000000000..1c0ea5d737
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapsId_2_0.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Maps Id 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0#getMapsId <em>Maps Id</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapsId_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlMapsId_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Maps Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Maps 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>Maps Id</em>' attribute.
+ * @see #setMapsId(String)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMapsId_2_0_MapsId()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getMapsId();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMapsId_2_0#getMapsId <em>Maps Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Maps Id</em>' attribute.
+ * @see #getMapsId()
+ * @generated
+ */
+ void setMapsId(String value);
+
+ /**
+ * Return the text range of the "maps-id" part of the XML document
+ */
+ TextRange getMapsIdTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java
new file mode 100644
index 0000000000..6389cf6e1d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.jpa.core.resource.orm.EnumType;
+import org.eclipse.jpt.jpa.core.resource.orm.TemporalType;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Multi Relationship Mapping 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyClass <em>Map Key Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyColumn <em>Map Key Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyJoinColumns <em>Map Key Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlMultiRelationshipMapping_2_0 extends XmlOrderable_2_0, XmlMapKeyAttributeOverrideContainer_2_0
+{
+ /**
+ * Returns the value of the '<em><b>Map Key Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Class</em>' containment reference.
+ * @see #setMapKeyClass(XmlClassReference)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0_MapKeyClass()
+ * @model containment="true"
+ * @generated
+ */
+ XmlClassReference getMapKeyClass();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyClass <em>Map Key Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Class</em>' containment reference.
+ * @see #getMapKeyClass()
+ * @generated
+ */
+ void setMapKeyClass(XmlClassReference value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #setMapKeyTemporal(TemporalType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0_MapKeyTemporal()
+ * @model
+ * @generated
+ */
+ TemporalType getMapKeyTemporal();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyTemporal <em>Map Key Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Temporal</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.TemporalType
+ * @see #getMapKeyTemporal()
+ * @generated
+ */
+ void setMapKeyTemporal(TemporalType value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #setMapKeyEnumerated(EnumType)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0_MapKeyEnumerated()
+ * @model
+ * @generated
+ */
+ EnumType getMapKeyEnumerated();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyEnumerated <em>Map Key Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.EnumType
+ * @see #getMapKeyEnumerated()
+ * @generated
+ */
+ void setMapKeyEnumerated(EnumType value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key 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>Map Key Column</em>' containment reference.
+ * @see #setMapKeyColumn(XmlColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0_MapKeyColumn()
+ * @model containment="true"
+ * @generated
+ */
+ XmlColumn getMapKeyColumn();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlMultiRelationshipMapping_2_0#getMapKeyColumn <em>Map Key Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key Column</em>' containment reference.
+ * @see #getMapKeyColumn()
+ * @generated
+ */
+ void setMapKeyColumn(XmlColumn value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map 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>Map Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlMultiRelationshipMapping_2_0_MapKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<XmlJoinColumn> getMapKeyJoinColumns();
+
+} // XmlMultiRelationshipMapping_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlNamedQuery_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlNamedQuery_2_0.java
new file mode 100644
index 0000000000..dc0f6344be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlNamedQuery_2_0.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Named Query 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0#getLockMode <em>Lock Mode</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlNamedQuery_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlNamedQuery_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Lock Mode</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lock Mode</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lock Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0
+ * @see #setLockMode(LockModeType_2_0)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlNamedQuery_2_0_LockMode()
+ * @model
+ * @generated
+ */
+ LockModeType_2_0 getLockMode();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0#getLockMode <em>Lock Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lock Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.LockModeType_2_0
+ * @see #getLockMode()
+ * @generated
+ */
+ void setLockMode(LockModeType_2_0 value);
+
+} // XmlNamedQuery_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToMany_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToMany_2_0.java
new file mode 100644
index 0000000000..a2792c9c84
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToMany_2_0.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml One To Many 20</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToMany_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlOneToMany_2_0 extends XmlMultiRelationshipMapping_2_0, XmlOrphanRemovable_2_0
+{
+
+} // XmlOneToMany_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToOne_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToOne_2_0.java
new file mode 100644
index 0000000000..6a9a7c5071
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToOne_2_0.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml One To One 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOneToOne_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlOneToOne_2_0 extends XmlSingleRelationshipMapping_2_0, XmlOrphanRemovable_2_0
+{
+
+} // XmlOneToOne_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderColumn_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderColumn_2_0.java
new file mode 100644
index 0000000000..6cdaf0c7b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderColumn_2_0.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Order Column 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getNullable <em>Nullable</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getInsertable <em>Insertable</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#getUpdatable <em>Updatable</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderColumn_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlOrderColumn_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderColumn_2_0_Nullable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getNullable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#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>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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderColumn_2_0_Insertable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getInsertable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#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>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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderColumn_2_0_Updatable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getUpdatable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderColumn_2_0#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);
+
+} // XmlOrderColumn_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderable_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderable_2_0.java
new file mode 100644
index 0000000000..abd661bac4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderable_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+
+import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Orderable 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0#getOrderColumn <em>Order Column</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderable_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlOrderable_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Order Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order 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>Order Column</em>' containment reference.
+ * @see #setOrderColumn(XmlOrderColumn)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrderable_2_0_OrderColumn()
+ * @model containment="true"
+ * @generated
+ */
+ XmlOrderColumn getOrderColumn();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrderable_2_0#getOrderColumn <em>Order Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Order Column</em>' containment reference.
+ * @see #getOrderColumn()
+ * @generated
+ */
+ void setOrderColumn(XmlOrderColumn value);
+
+} // XmlOrderable_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrphanRemovable_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrphanRemovable_2_0.java
new file mode 100644
index 0000000000..36a8546714
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrphanRemovable_2_0.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Orphan Removable2 0</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0#getOrphanRemoval <em>Orphan Removal</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrphanRemovable_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlOrphanRemovable_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Orphan Removal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Orphan Removal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Orphan Removal</em>' attribute.
+ * @see #setOrphanRemoval(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlOrphanRemovable_2_0_OrphanRemoval()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getOrphanRemoval();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0#getOrphanRemoval <em>Orphan Removal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Orphan Removal</em>' attribute.
+ * @see #getOrphanRemoval()
+ * @generated
+ */
+ void setOrphanRemoval(Boolean value);
+
+} // XmlOrphanRemovable2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitDefaults_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitDefaults_2_0.java
new file mode 100644
index 0000000000..2e05bf1fb4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitDefaults_2_0.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Persistence Unit Defaults 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#isDelimitedIdentifiers <em>Delimited Identifiers</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitDefaults_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlPersistenceUnitDefaults_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitDefaults_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#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
+ */
+ void setDescription(String value);
+
+ /**
+ * Returns the value of the '<em><b>Delimited Identifiers</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Delimited Identifiers</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Delimited Identifiers</em>' attribute.
+ * @see #setDelimitedIdentifiers(boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitDefaults_2_0_DelimitedIdentifiers()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isDelimitedIdentifiers();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitDefaults_2_0#isDelimitedIdentifiers <em>Delimited Identifiers</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Delimited Identifiers</em>' attribute.
+ * @see #isDelimitedIdentifiers()
+ * @generated
+ */
+ void setDelimitedIdentifiers(boolean value);
+
+} // XmlPersistenceUnitDefaults_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitMetadata_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitMetadata_2_0.java
new file mode 100644
index 0000000000..2ac9ece061
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitMetadata_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Persistence Unit Metadata 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitMetadata_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlPersistenceUnitMetadata_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlPersistenceUnitMetadata_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlPersistenceUnitMetadata_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlPersistenceUnitMetadata_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQueryHint_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQueryHint_2_0.java
new file mode 100644
index 0000000000..e4e68d2f8c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQueryHint_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Query Hint 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQueryHint_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlQueryHint_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQueryHint_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQueryHint_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlQueryHint_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQuery_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQuery_2_0.java
new file mode 100644
index 0000000000..3baa46238a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQuery_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Query 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQuery_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlQuery_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlQuery_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlQuery_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlQuery_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSequenceGenerator_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSequenceGenerator_2_0.java
new file mode 100644
index 0000000000..b8549701a9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSequenceGenerator_2_0.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Sequence Generator 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#getSchema <em>Schema</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSequenceGenerator_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlSequenceGenerator_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSequenceGenerator_2_0_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getCatalog();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSequenceGenerator_2_0_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getSchema();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSequenceGenerator_2_0#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);
+
+} // XmlSequenceGenerator_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSingleRelationshipMapping_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSingleRelationshipMapping_2_0.java
new file mode 100644
index 0000000000..5b087d37b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSingleRelationshipMapping_2_0.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Single Relationship Mapping 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSingleRelationshipMapping_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface XmlSingleRelationshipMapping_2_0 extends XmlDerivedId_2_0, XmlMapsId_2_0
+{
+} // XmlSingleRelationshipMapping_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSqlResultSetMapping_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSqlResultSetMapping_2_0.java
new file mode 100644
index 0000000000..b104b9b73d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSqlResultSetMapping_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Sql Result Set Mapping 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0#getDescription <em>Description</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSqlResultSetMapping_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlSqlResultSetMapping_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlSqlResultSetMapping_2_0_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSqlResultSetMapping_2_0#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
+ */
+ void setDescription(String value);
+
+} // XmlSqlResultSetMapping_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlUniqueConstraint_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlUniqueConstraint_2_0.java
new file mode 100644
index 0000000000..6146069012
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlUniqueConstraint_2_0.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.orm.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Unique Constraint 20</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlUniqueConstraint_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlUniqueConstraint_2_0 extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.orm.v2_0.OrmV2_0Package#getXmlUniqueConstraint_2_0_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlUniqueConstraint_2_0#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);
+
+} // XmlUniqueConstraint_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/JPA.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/JPA.java
new file mode 100644
index 0000000000..38176c8faa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/JPA.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+/**
+ * JPA persistence.xml-related stuff (elements, attributes etc.)
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+@SuppressWarnings("nls")
+public interface JPA
+{
+ String SCHEMA_NAMESPACE = "http://java.sun.com/xml/ns/persistence";
+ String SCHEMA_LOCATION = "http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";
+ String SCHEMA_VERSION = "1.0";
+
+ String CLASS = "class";
+
+ String DESCRIPTION = "description";
+
+ String EXCLUDE_UNLISTED_CLASSES = "exclude-unlisted-classes";
+
+ String JAR_FILE = "jar-file";
+
+ String JTA_DATA_SOURCE = "jta-data-source";
+
+ String MAPPING_FILE = "mapping-file";
+
+ String NON_JTA_DATA_SOURCE = "non-jta-data-source";
+
+ String PERSISTENCE = "persistence";
+
+ String PERSISTENCE_UNIT = "persistence-unit";
+ String PERSISTENCE_UNIT__NAME = "name";
+ String PERSISTENCE_UNIT__TRANSACTION_TYPE = "transaction-type";
+
+ String PROPERTIES = "properties";
+
+ String PROPERTY = "property";
+ String PROPERTY__NAME = "name";
+ String PROPERTY__VALUE = "value";
+
+ String PROVIDER = "provider";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceFactory.java
new file mode 100644
index 0000000000..8df8130a4b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceFactory.java
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+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.jpa.core.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_JAVA_CLASS_REF: return (EObject)createXmlJavaClassRef();
+ case PersistencePackage.XML_JAR_FILE_REF: return (EObject)createXmlJarFileRef();
+ case PersistencePackage.XML_MAPPING_FILE_REF: return (EObject)createXmlMappingFileRef();
+ case PersistencePackage.XML_PERSISTENCE: return (EObject)createXmlPersistence();
+ case PersistencePackage.XML_PERSISTENCE_UNIT: return (EObject)createXmlPersistenceUnit();
+ 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);
+ 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);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlJavaClassRef createXmlJavaClassRef()
+ {
+ XmlJavaClassRef xmlJavaClassRef = new XmlJavaClassRef();
+ return xmlJavaClassRef;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlJarFileRef createXmlJarFileRef()
+ {
+ XmlJarFileRef xmlJarFileRef = new XmlJarFileRef();
+ return xmlJarFileRef;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlMappingFileRef createXmlMappingFileRef()
+ {
+ XmlMappingFileRef xmlMappingFileRef = new XmlMappingFileRef();
+ return xmlMappingFileRef;
+ }
+
+ /**
+ * <!-- 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 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 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.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistencePackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistencePackage.java
new file mode 100644
index 0000000000..d11527a508
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistencePackage.java
@@ -0,0 +1,1302 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+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.emf.ecore.xml.type.XMLTypePackage;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.xml.CommonPackage;
+
+/**
+ * <!-- 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.jpa.core.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.jpa.core.resource.persistence";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final PersistencePackage eINSTANCE = org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef <em>Xml Java Class Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlJavaClassRef()
+ * @generated
+ */
+ public static final int XML_JAVA_CLASS_REF = 0;
+
+ /**
+ * 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.jpa.core.resource.persistence.XmlJarFileRef <em>Xml Jar File Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlJarFileRef()
+ * @generated
+ */
+ public static final int XML_JAR_FILE_REF = 1;
+
+ /**
+ * 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_JAR_FILE_REF__FILE_NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Jar File Ref</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_JAR_FILE_REF_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef <em>Xml Mapping File Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlPersistence <em>Xml Persistence</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistence()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE = 3;
+
+ /**
+ * 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 = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__VERSION;
+
+ /**
+ * The feature id for the '<em><b>Schema Location</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE__SCHEMA_LOCATION = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION;
+
+ /**
+ * 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 = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 0;
+
+ /**
+ * 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 = CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit <em>Xml Persistence Unit</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT = 4;
+
+ /**
+ * The feature id for the '<em><b>Shared Cache Mode</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20__SHARED_CACHE_MODE;
+
+ /**
+ * The feature id for the '<em><b>Validation Mode</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__VALIDATION_MODE = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20__VALIDATION_MODE;
+
+ /**
+ * 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 = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__PROVIDER = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__MAPPING_FILES = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Jar Files</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__JAR_FILES = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__CLASSES = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__PROPERTIES = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__NAME = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_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 XML_PERSISTENCE_UNIT__TRANSACTION_TYPE = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_FEATURE_COUNT + 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 = PersistenceV2_0Package.XML_PERSISTENCE_UNIT_20_FEATURE_COUNT + 11;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlProperties <em>Xml Properties</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlProperties
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlProperties()
+ * @generated
+ */
+ public static final int XML_PROPERTIES = 5;
+
+ /**
+ * 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.jpa.core.resource.persistence.XmlProperty <em>Xml Property</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlProperty()
+ * @generated
+ */
+ public static final int XML_PROPERTY = 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_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.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType <em>Xml Persistence Unit Transaction Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionType()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_TRANSACTION_TYPE = 7;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlJavaClassRefEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlJarFileRefEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlMappingFileRefEClass = null;
+
+ /**
+ * <!-- 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 xmlPropertiesEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPropertyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum xmlPersistenceUnitTransactionTypeEEnum = 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.jpa.core.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.
+ *
+ * <p>This method is used to initialize {@link PersistencePackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- 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.get(eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PersistencePackage());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+ XMLTypePackage.eINSTANCE.eClass();
+
+ // Obtain or create and register interdependencies
+ CommonPackage theCommonPackage = (CommonPackage)(EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) instanceof CommonPackage ? EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) : CommonPackage.eINSTANCE);
+ OrmPackage theOrmPackage = (OrmPackage)(EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
+ OrmV2_0Package theOrmV2_0Package = (OrmV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) instanceof OrmV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) : OrmV2_0Package.eINSTANCE);
+ PersistenceV2_0Package thePersistenceV2_0Package = (PersistenceV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) instanceof PersistenceV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) : PersistenceV2_0Package.eINSTANCE);
+
+ // Create package meta-data objects
+ thePersistencePackage.createPackageContents();
+ theCommonPackage.createPackageContents();
+ theOrmPackage.createPackageContents();
+ theOrmV2_0Package.createPackageContents();
+ thePersistenceV2_0Package.createPackageContents();
+
+ // Initialize created meta-data
+ thePersistencePackage.initializePackageContents();
+ theCommonPackage.initializePackageContents();
+ theOrmPackage.initializePackageContents();
+ theOrmV2_0Package.initializePackageContents();
+ thePersistenceV2_0Package.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ thePersistencePackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(PersistencePackage.eNS_URI, thePersistencePackage);
+ return thePersistencePackage;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlJavaClassRef
+ * @generated
+ */
+ public EClass getXmlJavaClassRef()
+ {
+ return xmlJavaClassRefEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlJarFileRef <em>Xml Jar File Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Jar File Ref</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef
+ * @generated
+ */
+ public EClass getXmlJarFileRef()
+ {
+ return xmlJarFileRefEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef#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.jpa.core.resource.persistence.XmlJarFileRef#getFileName()
+ * @see #getXmlJarFileRef()
+ * @generated
+ */
+ public EAttribute getXmlJarFileRef_FileName()
+ {
+ return (EAttribute)xmlJarFileRefEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlMappingFileRef
+ * @generated
+ */
+ public EClass getXmlMappingFileRef()
+ {
+ return xmlMappingFileRefEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlPersistence
+ * @generated
+ */
+ public EClass getXmlPersistence()
+ {
+ return xmlPersistenceEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlPersistence#getPersistenceUnits()
+ * @see #getXmlPersistence()
+ * @generated
+ */
+ public EReference getXmlPersistence_PersistenceUnits()
+ {
+ return (EReference)xmlPersistenceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlPersistenceUnit
+ * @generated
+ */
+ public EClass getXmlPersistenceUnit()
+ {
+ return xmlPersistenceUnitEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlPersistenceUnit#getMappingFiles()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EReference getXmlPersistenceUnit_MappingFiles()
+ {
+ return (EReference)xmlPersistenceUnitEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getJarFiles <em>Jar Files</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Jar Files</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getJarFiles()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EReference getXmlPersistenceUnit_JarFiles()
+ {
+ return (EReference)xmlPersistenceUnitEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlPersistenceUnit#getExcludeUnlistedClasses <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.jpa.core.resource.persistence.XmlPersistenceUnit#getExcludeUnlistedClasses()
+ * @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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlProperties
+ * @generated
+ */
+ public EClass getXmlProperties()
+ {
+ return xmlPropertiesEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlProperty
+ * @generated
+ */
+ public EClass getXmlProperty()
+ {
+ return xmlPropertyEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType
+ * @generated
+ */
+ public EEnum getXmlPersistenceUnitTransactionType()
+ {
+ return xmlPersistenceUnitTransactionTypeEEnum;
+ }
+
+ /**
+ * 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
+ xmlJavaClassRefEClass = createEClass(XML_JAVA_CLASS_REF);
+ createEAttribute(xmlJavaClassRefEClass, XML_JAVA_CLASS_REF__JAVA_CLASS);
+
+ xmlJarFileRefEClass = createEClass(XML_JAR_FILE_REF);
+ createEAttribute(xmlJarFileRefEClass, XML_JAR_FILE_REF__FILE_NAME);
+
+ xmlMappingFileRefEClass = createEClass(XML_MAPPING_FILE_REF);
+ createEAttribute(xmlMappingFileRefEClass, XML_MAPPING_FILE_REF__FILE_NAME);
+
+ xmlPersistenceEClass = createEClass(XML_PERSISTENCE);
+ createEReference(xmlPersistenceEClass, XML_PERSISTENCE__PERSISTENCE_UNITS);
+
+ 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);
+ createEReference(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);
+
+ 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);
+ }
+
+ /**
+ * <!-- 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
+ PersistenceV2_0Package thePersistenceV2_0Package = (PersistenceV2_0Package)EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI);
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+ CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI);
+ XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
+
+ // Add subpackages
+ getESubpackages().add(thePersistenceV2_0Package);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ xmlPersistenceEClass.getESuperTypes().add(theCommonPackage.getAbstractJpaRootEObject());
+ xmlPersistenceUnitEClass.getESuperTypes().add(thePersistenceV2_0Package.getXmlPersistenceUnit_2_0());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(xmlJavaClassRefEClass, XmlJavaClassRef.class, "XmlJavaClassRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlJavaClassRef_JavaClass(), theEcorePackage.getEString(), "javaClass", "", 0, 1, XmlJavaClassRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
+
+ initEClass(xmlJarFileRefEClass, XmlJarFileRef.class, "XmlJarFileRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlJarFileRef_FileName(), theEcorePackage.getEString(), "fileName", "", 0, 1, XmlJarFileRef.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(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);
+
+ 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);
+ initEReference(getXmlPersistenceUnit_JarFiles(), this.getXmlJarFileRef(), null, "jarFiles", null, 0, -1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, 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.getBooleanObject(), "excludeUnlistedClasses", null, 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(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);
+
+ // 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.jpa.core.resource.persistence.XmlJavaClassRef <em>Xml Java Class Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlJarFileRef <em>Xml Jar File Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlJarFileRef()
+ * @generated
+ */
+ public static final EClass XML_JAR_FILE_REF = eINSTANCE.getXmlJarFileRef();
+
+ /**
+ * 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_JAR_FILE_REF__FILE_NAME = eINSTANCE.getXmlJarFileRef_FileName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef <em>Xml Mapping File Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlPersistence <em>Xml Persistence</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence
+ * @see org.eclipse.jpt.jpa.core.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 '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit <em>Xml Persistence Unit</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit
+ * @see org.eclipse.jpt.jpa.core.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>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference 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.jpa.core.resource.persistence.XmlProperties <em>Xml Properties</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlProperties
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlProperty <em>Xml Property</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty
+ * @see org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType <em>Xml Persistence Unit Transaction Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionType()
+ * @generated
+ */
+ public static final EEnum XML_PERSISTENCE_UNIT_TRANSACTION_TYPE = eINSTANCE.getXmlPersistenceUnitTransactionType();
+
+ }
+
+} //PersistencePackage
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java
new file mode 100644
index 0000000000..4d10dbb3dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+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;
+
+/**
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public class PersistenceXmlResourceFactory extends TranslatorResourceFactory
+{
+ public PersistenceXmlResourceFactory() {
+ this(RendererFactory.getDefaultRendererFactory());
+ }
+
+ public PersistenceXmlResourceFactory(RendererFactory aRendererFactory) {
+ super(aRendererFactory);
+ }
+
+ public PersistenceXmlResourceFactory(RendererFactory aRendererFactory, boolean listeningForUpdates) {
+ super(aRendererFactory, listeningForUpdates);
+ }
+
+
+ /**
+ * @see TranslatorResourceFactory#createResource(URI, Renderer)
+ */
+ @Override
+ protected TranslatorResource createResource(URI uri, Renderer renderer) {
+ return new JpaXmlResource(uri, renderer, JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE, XmlPersistence.getRootTranslator());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java
new file mode 100644
index 0000000000..262a22e9c5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Jar File Ref</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef#getFileName <em>File Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlJarFileRef()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class XmlJarFileRef extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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 XmlJarFileRef()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_JAR_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.jpa.core.resource.persistence.PersistencePackage#getXmlJarFileRef_FileName()
+ * @model default="" unique="false" ordered="false"
+ * @generated
+ */
+ public String getFileName()
+ {
+ return fileName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef#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_JAR_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_JAR_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_JAR_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_JAR_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_JAR_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 TextRange getValidationTextRange() {
+ return (! StringTools.stringIsEmpty(this.fileName)) ?
+ getTextTextRange() :
+ super.getValidationTextRange();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildFileNameTranslator(),
+ };
+ }
+
+ private static Translator buildFileNameTranslator() {
+ return new Translator(
+ Translator.TEXT_ATTRIBUTE_VALUE,
+ PersistencePackage.eINSTANCE.getXmlJarFileRef_FileName()
+ );
+ }
+
+
+ // *********** refactoring ***********
+
+ public ReplaceEdit createReplaceFolderEdit(IFolder originalFolder, String newName) {
+ IDOMNode domNode = getTextNode();
+ String originalName = originalFolder.getName();
+ int nameIndex = this.fileName.indexOf(originalName);
+
+ int offset = domNode.getStartOffset();
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java
new file mode 100644
index 0000000000..107c573e01
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Java Class Ref</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef#getJavaClass <em>Java Class</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlJavaClassRef()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class XmlJavaClassRef extends AbstractJpaEObject
+{
+ /**
+ * The default value of the '{@link #getJavaClass() <em>Java Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJavaClass()
+ * @generated
+ * @ordered
+ */
+ protected static final String JAVA_CLASS_EDEFAULT = "";
+
+ /**
+ * The cached value of the '{@link #getJavaClass() <em>Java Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJavaClass()
+ * @generated
+ * @ordered
+ */
+ protected String javaClass = JAVA_CLASS_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlJavaClassRef()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_JAVA_CLASS_REF;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Java Class</b></em>' attribute.
+ * The default value is <code>""</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * 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.jpa.core.resource.persistence.PersistencePackage#getXmlJavaClassRef_JavaClass()
+ * @model default="" unique="false" ordered="false"
+ * @generated
+ */
+ public String getJavaClass()
+ {
+ return javaClass;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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)
+ {
+ String oldJavaClass = javaClass;
+ javaClass = newJavaClass;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_JAVA_CLASS_REF__JAVA_CLASS, oldJavaClass, javaClass));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_JAVA_CLASS_REF__JAVA_CLASS:
+ setJavaClass(JAVA_CLASS_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (javaClass: ");
+ result.append(javaClass);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildClassNameTranslator(),
+ };
+ }
+
+ private static Translator buildClassNameTranslator() {
+ return new Translator(
+ Translator.TEXT_ATTRIBUTE_VALUE,
+ PersistencePackage.eINSTANCE.getXmlJavaClassRef_JavaClass()
+ );
+ }
+
+
+ // *********** refactoring ***********
+
+ public ReplaceEdit createRenameEdit(IType originalType, String newName) {
+ String originalName = originalType.getTypeQualifiedName();
+ int nameIndex = this.javaClass.lastIndexOf(originalName);
+ int offset = getTextNode().getStartOffset();
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createRenamePackageEdit(String newName) {
+ int packageLength = this.javaClass.lastIndexOf('.');
+ int offset = getTextNode().getStartOffset();
+ return new ReplaceEdit(offset, packageLength, newName);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java
new file mode 100644
index 0000000000..42470d7f90
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java
@@ -0,0 +1,277 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.common.notify.Adapter;
+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.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+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>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef#getFileName <em>File Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlMappingFileRef()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class XmlMappingFileRef extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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.jpa.core.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.jpa.core.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));
+ }
+
+ @Override
+ public EList<Adapter> eAdapters() {
+ // TODO Auto-generated method stub
+ return super.eAdapters();
+ }
+ /**
+ * <!-- 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();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildFileNameTranslator(),
+ };
+ }
+
+ private static Translator buildFileNameTranslator() {
+ return new Translator(
+ Translator.TEXT_ATTRIBUTE_VALUE,
+ PersistencePackage.eINSTANCE.getXmlMappingFileRef_FileName()
+ );
+ }
+
+
+ public ReplaceEdit createRenameEdit(IFile originalFile, String newName) {
+ IDOMNode domNode = getTextNode();
+ String originalName = originalFile.getName();
+ int nameIndex = this.fileName.lastIndexOf(originalName);
+
+ int offset = domNode.getStartOffset();
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createRenameFolderEdit(IFolder originalFolder, String newName) {
+ IDOMNode domNode = getTextNode();
+ String originalName = originalFolder.getName();
+ int nameIndex = this.fileName.indexOf(originalName);
+
+ int offset = domNode.getStartOffset();
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createMoveEdit(IFile originalFile, IPath destination) {
+ String originalName = originalFile.getName();
+ int nameIndex = this.fileName.lastIndexOf(originalName);
+
+ int offset = getTextNode().getStartOffset();
+ return new ReplaceEdit(offset, nameIndex - 1, destination.toString());
+ }
+
+ public ReplaceEdit createMoveEdit(IPath originalLocation, IPath destination) {
+ String originalName = originalLocation.toString();
+
+ int offset = getTextNode().getStartOffset();
+ return new ReplaceEdit(offset, originalName.length(), destination.toString());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java
new file mode 100644
index 0000000000..0b1599a171
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+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.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleRootTranslator;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlPersistence</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence#getPersistenceUnits <em>Persistence Units</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistence()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlPersistence extends AbstractJpaRootEObject
+{
+ /**
+ * 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlPersistence()
+ {
+ super();
+ }
+
+ @Override
+ public EObject eContainer() {
+ return super.eContainer();
+ }
+
+ @Override
+ protected void eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID) {
+ super.eBasicSetContainer(newContainer, newContainerFeatureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_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.jpa.core.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.jpa.core.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();
+ }
+ 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;
+ }
+ 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;
+ }
+ 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();
+ }
+ return super.eIsSet(featureID);
+ }
+
+
+ // **************** version -> schema location mapping ********************
+
+ private static String namespace = JPA.SCHEMA_NAMESPACE;
+
+ @Override
+ protected String getNamespace() {
+ return namespace;
+ }
+
+ private static Map<String, String> versionsToSchemaLocations = buildVersionsToSchemaLocations();
+
+ private static Map<String, String> buildVersionsToSchemaLocations() {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put(JPA.SCHEMA_VERSION, JPA.SCHEMA_LOCATION);
+ map.put(JPA2_0.SCHEMA_VERSION, JPA2_0.SCHEMA_LOCATION);
+ return map;
+ }
+
+ @Override
+ protected String getSchemaLocationForVersion(String version) {
+ return versionsToSchemaLocations.get(version);
+ }
+
+
+ // **************** translators *******************************************
+
+ private static final Translator ROOT_TRANSLATOR = buildRootTranslator();
+
+ public static Translator getRootTranslator() {
+ return ROOT_TRANSLATOR;
+ }
+
+ private static Translator buildRootTranslator() {
+ return new SimpleRootTranslator(
+ JPA.PERSISTENCE,
+ PersistencePackage.eINSTANCE.getXmlPersistence(),
+ buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildVersionTranslator(versionsToSchemaLocations),
+ buildNamespaceTranslator(namespace),
+ buildSchemaNamespaceTranslator(),
+ buildSchemaLocationTranslator(namespace, versionsToSchemaLocations),
+ XmlPersistenceUnit.buildTranslator(JPA.PERSISTENCE_UNIT, PersistencePackage.eINSTANCE.getXmlPersistence_PersistenceUnits())
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnit.java
new file mode 100644
index 0000000000..5e9b32d7ab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnit.java
@@ -0,0 +1,1105 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.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.EStructuralFeature;
+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.common.core.internal.utility.translators.BooleanTranslator;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Unit</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getProvider <em>Provider</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getJtaDataSource <em>Jta Data Source</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getNonJtaDataSource <em>Non Jta Data Source</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getMappingFiles <em>Mapping Files</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getJarFiles <em>Jar Files</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getClasses <em>Classes</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getProperties <em>Properties</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getTransactionType <em>Transaction Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlPersistenceUnit extends AbstractJpaEObject implements XmlPersistenceUnit_2_0
+{
+ /**
+ * 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 XmlPersistenceUnitCachingType_2_0 SHARED_CACHE_MODE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getSharedCacheMode() <em>Shared Cache Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSharedCacheMode()
+ * @generated
+ * @ordered
+ */
+ protected XmlPersistenceUnitCachingType_2_0 sharedCacheMode = SHARED_CACHE_MODE_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 XmlPersistenceUnitValidationModeType_2_0 VALIDATION_MODE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getValidationMode() <em>Validation Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValidationMode()
+ * @generated
+ * @ordered
+ */
+ protected XmlPersistenceUnitValidationModeType_2_0 validationMode = VALIDATION_MODE_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 default value of the '{@link #getProvider() <em>Provider</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getProvider()
+ * @generated
+ * @ordered
+ */
+ protected static final String PROVIDER_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getProvider() <em>Provider</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getProvider()
+ * @generated
+ * @ordered
+ */
+ protected String provider = PROVIDER_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getJtaDataSource() <em>Jta Data Source</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJtaDataSource()
+ * @generated
+ * @ordered
+ */
+ protected static final String JTA_DATA_SOURCE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getJtaDataSource() <em>Jta Data Source</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJtaDataSource()
+ * @generated
+ * @ordered
+ */
+ protected String jtaDataSource = JTA_DATA_SOURCE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getNonJtaDataSource() <em>Non Jta Data Source</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNonJtaDataSource()
+ * @generated
+ * @ordered
+ */
+ protected static final String NON_JTA_DATA_SOURCE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getNonJtaDataSource() <em>Non Jta Data Source</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNonJtaDataSource()
+ * @generated
+ * @ordered
+ */
+ protected String nonJtaDataSource = NON_JTA_DATA_SOURCE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getMappingFiles() <em>Mapping Files</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappingFiles()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlMappingFileRef> mappingFiles;
+
+ /**
+ * The cached value of the '{@link #getJarFiles() <em>Jar Files</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJarFiles()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlJarFileRef> jarFiles;
+
+ /**
+ * The cached value of the '{@link #getClasses() <em>Classes</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getClasses()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlJavaClassRef> classes;
+
+ /**
+ * The default value of the '{@link #getExcludeUnlistedClasses() <em>Exclude Unlisted Classes</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getExcludeUnlistedClasses()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean EXCLUDE_UNLISTED_CLASSES_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getExcludeUnlistedClasses() <em>Exclude Unlisted Classes</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getExcludeUnlistedClasses()
+ * @generated
+ * @ordered
+ */
+ protected Boolean excludeUnlistedClasses = EXCLUDE_UNLISTED_CLASSES_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getProperties()
+ * @generated
+ * @ordered
+ */
+ protected XmlProperties properties;
+
+ /**
+ * 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 XmlPersistenceUnitTransactionType TRANSACTION_TYPE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTransactionType() <em>Transaction Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTransactionType()
+ * @generated
+ * @ordered
+ */
+ protected XmlPersistenceUnitTransactionType transactionType = TRANSACTION_TYPE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlPersistenceUnit()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_PERSISTENCE_UNIT;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Shared Cache Mode</b></em>' attribute.
+ * The default value is <code>"UNSPECIFIED"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Shared Cache Mode</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Shared Cache Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0
+ * @see #setSharedCacheMode(XmlPersistenceUnitCachingType_2_0)
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_2_0_SharedCacheMode()
+ * @model default="UNSPECIFIED" unique="false"
+ * @generated
+ */
+ public XmlPersistenceUnitCachingType_2_0 getSharedCacheMode()
+ {
+ return sharedCacheMode;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getSharedCacheMode <em>Shared Cache Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Shared Cache Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0
+ * @see #getSharedCacheMode()
+ * @generated
+ */
+ public void setSharedCacheMode(XmlPersistenceUnitCachingType_2_0 newSharedCacheMode)
+ {
+ XmlPersistenceUnitCachingType_2_0 oldSharedCacheMode = sharedCacheMode;
+ sharedCacheMode = newSharedCacheMode == null ? SHARED_CACHE_MODE_EDEFAULT : newSharedCacheMode;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE, oldSharedCacheMode, sharedCacheMode));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Validation Mode</b></em>' attribute.
+ * The default value is <code>"AUTO"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Validation Mode</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Validation Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0
+ * @see #setValidationMode(XmlPersistenceUnitValidationModeType_2_0)
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_2_0_ValidationMode()
+ * @model default="AUTO" unique="false"
+ * @generated
+ */
+ public XmlPersistenceUnitValidationModeType_2_0 getValidationMode()
+ {
+ return validationMode;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getValidationMode <em>Validation Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Validation Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0
+ * @see #getValidationMode()
+ * @generated
+ */
+ public void setValidationMode(XmlPersistenceUnitValidationModeType_2_0 newValidationMode)
+ {
+ XmlPersistenceUnitValidationModeType_2_0 oldValidationMode = validationMode;
+ validationMode = newValidationMode == null ? VALIDATION_MODE_EDEFAULT : newValidationMode;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE, oldValidationMode, validationMode));
+ }
+
+ /**
+ * 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.jpa.core.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.jpa.core.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.jpa.core.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.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see #setTransactionType(XmlPersistenceUnitTransactionType)
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_TransactionType()
+ * @model default="JTA" unique="false"
+ * @generated
+ */
+ public XmlPersistenceUnitTransactionType getTransactionType()
+ {
+ return transactionType;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see #getTransactionType()
+ * @generated
+ */
+ public void setTransactionType(XmlPersistenceUnitTransactionType newTransactionType)
+ {
+ XmlPersistenceUnitTransactionType oldTransactionType = transactionType;
+ transactionType = newTransactionType == null ? TRANSACTION_TYPE_EDEFAULT : newTransactionType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE, oldTransactionType, transactionType));
+ }
+
+ /**
+ * 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.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Description()
+ * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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)
+ {
+ String oldDescription = description;
+ description = newDescription;
+ if (eNotificationRequired())
+ 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.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Provider()
+ * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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)
+ {
+ String oldProvider = provider;
+ provider = newProvider;
+ if (eNotificationRequired())
+ 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.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_JtaDataSource()
+ * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getJtaDataSource()
+ {
+ return jtaDataSource;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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)
+ {
+ String oldJtaDataSource = jtaDataSource;
+ jtaDataSource = newJtaDataSource;
+ if (eNotificationRequired())
+ 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.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_NonJtaDataSource()
+ * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getNonJtaDataSource()
+ {
+ return nonJtaDataSource;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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)
+ {
+ String oldNonJtaDataSource = nonJtaDataSource;
+ nonJtaDataSource = newNonJtaDataSource;
+ if (eNotificationRequired())
+ 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.jpa.core.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.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_MappingFiles()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlMappingFileRef> getMappingFiles()
+ {
+ if (mappingFiles == null)
+ {
+ mappingFiles = new EObjectContainmentEList<XmlMappingFileRef>(XmlMappingFileRef.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES);
+ }
+ return mappingFiles;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Jar Files</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef}.
+ * <!-- 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>' containment reference list.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_JarFiles()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJarFileRef> getJarFiles()
+ {
+ if (jarFiles == null)
+ {
+ jarFiles = new EObjectContainmentEList<XmlJarFileRef>(XmlJarFileRef.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.jpa.core.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.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Classes()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlJavaClassRef> getClasses()
+ {
+ if (classes == null)
+ {
+ classes = new EObjectContainmentEList<XmlJavaClassRef>(XmlJavaClassRef.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES);
+ }
+ return classes;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Exclude Unlisted Classes</b></em>' attribute.
+ * <!-- 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 #setExcludeUnlistedClasses(Boolean)
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_ExcludeUnlistedClasses()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getExcludeUnlistedClasses()
+ {
+ return excludeUnlistedClasses;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getExcludeUnlistedClasses <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.
+ * @see #getExcludeUnlistedClasses()
+ * @generated
+ */
+ public void setExcludeUnlistedClasses(Boolean newExcludeUnlistedClasses)
+ {
+ Boolean oldExcludeUnlistedClasses = excludeUnlistedClasses;
+ excludeUnlistedClasses = newExcludeUnlistedClasses;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES, oldExcludeUnlistedClasses, excludeUnlistedClasses));
+ }
+
+ /**
+ * 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(XmlProperties)
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Properties()
+ * @model containment="true"
+ * @generated
+ */
+ public XmlProperties getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetProperties(XmlProperties newProperties, NotificationChain msgs)
+ {
+ XmlProperties oldProperties = properties;
+ properties = newProperties;
+ 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.jpa.core.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(XmlProperties newProperties)
+ {
+ if (newProperties != properties)
+ {
+ NotificationChain msgs = null;
+ if (properties != null)
+ 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.XML_PERSISTENCE_UNIT__PROPERTIES, null, msgs);
+ msgs = basicSetProperties(newProperties, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, newProperties, newProperties));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ 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__JAR_FILES:
+ return ((InternalEList<?>)getJarFiles()).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);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE:
+ return getSharedCacheMode();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE:
+ return getValidationMode();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
+ return getDescription();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
+ return getProvider();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
+ return getJtaDataSource();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE:
+ return getNonJtaDataSource();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
+ return getMappingFiles();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
+ return getJarFiles();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
+ return getClasses();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
+ return getExcludeUnlistedClasses();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
+ return getProperties();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
+ return getName();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
+ return getTransactionType();
+ }
+ 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_UNIT__SHARED_CACHE_MODE:
+ setSharedCacheMode((XmlPersistenceUnitCachingType_2_0)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE:
+ setValidationMode((XmlPersistenceUnitValidationModeType_2_0)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
+ setProvider((String)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
+ setJtaDataSource((String)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE:
+ setNonJtaDataSource((String)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
+ getMappingFiles().clear();
+ getMappingFiles().addAll((Collection<? extends XmlMappingFileRef>)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
+ getJarFiles().clear();
+ getJarFiles().addAll((Collection<? extends XmlJarFileRef>)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
+ getClasses().clear();
+ getClasses().addAll((Collection<? extends XmlJavaClassRef>)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
+ setExcludeUnlistedClasses((Boolean)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
+ setProperties((XmlProperties)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
+ setName((String)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
+ setTransactionType((XmlPersistenceUnitTransactionType)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_UNIT__SHARED_CACHE_MODE:
+ setSharedCacheMode(SHARED_CACHE_MODE_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE:
+ setValidationMode(VALIDATION_MODE_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
+ setProvider(PROVIDER_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
+ setJtaDataSource(JTA_DATA_SOURCE_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE:
+ setNonJtaDataSource(NON_JTA_DATA_SOURCE_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
+ getMappingFiles().clear();
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
+ getJarFiles().clear();
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
+ getClasses().clear();
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
+ setExcludeUnlistedClasses(EXCLUDE_UNLISTED_CLASSES_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
+ setProperties((XmlProperties)null);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
+ setTransactionType(TRANSACTION_TYPE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE:
+ return sharedCacheMode != SHARED_CACHE_MODE_EDEFAULT;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE:
+ return validationMode != VALIDATION_MODE_EDEFAULT;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
+ return PROVIDER_EDEFAULT == null ? provider != null : !PROVIDER_EDEFAULT.equals(provider);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
+ return JTA_DATA_SOURCE_EDEFAULT == null ? jtaDataSource != null : !JTA_DATA_SOURCE_EDEFAULT.equals(jtaDataSource);
+ 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.XML_PERSISTENCE_UNIT__MAPPING_FILES:
+ return mappingFiles != null && !mappingFiles.isEmpty();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
+ return jarFiles != null && !jarFiles.isEmpty();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
+ return classes != null && !classes.isEmpty();
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
+ return EXCLUDE_UNLISTED_CLASSES_EDEFAULT == null ? excludeUnlistedClasses != null : !EXCLUDE_UNLISTED_CLASSES_EDEFAULT.equals(excludeUnlistedClasses);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
+ return properties != null;
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
+ return transactionType != TRANSACTION_TYPE_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(" (sharedCacheMode: ");
+ result.append(sharedCacheMode);
+ result.append(", validationMode: ");
+ result.append(validationMode);
+ result.append(", description: ");
+ result.append(description);
+ result.append(", provider: ");
+ result.append(provider);
+ result.append(", jtaDataSource: ");
+ result.append(jtaDataSource);
+ result.append(", nonJtaDataSource: ");
+ result.append(nonJtaDataSource);
+ result.append(", excludeUnlistedClasses: ");
+ result.append(excludeUnlistedClasses);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", transactionType: ");
+ result.append(transactionType);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ PersistencePackage pkg = PersistencePackage.eINSTANCE;
+ return new Translator[] {
+ buildNameTranslator(),
+ buildTransactionTypeTranslator(),
+ buildDescriptionTranslator(),
+ buildProviderTranslator(),
+ buildJtaDataSourceTranslator(),
+ buildNonJtaDataSourceTranslator(),
+ XmlMappingFileRef.buildTranslator(JPA.MAPPING_FILE, pkg.getXmlPersistenceUnit_MappingFiles()),
+ XmlJarFileRef.buildTranslator(JPA.JAR_FILE, pkg.getXmlPersistenceUnit_JarFiles()),
+ XmlJavaClassRef.buildTranslator(JPA.CLASS, pkg.getXmlPersistenceUnit_Classes()),
+ buildExcludeUnlistedClassesTranslator(),
+ buildSharedCacheModeTranslator(),
+ buildValidationModeTranslator(),
+ XmlProperties.buildTranslator(JPA.PROPERTIES, pkg.getXmlPersistenceUnit_Properties())};
+ }
+
+ protected static Translator buildNameTranslator() {
+ return new Translator(
+ JPA.PERSISTENCE_UNIT__NAME,
+ PersistencePackage.eINSTANCE.getXmlPersistenceUnit_Name(),
+ Translator.DOM_ATTRIBUTE);
+ }
+
+ protected static Translator buildTransactionTypeTranslator() {
+ return new Translator(
+ JPA.PERSISTENCE_UNIT__TRANSACTION_TYPE,
+ PersistencePackage.eINSTANCE.getXmlPersistenceUnit_TransactionType(),
+ Translator.DOM_ATTRIBUTE | Translator.UNSET_IF_NULL);
+ }
+
+ protected static Translator buildDescriptionTranslator() {
+ return new Translator(
+ JPA.DESCRIPTION,
+ PersistencePackage.eINSTANCE.getXmlPersistenceUnit_Description());
+ }
+
+ protected static Translator buildProviderTranslator() {
+ return new Translator(
+ JPA.PROVIDER,
+ PersistencePackage.eINSTANCE.getXmlPersistenceUnit_Provider());
+ }
+
+ protected static Translator buildJtaDataSourceTranslator() {
+ return new Translator(
+ JPA.JTA_DATA_SOURCE,
+ PersistencePackage.eINSTANCE.getXmlPersistenceUnit_JtaDataSource());
+ }
+
+ protected static Translator buildNonJtaDataSourceTranslator() {
+ return new Translator(
+ JPA.NON_JTA_DATA_SOURCE,
+ PersistencePackage.eINSTANCE.getXmlPersistenceUnit_NonJtaDataSource());
+ }
+
+ protected static Translator buildExcludeUnlistedClassesTranslator() {
+ return new BooleanTranslator(
+ JPA.EXCLUDE_UNLISTED_CLASSES,
+ PersistencePackage.eINSTANCE.getXmlPersistenceUnit_ExcludeUnlistedClasses());
+ }
+
+ protected static Translator buildSharedCacheModeTranslator() {
+ return new Translator(
+ JPA2_0.PERSISTENCE_UNIT__SHARED_CACHE_MODE,
+ PersistenceV2_0Package.eINSTANCE.getXmlPersistenceUnit_2_0_SharedCacheMode());
+ }
+
+ protected static Translator buildValidationModeTranslator() {
+ return new Translator(
+ JPA2_0.PERSISTENCE_UNIT__VALIDATION_MODE,
+ PersistenceV2_0Package.eINSTANCE.getXmlPersistenceUnit_2_0_ValidationMode());
+ }
+
+
+ public int getLocationToInsertMappingFileRef() {
+ if (getMappingFiles().size() > 0) {
+ XmlMappingFileRef mappingFileRef = CollectionTools.last(this.getMappingFiles());
+ return mappingFileRef.getNodeEndOffset();
+ }
+
+ IDOMNode elementNode = null;
+ if (getNonJtaDataSource() != null) {
+ elementNode = getElementNode(JPA.NON_JTA_DATA_SOURCE);
+ }
+ else if (getJtaDataSource() != null) {
+ elementNode = getElementNode(JPA.JTA_DATA_SOURCE);
+ }
+ else if (getProvider() != null) {
+ elementNode = getElementNode(JPA.PROVIDER);
+ }
+ else if (getDescription() != null) {
+ elementNode = getElementNode(JPA.DESCRIPTION);
+ }
+ if (elementNode != null) {
+ return elementNode.getLastStructuredDocumentRegion().getEnd();
+ }
+ return this.node.getFirstStructuredDocumentRegion().getEnd();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnitTransactionType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnitTransactionType.java
new file mode 100644
index 0000000000..1935e3abb4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnitTransactionType.java
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+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>Unit Transaction Type</b></em>',
+ * and utility methods for working with them.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionType()
+ * @model
+ * @generated
+ */
+public enum XmlPersistenceUnitTransactionType implements Enumerator
+{
+ /**
+ * The '<em><b>JTA</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #JTA_VALUE
+ * @generated
+ * @ordered
+ */
+ JTA(0, "JTA", "JTA"),
+
+ /**
+ * The '<em><b>RESOURCE LOCAL</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #RESOURCE_LOCAL_VALUE
+ * @generated
+ * @ordered
+ */
+ RESOURCE_LOCAL(1, "RESOURCE_LOCAL", "RESOURCE_LOCAL");
+
+ /**
+ * The '<em><b>JTA</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>JTA</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #JTA
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int JTA_VALUE = 0;
+
+ /**
+ * The '<em><b>RESOURCE LOCAL</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>RESOURCE LOCAL</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #RESOURCE_LOCAL
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int RESOURCE_LOCAL_VALUE = 1;
+
+ /**
+ * 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 XmlPersistenceUnitTransactionType[] VALUES_ARRAY =
+ new XmlPersistenceUnitTransactionType[]
+ {
+ JTA,
+ RESOURCE_LOCAL,
+ };
+
+ /**
+ * 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<XmlPersistenceUnitTransactionType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * 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 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;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 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 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;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 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 XmlPersistenceUnitTransactionType get(int value)
+ {
+ switch (value)
+ {
+ case JTA_VALUE: return JTA;
+ case RESOURCE_LOCAL_VALUE: return RESOURCE_LOCAL;
+ }
+ 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 XmlPersistenceUnitTransactionType(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;
+ }
+
+} //XmlPersistenceUnitTransactionType
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperties.java
new file mode 100644
index 0000000000..6254cdafce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperties.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlProperties</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlProperties#getProperties <em>Properties</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlProperties()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class XmlProperties extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getProperties()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlProperty> properties;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlProperties()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ 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.jpa.core.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.jpa.core.resource.persistence.PersistencePackage#getXmlProperties_Properties()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlProperty> getProperties()
+ {
+ if (properties == null)
+ {
+ properties = new EObjectContainmentEList<XmlProperty>(XmlProperty.class, this, PersistencePackage.XML_PROPERTIES__PROPERTIES);
+ }
+ return properties;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
+ return getProperties();
+ }
+ 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_PROPERTIES__PROPERTIES:
+ getProperties().clear();
+ getProperties().addAll((Collection<? extends XmlProperty>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
+ getProperties().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
+ return properties != null && !properties.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren());
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ XmlProperty.buildTranslator(JPA.PROPERTY, PersistencePackage.eINSTANCE.getXmlProperties_Properties()),
+ };
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperty.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperty.java
new file mode 100644
index 0000000000..1f5583c7a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperty.java
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlProperty</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty#getValue <em>Value</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlProperty()
+ * @model kind="class"
+ * @extends JpaEObject
+ * @generated
+ */
+public class XmlProperty extends AbstractJpaEObject implements JpaEObject
+{
+ /**
+ * 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;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlProperty()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ 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.jpa.core.resource.persistence.PersistencePackage#getXmlProperty_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.jpa.core.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)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ 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.jpa.core.resource.persistence.PersistencePackage#getXmlProperty_Value()
+ * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.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)
+ {
+ String oldValue = value;
+ value = newValue;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PROPERTY__VALUE, oldValue, value));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTY__NAME:
+ return getName();
+ case PersistencePackage.XML_PROPERTY__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 PersistencePackage.XML_PROPERTY__NAME:
+ setName((String)newValue);
+ return;
+ case PersistencePackage.XML_PROPERTY__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 PersistencePackage.XML_PROPERTY__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case PersistencePackage.XML_PROPERTY__VALUE:
+ setValue(VALUE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTY__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case PersistencePackage.XML_PROPERTY__VALUE:
+ return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
+ }
+ return super.eIsSet(featureID);
+ }
+
+
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuilder result = new StringBuilder(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", value: ");
+ result.append(value);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // ********** translators **********
+
+ public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
+ return new SimpleTranslator(
+ elementName,
+ structuralFeature,
+ Translator.END_TAG_NO_INDENT,
+ buildTranslatorChildren()
+ );
+ }
+
+ private static Translator[] buildTranslatorChildren() {
+ return new Translator[] {
+ buildNameTranslator(),
+ buildValueTranslator()
+ };
+ }
+
+ private static Translator buildNameTranslator() {
+ return new Translator(
+ JPA.PROPERTY__NAME,
+ PersistencePackage.eINSTANCE.getXmlProperty_Name(),
+ Translator.DOM_ATTRIBUTE
+ );
+ }
+
+ private static Translator buildValueTranslator() {
+ return new Translator(
+ JPA.PROPERTY__VALUE,
+ PersistencePackage.eINSTANCE.getXmlProperty_Value(),
+ Translator.DOM_ATTRIBUTE
+ );
+ }
+
+ public ReplaceEdit createRenameTypeEdit(IType originalType, String newName) {
+ String originalName = originalType.getElementName();
+ int nameIndex = originalType.getFullyQualifiedName('.').lastIndexOf(originalName);
+
+ int offset = getAttributeNode(JPA.PROPERTY__VALUE).getValueRegionStartOffset() + 1;
+ return new ReplaceEdit(offset + nameIndex, originalName.length(), newName);
+ }
+
+ public ReplaceEdit createRenamePackageEdit(String newName) {
+ int packageLength = this.value.lastIndexOf('.');
+
+ int offset = getAttributeNode(JPA.PROPERTY__VALUE).getValueRegionStartOffset() + 1;
+ return new ReplaceEdit(offset, packageLength, newName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/JPA2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/JPA2_0.java
new file mode 100644
index 0000000000..3eb10219ff
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/JPA2_0.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.persistence.JPA;
+
+/**
+ * JPA persistence2_0.xml-related stuff (elements, attributes etc.)
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+@SuppressWarnings("nls")
+public interface JPA2_0
+ extends JPA
+{
+ String SCHEMA_NAMESPACE = JPA.SCHEMA_NAMESPACE;
+ String SCHEMA_LOCATION = "http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
+ String SCHEMA_VERSION = "2.0";
+
+ // JPA 2.0 specific nodes
+
+ String PERSISTENCE_UNIT__SHARED_CACHE_MODE = "shared-cache-mode";
+ String PERSISTENCE_UNIT__VALIDATION_MODE = "validation-mode";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Factory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Factory.java
new file mode 100644
index 0000000000..c3ae90621d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Factory.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence.v2_0;
+
+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.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package
+ * @generated
+ */
+public class PersistenceV2_0Factory extends EFactoryImpl
+{
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final PersistenceV2_0Factory eINSTANCE = init();
+
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static PersistenceV2_0Factory init()
+ {
+ try
+ {
+ PersistenceV2_0Factory thePersistenceV2_0Factory = (PersistenceV2_0Factory)EPackage.Registry.INSTANCE.getEFactory("jpt.persistence.v2_0.xmi");
+ if (thePersistenceV2_0Factory != null)
+ {
+ return thePersistenceV2_0Factory;
+ }
+ }
+ catch (Exception exception)
+ {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new PersistenceV2_0Factory();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistenceV2_0Factory()
+ {
+ 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 PersistenceV2_0Package.XML_PERSISTENCE_UNIT_CACHING_TYPE_20:
+ return createXmlPersistenceUnitCachingType_2_0FromString(eDataType, initialValue);
+ case PersistenceV2_0Package.XML_PERSISTENCE_UNIT_VALIDATION_MODE_TYPE_20:
+ return createXmlPersistenceUnitValidationModeType_2_0FromString(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 PersistenceV2_0Package.XML_PERSISTENCE_UNIT_CACHING_TYPE_20:
+ return convertXmlPersistenceUnitCachingType_2_0ToString(eDataType, instanceValue);
+ case PersistenceV2_0Package.XML_PERSISTENCE_UNIT_VALIDATION_MODE_TYPE_20:
+ return convertXmlPersistenceUnitValidationModeType_2_0ToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlPersistenceUnitCachingType_2_0 createXmlPersistenceUnitCachingType_2_0FromString(EDataType eDataType, String initialValue)
+ {
+ XmlPersistenceUnitCachingType_2_0 result = XmlPersistenceUnitCachingType_2_0.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 convertXmlPersistenceUnitCachingType_2_0ToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlPersistenceUnitValidationModeType_2_0 createXmlPersistenceUnitValidationModeType_2_0FromString(EDataType eDataType, String initialValue)
+ {
+ XmlPersistenceUnitValidationModeType_2_0 result = XmlPersistenceUnitValidationModeType_2_0.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 convertXmlPersistenceUnitValidationModeType_2_0ToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistenceV2_0Package getPersistenceV2_0Package()
+ {
+ return (PersistenceV2_0Package)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static PersistenceV2_0Package getPackage()
+ {
+ return PersistenceV2_0Package.eINSTANCE;
+ }
+
+} //PersistenceV2_0Factory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Package.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Package.java
new file mode 100644
index 0000000000..6bc9f2150e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Package.java
@@ -0,0 +1,452 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence.v2_0;
+
+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.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage;
+import org.eclipse.jpt.jpa.core.resource.xml.CommonPackage;
+
+/**
+ * <!-- 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.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory
+ * @model kind="package"
+ * @generated
+ */
+public class PersistenceV2_0Package extends EPackageImpl
+{
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNAME = "v2_0";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_URI = "jpt.persistence.v2_0.xmi";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_PREFIX = "org.eclipse.jpt.jpa.core.resource.persistence.v2_0";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final PersistenceV2_0Package eINSTANCE = org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0 <em>Xml Persistence Unit 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnit_2_0()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_20 = 0;
+
+ /**
+ * The feature id for the '<em><b>Shared Cache Mode</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_20__SHARED_CACHE_MODE = 0;
+
+ /**
+ * The feature id for the '<em><b>Validation Mode</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_20__VALIDATION_MODE = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Persistence Unit 20</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_20_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0 <em>Xml Persistence Unit Caching Type 20</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnitCachingType_2_0()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_CACHING_TYPE_20 = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0 <em>Xml Persistence Unit Validation Mode Type 20</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnitValidationModeType_2_0()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_VALIDATION_MODE_TYPE_20 = 2;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPersistenceUnit_2_0EClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum xmlPersistenceUnitCachingType_2_0EEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum xmlPersistenceUnitValidationModeType_2_0EEnum = 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.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private PersistenceV2_0Package()
+ {
+ super(eNS_URI, PersistenceV2_0Factory.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.
+ *
+ * <p>This method is used to initialize {@link PersistenceV2_0Package#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static PersistenceV2_0Package init()
+ {
+ if (isInited) return (PersistenceV2_0Package)EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI);
+
+ // Obtain or create and register package
+ PersistenceV2_0Package thePersistenceV2_0Package = (PersistenceV2_0Package)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PersistenceV2_0Package ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PersistenceV2_0Package());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+
+ // Obtain or create and register interdependencies
+ CommonPackage theCommonPackage = (CommonPackage)(EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) instanceof CommonPackage ? EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) : CommonPackage.eINSTANCE);
+ OrmPackage theOrmPackage = (OrmPackage)(EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
+ OrmV2_0Package theOrmV2_0Package = (OrmV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) instanceof OrmV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) : OrmV2_0Package.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
+ thePersistenceV2_0Package.createPackageContents();
+ theCommonPackage.createPackageContents();
+ theOrmPackage.createPackageContents();
+ theOrmV2_0Package.createPackageContents();
+ thePersistencePackage.createPackageContents();
+
+ // Initialize created meta-data
+ thePersistenceV2_0Package.initializePackageContents();
+ theCommonPackage.initializePackageContents();
+ theOrmPackage.initializePackageContents();
+ theOrmV2_0Package.initializePackageContents();
+ thePersistencePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ thePersistenceV2_0Package.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(PersistenceV2_0Package.eNS_URI, thePersistenceV2_0Package);
+ return thePersistenceV2_0Package;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0 <em>Xml Persistence Unit 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Persistence Unit 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0
+ * @generated
+ */
+ public EClass getXmlPersistenceUnit_2_0()
+ {
+ return xmlPersistenceUnit_2_0EClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getSharedCacheMode <em>Shared Cache Mode</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Shared Cache Mode</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getSharedCacheMode()
+ * @see #getXmlPersistenceUnit_2_0()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_2_0_SharedCacheMode()
+ {
+ return (EAttribute)xmlPersistenceUnit_2_0EClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getValidationMode <em>Validation Mode</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Validation Mode</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getValidationMode()
+ * @see #getXmlPersistenceUnit_2_0()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_2_0_ValidationMode()
+ {
+ return (EAttribute)xmlPersistenceUnit_2_0EClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0 <em>Xml Persistence Unit Caching Type 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Xml Persistence Unit Caching Type 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0
+ * @generated
+ */
+ public EEnum getXmlPersistenceUnitCachingType_2_0()
+ {
+ return xmlPersistenceUnitCachingType_2_0EEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0 <em>Xml Persistence Unit Validation Mode Type 20</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Xml Persistence Unit Validation Mode Type 20</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0
+ * @generated
+ */
+ public EEnum getXmlPersistenceUnitValidationModeType_2_0()
+ {
+ return xmlPersistenceUnitValidationModeType_2_0EEnum;
+ }
+
+ /**
+ * 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 PersistenceV2_0Factory getPersistenceV2_0Factory()
+ {
+ return (PersistenceV2_0Factory)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
+ xmlPersistenceUnit_2_0EClass = createEClass(XML_PERSISTENCE_UNIT_20);
+ createEAttribute(xmlPersistenceUnit_2_0EClass, XML_PERSISTENCE_UNIT_20__SHARED_CACHE_MODE);
+ createEAttribute(xmlPersistenceUnit_2_0EClass, XML_PERSISTENCE_UNIT_20__VALIDATION_MODE);
+
+ // Create enums
+ xmlPersistenceUnitCachingType_2_0EEnum = createEEnum(XML_PERSISTENCE_UNIT_CACHING_TYPE_20);
+ xmlPersistenceUnitValidationModeType_2_0EEnum = createEEnum(XML_PERSISTENCE_UNIT_VALIDATION_MODE_TYPE_20);
+ }
+
+ /**
+ * <!-- 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);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(xmlPersistenceUnit_2_0EClass, XmlPersistenceUnit_2_0.class, "XmlPersistenceUnit_2_0", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlPersistenceUnit_2_0_SharedCacheMode(), this.getXmlPersistenceUnitCachingType_2_0(), "sharedCacheMode", "UNSPECIFIED", 0, 1, XmlPersistenceUnit_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_2_0_ValidationMode(), this.getXmlPersistenceUnitValidationModeType_2_0(), "validationMode", "AUTO", 0, 1, XmlPersistenceUnit_2_0.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(xmlPersistenceUnitCachingType_2_0EEnum, XmlPersistenceUnitCachingType_2_0.class, "XmlPersistenceUnitCachingType_2_0");
+ addEEnumLiteral(xmlPersistenceUnitCachingType_2_0EEnum, XmlPersistenceUnitCachingType_2_0.ALL);
+ addEEnumLiteral(xmlPersistenceUnitCachingType_2_0EEnum, XmlPersistenceUnitCachingType_2_0.NONE);
+ addEEnumLiteral(xmlPersistenceUnitCachingType_2_0EEnum, XmlPersistenceUnitCachingType_2_0.ENABLE_SELECTIVE);
+ addEEnumLiteral(xmlPersistenceUnitCachingType_2_0EEnum, XmlPersistenceUnitCachingType_2_0.DISABLE_SELECTIVE);
+ addEEnumLiteral(xmlPersistenceUnitCachingType_2_0EEnum, XmlPersistenceUnitCachingType_2_0.UNSPECIFIED);
+
+ initEEnum(xmlPersistenceUnitValidationModeType_2_0EEnum, XmlPersistenceUnitValidationModeType_2_0.class, "XmlPersistenceUnitValidationModeType_2_0");
+ addEEnumLiteral(xmlPersistenceUnitValidationModeType_2_0EEnum, XmlPersistenceUnitValidationModeType_2_0.AUTO);
+ addEEnumLiteral(xmlPersistenceUnitValidationModeType_2_0EEnum, XmlPersistenceUnitValidationModeType_2_0.CALLBACK);
+ addEEnumLiteral(xmlPersistenceUnitValidationModeType_2_0EEnum, XmlPersistenceUnitValidationModeType_2_0.NONE);
+ }
+
+ /**
+ * <!-- 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.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0 <em>Xml Persistence Unit 20</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnit_2_0()
+ * @generated
+ */
+ public static final EClass XML_PERSISTENCE_UNIT_20 = eINSTANCE.getXmlPersistenceUnit_2_0();
+
+ /**
+ * The meta object literal for the '<em><b>Shared Cache Mode</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT_20__SHARED_CACHE_MODE = eINSTANCE.getXmlPersistenceUnit_2_0_SharedCacheMode();
+
+ /**
+ * The meta object literal for the '<em><b>Validation Mode</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT_20__VALIDATION_MODE = eINSTANCE.getXmlPersistenceUnit_2_0_ValidationMode();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0 <em>Xml Persistence Unit Caching Type 20</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnitCachingType_2_0()
+ * @generated
+ */
+ public static final EEnum XML_PERSISTENCE_UNIT_CACHING_TYPE_20 = eINSTANCE.getXmlPersistenceUnitCachingType_2_0();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0 <em>Xml Persistence Unit Validation Mode Type 20</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnitValidationModeType_2_0()
+ * @generated
+ */
+ public static final EEnum XML_PERSISTENCE_UNIT_VALIDATION_MODE_TYPE_20 = eINSTANCE.getXmlPersistenceUnitValidationModeType_2_0();
+
+ }
+
+} //PersistenceV2_0Package
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitCachingType_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitCachingType_2_0.java
new file mode 100644
index 0000000000..9adf1f8d93
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitCachingType_2_0.java
@@ -0,0 +1,312 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence.v2_0;
+
+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>Xml Persistence Unit Caching Type 20</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnitCachingType_2_0()
+ * @model
+ * @generated
+ */
+public enum XmlPersistenceUnitCachingType_2_0 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>NONE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #NONE_VALUE
+ * @generated
+ * @ordered
+ */
+ NONE(1, "NONE", "NONE"),
+
+ /**
+ * The '<em><b>ENABLE SELECTIVE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #ENABLE_SELECTIVE_VALUE
+ * @generated
+ * @ordered
+ */
+ ENABLE_SELECTIVE(2, "ENABLE_SELECTIVE", "ENABLE_SELECTIVE"),
+
+ /**
+ * The '<em><b>DISABLE SELECTIVE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #DISABLE_SELECTIVE_VALUE
+ * @generated
+ * @ordered
+ */
+ DISABLE_SELECTIVE(3, "DISABLE_SELECTIVE", "DISABLE_SELECTIVE"),
+
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED_VALUE
+ * @generated
+ * @ordered
+ */
+ UNSPECIFIED(4, "UNSPECIFIED", "UNSPECIFIED");
+
+ /**
+ * 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
+ * @generated
+ * @ordered
+ */
+ public static final int ALL_VALUE = 0;
+
+ /**
+ * 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
+ * @generated
+ * @ordered
+ */
+ public static final int NONE_VALUE = 1;
+
+ /**
+ * The '<em><b>ENABLE SELECTIVE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>ENABLE SELECTIVE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #ENABLE_SELECTIVE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int ENABLE_SELECTIVE_VALUE = 2;
+
+ /**
+ * The '<em><b>DISABLE SELECTIVE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>DISABLE SELECTIVE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #DISABLE_SELECTIVE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int DISABLE_SELECTIVE_VALUE = 3;
+
+ /**
+ * The '<em><b>UNSPECIFIED</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>UNSPECIFIED</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #UNSPECIFIED
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int UNSPECIFIED_VALUE = 4;
+
+ /**
+ * An array of all the '<em><b>Xml Persistence Unit Caching Type 20</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final XmlPersistenceUnitCachingType_2_0[] VALUES_ARRAY =
+ new XmlPersistenceUnitCachingType_2_0[]
+ {
+ ALL,
+ NONE,
+ ENABLE_SELECTIVE,
+ DISABLE_SELECTIVE,
+ UNSPECIFIED,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Xml Persistence Unit Caching Type 20</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<XmlPersistenceUnitCachingType_2_0> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Xml Persistence Unit Caching Type 20</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static XmlPersistenceUnitCachingType_2_0 get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ XmlPersistenceUnitCachingType_2_0 result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Xml Persistence Unit Caching Type 20</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static XmlPersistenceUnitCachingType_2_0 getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ XmlPersistenceUnitCachingType_2_0 result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Xml Persistence Unit Caching Type 20</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static XmlPersistenceUnitCachingType_2_0 get(int value)
+ {
+ switch (value)
+ {
+ case ALL_VALUE: return ALL;
+ case NONE_VALUE: return NONE;
+ case ENABLE_SELECTIVE_VALUE: return ENABLE_SELECTIVE;
+ case DISABLE_SELECTIVE_VALUE: return DISABLE_SELECTIVE;
+ case UNSPECIFIED_VALUE: return UNSPECIFIED;
+ }
+ 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 XmlPersistenceUnitCachingType_2_0(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;
+ }
+
+} //XmlPersistenceUnitCachingType_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitValidationModeType_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitValidationModeType_2_0.java
new file mode 100644
index 0000000000..437b260ed9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitValidationModeType_2_0.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence.v2_0;
+
+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>Xml Persistence Unit Validation Mode Type 20</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnitValidationModeType_2_0()
+ * @model
+ * @generated
+ */
+public enum XmlPersistenceUnitValidationModeType_2_0 implements Enumerator
+{
+ /**
+ * The '<em><b>AUTO</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #AUTO_VALUE
+ * @generated
+ * @ordered
+ */
+ AUTO(0, "AUTO", "AUTO"),
+
+ /**
+ * The '<em><b>CALLBACK</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #CALLBACK_VALUE
+ * @generated
+ * @ordered
+ */
+ CALLBACK(1, "CALLBACK", "CALLBACK"),
+
+ /**
+ * The '<em><b>NONE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #NONE_VALUE
+ * @generated
+ * @ordered
+ */
+ NONE(2, "NONE", "NONE");
+
+ /**
+ * The '<em><b>AUTO</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * 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 #AUTO
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int AUTO_VALUE = 0;
+
+ /**
+ * The '<em><b>CALLBACK</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>CALLBACK</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #CALLBACK
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int CALLBACK_VALUE = 1;
+
+ /**
+ * 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
+ * @generated
+ * @ordered
+ */
+ public static final int NONE_VALUE = 2;
+
+ /**
+ * An array of all the '<em><b>Xml Persistence Unit Validation Mode Type 20</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final XmlPersistenceUnitValidationModeType_2_0[] VALUES_ARRAY =
+ new XmlPersistenceUnitValidationModeType_2_0[]
+ {
+ AUTO,
+ CALLBACK,
+ NONE,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Xml Persistence Unit Validation Mode Type 20</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<XmlPersistenceUnitValidationModeType_2_0> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Xml Persistence Unit Validation Mode Type 20</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static XmlPersistenceUnitValidationModeType_2_0 get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ XmlPersistenceUnitValidationModeType_2_0 result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Xml Persistence Unit Validation Mode Type 20</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static XmlPersistenceUnitValidationModeType_2_0 getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ XmlPersistenceUnitValidationModeType_2_0 result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Xml Persistence Unit Validation Mode Type 20</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static XmlPersistenceUnitValidationModeType_2_0 get(int value)
+ {
+ switch (value)
+ {
+ case AUTO_VALUE: return AUTO;
+ case CALLBACK_VALUE: return CALLBACK;
+ case NONE_VALUE: return NONE;
+ }
+ 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 XmlPersistenceUnitValidationModeType_2_0(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;
+ }
+
+} //XmlPersistenceUnitValidationModeType_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnit_2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnit_2_0.java
new file mode 100644
index 0000000000..b5e85154b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnit_2_0.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.persistence.v2_0;
+
+import org.eclipse.jpt.jpa.core.resource.xml.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Persistence Unit 20</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getSharedCacheMode <em>Shared Cache Mode</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getValidationMode <em>Validation Mode</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnit_2_0()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface XmlPersistenceUnit_2_0 extends JpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Shared Cache Mode</b></em>' attribute.
+ * The default value is <code>"UNSPECIFIED"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Shared Cache Mode</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Shared Cache Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0
+ * @see #setSharedCacheMode(XmlPersistenceUnitCachingType_2_0)
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnit_2_0_SharedCacheMode()
+ * @model default="UNSPECIFIED" unique="false"
+ * @generated
+ */
+ XmlPersistenceUnitCachingType_2_0 getSharedCacheMode();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getSharedCacheMode <em>Shared Cache Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Shared Cache Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0
+ * @see #getSharedCacheMode()
+ * @generated
+ */
+ void setSharedCacheMode(XmlPersistenceUnitCachingType_2_0 value);
+
+ /**
+ * Returns the value of the '<em><b>Validation Mode</b></em>' attribute.
+ * The default value is <code>"AUTO"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Validation Mode</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Validation Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0
+ * @see #setValidationMode(XmlPersistenceUnitValidationModeType_2_0)
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package#getXmlPersistenceUnit_2_0_ValidationMode()
+ * @model default="AUTO" unique="false"
+ * @generated
+ */
+ XmlPersistenceUnitValidationModeType_2_0 getValidationMode();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0#getValidationMode <em>Validation Mode</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Validation Mode</em>' attribute.
+ * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0
+ * @see #getValidationMode()
+ * @generated
+ */
+ void setValidationMode(XmlPersistenceUnitValidationModeType_2_0 value);
+
+} // XmlPersistenceUnit_2_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaEObject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaEObject.java
new file mode 100644
index 0000000000..748a248790
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaEObject.java
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.jpt.common.core.utility.AbstractTextRange;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapter;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.2
+ */
+public abstract class AbstractJpaEObject
+ extends EObjectImpl
+ implements JpaEObject
+{
+ protected IDOMNode node;
+
+ /**
+ * Sets of "insignificant" feature ids, keyed by class.
+ * This is built up lazily, as the objects are modified.
+ */
+ private static final Hashtable<Class<? extends AbstractJpaEObject>, HashSet<Integer>> insignificantFeatureIdSets = new Hashtable<Class<? extends AbstractJpaEObject>, HashSet<Integer>>();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractJpaEObject() {
+ super();
+ }
+
+
+ // ********** JpaEObject implementation **********
+
+ public boolean isUnset() {
+ for (EStructuralFeature feature : this.eClass().getEAllStructuralFeatures()) {
+ if (this.eIsSet(feature)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ // ********** change notification **********
+
+ /**
+ * override to build a custom list for the adapters
+ */
+ @Override
+ public EList<Adapter> eAdapters() {
+ if (this.eAdapters == null) {
+ this.eAdapters = new XmlEAdapterList<Adapter>(this);
+ }
+ return this.eAdapters;
+ }
+
+ /**
+ * 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)) {
+ this.getXmlResource().resourceModelChanged();
+ }
+ }
+
+ protected JpaXmlResource getXmlResource() {
+ return (JpaXmlResource) this.eResource();
+ }
+
+ protected boolean featureIsSignificant(int featureId) {
+ return ! this.featureIsInsignificant(featureId);
+ }
+
+ protected boolean featureIsInsignificant(int featureId) {
+ return this.insignificantFeatureIds().contains(Integer.valueOf(featureId));
+ }
+
+ /**
+ * 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 #isUnset()
+ */
+ protected Set<Integer> insignificantFeatureIds() {
+ synchronized (insignificantFeatureIdSets) {
+ HashSet<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 updated, 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(@SuppressWarnings("unused") Set<Integer> insignificantXmlFeatureIds) {
+ // when you override this method, don't forget to include:
+ // super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+ }
+
+
+ // ********** text ranges **********
+
+ /**
+ * Return a text range for the "text" node.
+ * If the text node does not exist, return a text range for this object's node
+ */
+ protected TextRange getTextTextRange() {
+ IDOMNode textNode = this.getTextNode();
+ return (textNode != null) ? buildTextRange(textNode) : this.getValidationTextRange();
+ }
+
+ protected IDOMNode getTextNode() {
+ // virtual objects have no node
+ return (this.node == null) ? null : getTextNode(this.node);
+ }
+
+ protected static IDOMNode getTextNode(IDOMNode node) {
+ NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ IDOMNode child = (IDOMNode) children.item(i);
+ if (child.getNodeType() == Node.TEXT_NODE) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return a text range for the specified attribute node.
+ * If the attribute node does not exist, return a text range for this object's
+ * node
+ */
+ protected TextRange getAttributeTextRange(String attributeName) {
+ IDOMNode attributeNode = this.getAttributeNode(attributeName);
+ return (attributeNode != null) ? buildTextRange(attributeNode) : this.getValidationTextRange();
+ }
+
+ protected IDOMAttr getAttributeNode(String attributeName) {
+ return (this.node == null) ? // virtual objects have no node
+ null : (IDOMAttr) this.node.getAttributes().getNamedItem(attributeName);
+ }
+
+ /**
+ * Return a text range for the specified element node.
+ * If the element node does not exist, return a text range for this object's
+ * node
+ */
+ protected TextRange getElementTextRange(String elementName) {
+ IDOMNode elementNode = this.getElementNode(elementName);
+ return (elementNode != null) ? buildTextRange(elementNode) : this.getValidationTextRange();
+ }
+
+ /**
+ * Returns the first element node with the given name, if one exists
+ */
+ protected IDOMNode getElementNode(String elementName) {
+ if (this.node == null) return null; // virtual objects have no node
+ NodeList children = this.node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i ++) {
+ IDOMNode child = (IDOMNode) children.item(i);
+ if ((child.getNodeType() == Node.ELEMENT_NODE)
+ && elementName.equals(child.getNodeName())) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ public TextRange getValidationTextRange() {
+ return this.getFullTextRange();
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.getFullTextRange();
+ }
+
+ protected TextRange getFullTextRange() {
+ return buildTextRange(this.node);
+ }
+
+ protected static TextRange buildTextRange(IDOMNode domNode) {
+ return (domNode == null) ? null : new DOMNodeTextRange(domNode);
+ }
+
+ public boolean containsOffset(int textOffset) {
+ return (this.node == null) ? false : this.node.contains(textOffset);
+ }
+
+
+ // ********** Refactoring TextEdits **********
+
+ public DeleteEdit createDeleteEdit() {
+ int deletionOffset = getDeletionOffset();
+ int deletionLength = this.node.getEndOffset() - deletionOffset;
+ return new DeleteEdit(deletionOffset, deletionLength);
+ }
+
+ public int getNodeEndOffset() {
+ return this.node.getEndOffset();
+ }
+
+ /**
+ * deletion offset needs to include any text that is before the node
+ */
+ protected int getDeletionOffset() {
+ int emptyTextLength = 0;
+ Node previousSibling = this.node.getPreviousSibling();
+ if (previousSibling != null && previousSibling.getNodeType() == Node.TEXT_NODE) {
+ emptyTextLength = ((Text) previousSibling).getLength();
+ }
+ return this.node.getStartOffset() - emptyTextLength;
+ }
+
+
+ // ********** custom adapter list **********
+
+ protected static class XmlEAdapterList<E extends Object & Adapter>
+ extends EAdapterList<E>
+ {
+ public XmlEAdapterList(AbstractJpaEObject jpaEObject) {
+ super(jpaEObject);
+ }
+
+ @Override
+ protected void didAdd(int index, E newObject) {
+ super.didAdd(index, newObject);
+ if (newObject instanceof EMF2DOMAdapter) {
+ Object n = ((EMF2DOMAdapter) newObject).getNode();
+ if (n instanceof IDOMNode) {
+ ((AbstractJpaEObject) this.notifier).node = (IDOMNode) n;
+ }
+ }
+ }
+
+ @Override
+ protected void didRemove(int index, E oldObject) {
+ if ((oldObject instanceof EMF2DOMAdapter) &&
+ (((EMF2DOMAdapter) oldObject).getNode() == ((AbstractJpaEObject) this.notifier).node)) {
+ ((AbstractJpaEObject) this.notifier).node = null;
+ }
+ super.didRemove(index, oldObject);
+ }
+ }
+
+
+ // ********** DOM node text range **********
+
+ /**
+ * Adapt an IDOMNode to the TextRange interface.
+ */
+ protected static class DOMNodeTextRange
+ extends AbstractTextRange
+ {
+ private final IDOMNode node;
+
+ DOMNodeTextRange(IDOMNode node) {
+ super();
+ this.node = node;
+ }
+
+ public int getOffset() {
+ return this.node.getStartOffset();
+ }
+
+ public int getLength() {
+ if (this.node.getNodeType() == Node.ELEMENT_NODE) {
+ return ((IDOMElement) this.node).getStartEndOffset() - this.node.getStartOffset();
+ }
+ return this.node.getLength();
+ }
+
+ public int getLineNumber() {
+ return this.node.getStructuredDocument().getLineOfOffset(this.getOffset()) + 1;
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaRootEObject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaRootEObject.java
new file mode 100644
index 0000000000..df72ac8864
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaRootEObject.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+import java.util.Map;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.common.core.internal.utility.translators.EnumeratedValueTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Jpa Root EObject</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getAbstractJpaRootEObject()
+ * @model kind="class" abstract="true"
+ * @generated
+ */
+public abstract class AbstractJpaRootEObject extends AbstractJpaEObject implements JpaRootEObject
+{
+ /**
+ * 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 #getSchemaLocation() <em>Schema Location</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchemaLocation()
+ * @generated
+ * @ordered
+ */
+ protected static final String SCHEMA_LOCATION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getSchemaLocation() <em>Schema Location</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchemaLocation()
+ * @generated
+ * @ordered
+ */
+ protected String schemaLocation = SCHEMA_LOCATION_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractJpaRootEObject()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return CommonPackage.Literals.ABSTRACT_JPA_ROOT_EOBJECT;
+ }
+
+ /**
+ * 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.jpa.core.resource.xml.CommonPackage#getJpaRootEObject_Version()
+ * @model required="true"
+ * @generated
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject#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
+ */
+ protected void setVersionGen(String newVersion)
+ {
+ String oldVersion = version;
+ version = newVersion;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__VERSION, oldVersion, version));
+ }
+
+ public void setVersion(String newVersion) {
+ setVersionGen(newVersion);
+ setSchemaLocation(buildSchemaLocationString(getNamespace(), getSchemaLocationForVersion(newVersion)));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Schema Location</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema Location</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 Location</em>' attribute.
+ * @see #setSchemaLocation(String)
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getJpaRootEObject_SchemaLocation()
+ * @model required="true"
+ * @generated
+ */
+ public String getSchemaLocation()
+ {
+ return schemaLocation;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject#getSchemaLocation <em>Schema Location</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema Location</em>' attribute.
+ * @see #getSchemaLocation()
+ * @generated
+ */
+ public void setSchemaLocation(String newSchemaLocation)
+ {
+ String oldSchemaLocation = schemaLocation;
+ schemaLocation = newSchemaLocation;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION, oldSchemaLocation, schemaLocation));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__VERSION:
+ return getVersion();
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION:
+ return getSchemaLocation();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__VERSION:
+ setVersion((String)newValue);
+ return;
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION:
+ setSchemaLocation((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__VERSION:
+ setVersion(VERSION_EDEFAULT);
+ return;
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION:
+ setSchemaLocation(SCHEMA_LOCATION_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__VERSION:
+ return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
+ case CommonPackage.ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION:
+ return SCHEMA_LOCATION_EDEFAULT == null ? schemaLocation != null : !SCHEMA_LOCATION_EDEFAULT.equals(schemaLocation);
+ }
+ 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(", schemaLocation: ");
+ result.append(schemaLocation);
+ result.append(')');
+ return result.toString();
+ }
+
+
+ // **************** validation ********************************************
+
+ public TextRange getVersionTextRange() {
+ return getAttributeTextRange(XML.VERSION);
+ }
+
+
+ // **************** version -> schema location mapping ********************
+
+ protected abstract String getNamespace();
+
+ protected abstract String getSchemaLocationForVersion(String version);
+
+ private static String buildSchemaLocationString(String namespace, String schemaLocation) {
+ return namespace + ' ' + schemaLocation;
+ }
+
+
+ // **************** translators *******************************************
+
+ protected static Translator buildVersionTranslator(final Map<String, String> versionsToSchemaLocations) {
+ return new EnumeratedValueTranslator(
+ XML.VERSION,
+ CommonPackage.eINSTANCE.getJpaRootEObject_Version(),
+ Translator.DOM_ATTRIBUTE) {
+
+ @Override
+ protected Iterable<String> getEnumeratedObjectValues() {
+ return versionsToSchemaLocations.keySet();
+ }
+ };
+ }
+
+ protected static Translator buildNamespaceTranslator(String namespace) {
+ return new ConstantAttributeTranslator(XML.NAMESPACE, namespace);
+ }
+
+ protected static Translator buildSchemaNamespaceTranslator() {
+ return new ConstantAttributeTranslator(XML.NAMESPACE_XSI, XML.XSI_NAMESPACE_URL);
+ }
+
+ protected static Translator buildSchemaLocationTranslator(
+ final String namespace,
+ final Map<String, String> versionsToSchemaLocations) {
+
+ return new EnumeratedValueTranslator(
+ XML.XSI_SCHEMA_LOCATION,
+ CommonPackage.eINSTANCE.getJpaRootEObject_SchemaLocation(),
+ Translator.DOM_ATTRIBUTE) {
+
+ @Override
+ protected Iterable<String> getEnumeratedObjectValues() {
+ return new TransformationIterable<String, String>(versionsToSchemaLocations.values()) {
+ @Override
+ protected String transform(String next) {
+ return buildSchemaLocationString(namespace, next);
+ }
+ };
+ }
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonFactory.java
new file mode 100644
index 0000000000..335de1d84a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonFactory.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+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;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage
+ * @generated
+ */
+public class CommonFactory extends EFactoryImpl
+{
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final CommonFactory eINSTANCE = init();
+
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static CommonFactory init()
+ {
+ try
+ {
+ CommonFactory theCommonFactory = (CommonFactory)EPackage.Registry.INSTANCE.getEFactory("jpt.common.xmi");
+ if (theCommonFactory != null)
+ {
+ return theCommonFactory;
+ }
+ }
+ catch (Exception exception)
+ {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new CommonFactory();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CommonFactory()
+ {
+ 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
+ */
+ public CommonPackage getCommonPackage()
+ {
+ return (CommonPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static CommonPackage getPackage()
+ {
+ return CommonPackage.eINSTANCE;
+ }
+
+} //CommonFactory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonPackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonPackage.java
new file mode 100644
index 0000000000..b633baded5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonPackage.java
@@ -0,0 +1,436 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+import org.eclipse.emf.ecore.EAttribute;
+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.jpa.core.resource.orm.OrmPackage;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.OrmV2_0Package;
+import org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package;
+
+/**
+ * <!-- 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>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonFactory
+ * @model kind="package"
+ * @generated
+ */
+public class CommonPackage extends EPackageImpl
+{
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNAME = "xml";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_URI = "jpt.common.xmi";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_PREFIX = "org.eclipse.jpt.jpa.core.resource.xml";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final CommonPackage eINSTANCE = org.eclipse.jpt.jpa.core.resource.xml.CommonPackage.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject <em>Jpa Root EObject</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getJpaRootEObject()
+ * @generated
+ */
+ public static final int JPA_ROOT_EOBJECT = 1;
+
+ /**
+ * The feature id for the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JPA_ROOT_EOBJECT__VERSION = 0;
+
+ /**
+ * The feature id for the '<em><b>Schema Location</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JPA_ROOT_EOBJECT__SCHEMA_LOCATION = 1;
+
+ /**
+ * The number of structural features of the '<em>Jpa Root EObject</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JPA_ROOT_EOBJECT_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject <em>Abstract Jpa Root EObject</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getAbstractJpaRootEObject()
+ * @generated
+ */
+ public static final int ABSTRACT_JPA_ROOT_EOBJECT = 0;
+
+ /**
+ * The feature id for the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_JPA_ROOT_EOBJECT__VERSION = JPA_ROOT_EOBJECT__VERSION;
+
+ /**
+ * The feature id for the '<em><b>Schema Location</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_JPA_ROOT_EOBJECT__SCHEMA_LOCATION = JPA_ROOT_EOBJECT__SCHEMA_LOCATION;
+
+ /**
+ * The number of structural features of the '<em>Abstract Jpa Root EObject</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_JPA_ROOT_EOBJECT_FEATURE_COUNT = JPA_ROOT_EOBJECT_FEATURE_COUNT + 0;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractJpaRootEObjectEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass jpaRootEObjectEClass = 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.jpa.core.resource.xml.CommonPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private CommonPackage()
+ {
+ super(eNS_URI, CommonFactory.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.
+ *
+ * <p>This method is used to initialize {@link CommonPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static CommonPackage init()
+ {
+ if (isInited) return (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI);
+
+ // Obtain or create and register package
+ CommonPackage theCommonPackage = (CommonPackage)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CommonPackage ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CommonPackage());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.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);
+ OrmV2_0Package theOrmV2_0Package = (OrmV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) instanceof OrmV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(OrmV2_0Package.eNS_URI) : OrmV2_0Package.eINSTANCE);
+ PersistencePackage thePersistencePackage = (PersistencePackage)(EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
+ PersistenceV2_0Package thePersistenceV2_0Package = (PersistenceV2_0Package)(EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) instanceof PersistenceV2_0Package ? EPackage.Registry.INSTANCE.getEPackage(PersistenceV2_0Package.eNS_URI) : PersistenceV2_0Package.eINSTANCE);
+
+ // Create package meta-data objects
+ theCommonPackage.createPackageContents();
+ theOrmPackage.createPackageContents();
+ theOrmV2_0Package.createPackageContents();
+ thePersistencePackage.createPackageContents();
+ thePersistenceV2_0Package.createPackageContents();
+
+ // Initialize created meta-data
+ theCommonPackage.initializePackageContents();
+ theOrmPackage.initializePackageContents();
+ theOrmV2_0Package.initializePackageContents();
+ thePersistencePackage.initializePackageContents();
+ thePersistenceV2_0Package.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theCommonPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(CommonPackage.eNS_URI, theCommonPackage);
+ return theCommonPackage;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject <em>Abstract Jpa Root EObject</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Jpa Root EObject</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject
+ * @generated
+ */
+ public EClass getAbstractJpaRootEObject()
+ {
+ return abstractJpaRootEObjectEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject <em>Jpa Root EObject</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Jpa Root EObject</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject
+ * @generated
+ */
+ public EClass getJpaRootEObject()
+ {
+ return jpaRootEObjectEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#getVersion <em>Version</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Version</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#getVersion()
+ * @see #getJpaRootEObject()
+ * @generated
+ */
+ public EAttribute getJpaRootEObject_Version()
+ {
+ return (EAttribute)jpaRootEObjectEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#getSchemaLocation <em>Schema Location</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema Location</em>'.
+ * @see org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#getSchemaLocation()
+ * @see #getJpaRootEObject()
+ * @generated
+ */
+ public EAttribute getJpaRootEObject_SchemaLocation()
+ {
+ return (EAttribute)jpaRootEObjectEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * 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 CommonFactory getCommonFactory()
+ {
+ return (CommonFactory)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
+ abstractJpaRootEObjectEClass = createEClass(ABSTRACT_JPA_ROOT_EOBJECT);
+
+ jpaRootEObjectEClass = createEClass(JPA_ROOT_EOBJECT);
+ createEAttribute(jpaRootEObjectEClass, JPA_ROOT_EOBJECT__VERSION);
+ createEAttribute(jpaRootEObjectEClass, JPA_ROOT_EOBJECT__SCHEMA_LOCATION);
+ }
+
+ /**
+ * <!-- 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);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ abstractJpaRootEObjectEClass.getESuperTypes().add(this.getJpaRootEObject());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(abstractJpaRootEObjectEClass, AbstractJpaRootEObject.class, "AbstractJpaRootEObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(jpaRootEObjectEClass, JpaRootEObject.class, "JpaRootEObject", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getJpaRootEObject_Version(), ecorePackage.getEString(), "version", null, 1, 1, JpaRootEObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getJpaRootEObject_SchemaLocation(), ecorePackage.getEString(), "schemaLocation", null, 1, 1, JpaRootEObject.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.jpa.core.resource.xml.AbstractJpaRootEObject <em>Abstract Jpa Root EObject</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getAbstractJpaRootEObject()
+ * @generated
+ */
+ public static final EClass ABSTRACT_JPA_ROOT_EOBJECT = eINSTANCE.getAbstractJpaRootEObject();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject <em>Jpa Root EObject</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getJpaRootEObject()
+ * @generated
+ */
+ public static final EClass JPA_ROOT_EOBJECT = eINSTANCE.getJpaRootEObject();
+
+ /**
+ * The meta object literal for the '<em><b>Version</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute JPA_ROOT_EOBJECT__VERSION = eINSTANCE.getJpaRootEObject_Version();
+
+ /**
+ * The meta object literal for the '<em><b>Schema Location</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute JPA_ROOT_EOBJECT__SCHEMA_LOCATION = eINSTANCE.getJpaRootEObject_SchemaLocation();
+
+ }
+
+} //CommonPackage
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/EmfTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/EmfTools.java
new file mode 100644
index 0000000000..6a4656a939
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/EmfTools.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.3
+ */
+public class EmfTools {
+
+ public static <T extends EObject> T create(EFactory eFactory, EClass eClass, Class<T> javaClass) {
+ for (EClassifier factoryEClassifier : eFactory.getEPackage().getEClassifiers()) {
+ if (factoryEClassifier instanceof EClass) {
+ EClass factoryEClass = (EClass) factoryEClassifier;
+ if (eClass.isSuperTypeOf(factoryEClass)) {
+ return javaClass.cast(eFactory.create(factoryEClass));
+ }
+ }
+ }
+ throw new IllegalArgumentException("Factory does not support objects of type \'" + eClass.getName() + '\''); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaEObject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaEObject.java
new file mode 100644
index 0000000000..97b4dbbb3f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaEObject.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.text.edits.DeleteEdit;
+
+/**
+ * Common Dali behavior for EMF objects.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 2.2
+ */
+public interface JpaEObject
+ extends EObject
+{
+ /**
+ * Return whether all the object's EMF features are "unset".
+ */
+ boolean isUnset();
+
+ /**
+ * Return true if this object's text representation contains the text offset
+ */
+ boolean containsOffset(int textOffset);
+
+ /**
+ * Return the text range to be used for validation. This is the source
+ * range that will be highlighted for a validation error.
+ */
+ TextRange getValidationTextRange();
+
+ /**
+ * Return the text range to be used for selection. This is the source
+ * range that will be highlighted when selecting in the structure view.
+ */
+ TextRange getSelectionTextRange();
+
+
+ // ********** refactoring **********
+
+ /**
+ * Create a text DeleteEdit for deleting the entire IDOMNode and any text that precedes it.
+ */
+ DeleteEdit createDeleteEdit();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaRootEObject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaRootEObject.java
new file mode 100644
index 0000000000..57aa329d20
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaRootEObject.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+import org.eclipse.jpt.common.core.utility.TextRange;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Jpa Root EObject</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#getVersion <em>Version</em>}</li>
+ * <li>{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#getSchemaLocation <em>Schema Location</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getJpaRootEObject()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends JpaEObject
+ * @generated
+ */
+public interface JpaRootEObject extends JpaEObject
+{
+ /**
+ * 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.jpa.core.resource.xml.CommonPackage#getJpaRootEObject_Version()
+ * @model required="true"
+ * @generated
+ */
+ String getVersion();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#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
+ */
+ void setVersion(String value);
+
+ /**
+ * Returns the value of the '<em><b>Schema Location</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema Location</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 Location</em>' attribute.
+ * @see #setSchemaLocation(String)
+ * @see org.eclipse.jpt.jpa.core.resource.xml.CommonPackage#getJpaRootEObject_SchemaLocation()
+ * @model required="true"
+ * @generated
+ */
+ String getSchemaLocation();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.xml.JpaRootEObject#getSchemaLocation <em>Schema Location</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema Location</em>' attribute.
+ * @see #getSchemaLocation()
+ * @generated
+ */
+ void setSchemaLocation(String value);
+
+ TextRange getVersionTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java
new file mode 100644
index 0000000000..0a4e29b098
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jem.util.plugin.JEMUtilPlugin;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.JptResourceModelListener;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.ListenerList;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jst.j2ee.internal.xml.J2EEXmlDtDEntityResolver;
+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.TranslatorResourceImpl;
+import org.xml.sax.EntityResolver;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+public class JpaXmlResource
+ extends TranslatorResourceImpl
+ implements JptResourceModel
+{
+ /**
+ * cache the content type - if the content type changes, the JPA project
+ * will throw out the JPA file holding the xml resource and build a new one
+ */
+ protected final IContentType contentType;
+
+ protected final Translator rootTranslator;
+
+ protected final ListenerList<JptResourceModelListener> resourceModelListenerList =
+ new ListenerList<JptResourceModelListener>(JptResourceModelListener.class);
+
+
+ public JpaXmlResource(URI uri, Renderer renderer, IContentType contentType, Translator rootTranslator) {
+ super(uri, renderer);
+ this.contentType = contentType;
+ this.rootTranslator = rootTranslator;
+ }
+
+ public IContentType getContentType() {
+ return this.contentType;
+ }
+
+ public String getVersion() {
+ JpaRootEObject root = this.getRootObject();
+ return (root == null) ? null : root.getVersion();
+ }
+
+ /**
+ * Build a new resource type every time(?).
+ */
+ public JptResourceType getResourceType() {
+ String version = this.getVersion();
+ return ((this.contentType == null) || (version == null)) ?
+ null :
+ new JptResourceType(this.contentType, version);
+ }
+
+
+ // ********** BasicNotifierImpl override **********
+
+ /**
+ * Override to fire notification only when:<ul>
+ * <li>the resource's state has actually changed; and
+ * <li>the resource is loaded; and
+ * <li>the resource's resource set is still present (EMF will fire an
+ * notification when the resource set is set to 'null', just before
+ * the resource is "unloaded" - we want to swallow this notification)
+ * </ul>
+ */
+ @Override
+ public void eNotify(Notification notification) {
+ // unload events can happen before the resource set is removed - should always react to unload events
+ if (this.loadedFlagCleared(notification)) {
+ super.eNotify(notification);
+ if (this.isReverting()) {
+ this.resourceModelReverted();
+ } else {
+ this.resourceModelUnloaded();
+ }
+ }
+ else if ( ! notification.isTouch() && this.isLoaded() && (this.resourceSet != null)) {
+ super.eNotify(notification);
+ this.resourceModelChanged();
+ }
+ }
+
+ /**
+ * Return whether the specified notification indicates the resource has been
+ * unloaded.
+ * we could use this method to suppress some notifications; or we could just
+ * check whether 'resourceSet' is 'null' (which is what we do)
+ */
+ protected boolean loadedFlagCleared(Notification notification) {
+ return (notification.getNotifier() == this) &&
+ (notification.getEventType() == Notification.SET) &&
+ (notification.getFeatureID(Resource.class) == RESOURCE__IS_LOADED) &&
+ ( ! notification.getNewBooleanValue());
+ }
+
+ /**
+ * Return whether the specified notification indicates the resource's
+ * resource set was cleared.
+ * We could use this method to suppress some resource set notifications;
+ * or we could just check whether <code>resourceSet</code> is
+ * <code>null</code> (which is what we do)/
+ */
+ protected boolean resultSetCleared(Notification notification) {
+ return (notification.getNotifier() == this) &&
+ (notification.getEventType() == Notification.SET) &&
+ (notification.getFeatureID(Resource.class) == RESOURCE__RESOURCE_SET) &&
+ (notification.getNewValue() == null);
+ }
+
+
+ // ********** TranslatorResource implementation **********
+
+ /**
+ * only applicable for DTD-based files
+ */
+ public String getDoctype() {
+ return null;
+ }
+
+ public Translator getRootTranslator() {
+ return this.rootTranslator;
+ }
+
+
+ // ********** TranslatorResourceImpl implementation **********
+
+ /**
+ * only applicable for DTD-based files
+ */
+ @Override
+ protected String getDefaultPublicId() {
+ return null;
+ }
+
+ /**
+ * only applicable for DTD-based files
+ */
+ @Override
+ protected String getDefaultSystemId() {
+ return null;
+ }
+
+ /**
+ * this seems to be the default version of the spec for this doc
+ * and the id 10 maps to the version 1.0
+ */
+ @Override
+ protected int getDefaultVersionID() {
+ return 10;
+ }
+
+ @Override
+ public JpaRootEObject getRootObject() {
+ EObject root = super.getRootObject();
+ try {
+ return (JpaRootEObject) root;
+ } catch (ClassCastException ex) {
+ throw new IllegalStateException("The root object of a JPA XML resource must implement JpaRootEObject: " + root, ex); //$NON-NLS-1$
+ }
+ }
+
+ //296544 - override this to avoid internet access finding the schema during tests
+ @Override
+ public EntityResolver getEntityResolver() {
+ return J2EEXmlDtDEntityResolver.INSTANCE;
+ }
+
+
+ // ********** convenience methods **********
+
+ public boolean fileExists() {
+ return this.getFile().exists();
+ }
+
+ public IFile getFile() {
+ IFile file = this.getFile(this.uri);
+ return (file != null) ? file : this.getConvertedURIFile();
+ }
+
+ protected IFile getConvertedURIFile() {
+ if (this.resourceSet == null) {
+ return null;
+ }
+ URI convertedURI = this.resourceSet.getURIConverter().normalize(this.uri);
+ return this.uri.equals(convertedURI) ? null : this.getFile(convertedURI);
+ }
+
+ /**
+ * Return the Eclipse file for the specified URI.
+ * This URI is assumed to be absolute in the following format:
+ * platform:/resource/....
+ */
+ protected IFile getFile(URI fileURI) {
+ if ( ! WorkbenchResourceHelperBase.isPlatformResourceURI(fileURI)) {
+ return null;
+ }
+ String fileName = URI.decode(fileURI.path()).substring(JEMUtilPlugin.PLATFORM_RESOURCE.length() + 1);
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileName));
+ }
+
+ public IProject getProject() {
+ return this.getFile().getProject();
+ }
+
+ public void modify(Runnable runnable) {
+ try {
+ runnable.run();
+ try {
+ save(Collections.EMPTY_MAP);
+ } catch (IOException ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ } catch (Exception ex) {
+ JptJpaCorePlugin.log(ex);
+ }
+ }
+
+ @Override
+ public String toString() {
+ // implementation in TranslatorResourceImpl is a bit off...
+ return StringTools.buildToStringFor(this, this.getURI());
+ }
+
+
+ // ********** JptResourceModel implementation **********
+
+ public void addResourceModelListener(JptResourceModelListener listener) {
+ this.resourceModelListenerList.add(listener);
+ }
+
+ public void removeResourceModelListener(JptResourceModelListener listener) {
+ this.resourceModelListenerList.remove(listener);
+ }
+
+
+ // ********** listener notifications **********
+
+ protected void resourceModelChanged() {
+ for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
+ listener.resourceModelChanged(this);
+ }
+ }
+
+ protected void resourceModelReverted() {
+ for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
+ listener.resourceModelReverted(this);
+ }
+ }
+
+ protected void resourceModelUnloaded() {
+ for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
+ listener.resourceModelUnloaded(this);
+ }
+ }
+
+
+ // ********** cast things back to what they are in EMF **********
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public EList<Adapter> eAdapters() {
+ return super.eAdapters();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public EList<EObject> getContents() {
+ return super.getContents();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/XML.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/XML.java
new file mode 100644
index 0000000000..53e161227f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/XML.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.resource.xml;
+
+/**
+ * XML-related stuff.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.2
+ */
+@SuppressWarnings("nls")
+public interface XML
+{
+ String VERSION = "version";
+
+ String NAMESPACE = "xmlns";
+
+ String NAMESPACE_XSI = "xmlns:xsi";
+ String XSI_NAMESPACE_URL = "http://www.w3.org/2001/XMLSchema-instance";
+
+ String XSI_SCHEMA_LOCATION = "xsi:schemaLocation";
+}

Back to the top